06-27-2023 03:10 PM
I have a silly question which I think I know the answer to but I am wondering if someone has tackled this.
What I am after is an algorithm that looks at text that is entered (or coming from one source) and compares it from another source. Now, this text might have an extra space, a dash, or even misplaced words but the algorithm says "yeah, that is what the user is looking for."
Is what I am asking not possible? My scenario is data coming from two different sources looking at the same data, which may be slightly off, but neither system knows about the other.
I have an example VI below but I am at a loss on how to implement what I want.
06-27-2023 03:49 PM
I believe I may have a solution. A simple Google search for "check that two strings are close enough" came up with the Levenshtein Distance Algorithm to implement into my VI.
06-27-2023 04:26 PM
Looks like a few people have been down that path; maybe you won't have to run your own!
https://forums.ni.com/t5/LabVIEW/String-similarity/td-p/1332452
https://lavag.org/topic/22309-string-similarity-in-g/
06-27-2023 05:46 PM
Try this.
06-28-2023 07:48 AM - edited 06-28-2023 07:49 AM
I'll admit...I like being challenged so, I decided to tackle this via the website I posted.
I am having difficulty deciphering this piece of the Java code:
for (i = 0; i<=n; i++) {
p[i] = i;
}
I think it is just placing numeric values into an array. Is that correct? Attached is the LV code (2021) plus I copied the code from the website into a comment box.
06-28-2023 07:55 AM
Paul - I am not sure if yours would work. Maybe I am just looking at this from the website I posted but aren't you comparing the two words character for character?
06-28-2023 04:10 PM
@Eric1977 wrote:
for (i = 0; i<=n; i++) {
p[i] = i;
}
I am not used to Java programming (actually, I've never programmed in it before) but it's just a For Loop incrementing one digit to the p array, correct?
06-28-2023 05:59 PM
@Eric1977 wrote:
Paul - I am not sure if yours would work. Maybe I am just looking at this from the website I posted but aren't you comparing the two words character for character?
No. It's recursive and correctly implements a Levenshtein Distance Algorithm.
06-28-2023 06:01 PM
06-29-2023 01:32 AM
@paul_a_cardinale wrote:
@Eric1977 wrote:
@Eric1977 wrote:
for (i = 0; i<=n; i++) {
p[i] = i;
}I am not used to Java programming (actually, I've never programmed in it before) but it's just a For Loop incrementing one digit to the p array, correct?
Here's the equivalent LabVIEW code:
Is there a '+1' missing between the control 'n' and the 'N' terminal of the for loop?