LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String similarity

Do you know any functions, packages, addons... for calculating string similarity? (such as Levenshtein distance, etc.)

0 Kudos
Message 1 of 6
(4,783 Views)

I think you have to build these functions on your own..Using string functions available.

See this example of "Levenshtein distance"....

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
Message 2 of 6
(4,775 Views)

See here in the LAVA CR for an implementation of the levenshtein distance.

 

Felix

Message 3 of 6
(4,771 Views)

LAVA version works. gak's VI sometimes doesn't. Compared with PHP's Levenshtein function

0 Kudos
Message 4 of 6
(4,744 Views)

May be, I just gave an example as in how you can use string functions available in labview to fulfill your purpose.Smiley Happy

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 5 of 6
(4,710 Views)

Thanks everyone for sharing the LabVIEW implementations, especially Gak and Felix.

Since the original poster mentioned that one VI sometimes gives incorrect results compared with PHP, I'd suggest testing a few simple cases:

  • "kitten" vs. "sitting" → 3

  • "abc" vs. "abc" → 0

  • "abc" vs. "" → 3

  • "ab" vs. "ba" → 2 (standard Levenshtein)

If the results differ, I'd check the initialization of the first row and column in the distance matrix, then verify that the previous diagonal value is preserved when updating cells.

These are common places where a dynamic programming implementation can go wrong.

This reference on https://www.levenshtein.net/levenshtein-implementations explains the relevant details.

For transparency, I contribute to the linked reference.

Thanks again for the helpful discussion!

0 Kudos
Message 6 of 6
(79 Views)