Hello everyone, Quick question if anyone can help... Is there any Snap or technique/workaround known that can be used to compare 2 strings and calculate the difference between them to generate quantitative data (for example the Levenshtein distance)? Thanks all in advance!
Match and deduplicate should help with that from memory, they are in the ML snap packs
Thanks for your reply, Jocelyn. I looked at Match, and it seems like it can only route data based on "Matched | Not matched" and give a confidence level. It won't give the results of the comparison itself from what I see.
Hi Jean-Francois - Other than Match, I queried docs and SnapGPT and other options are: Option 2: Deduplicate Snap (Machine Learning Snap Pack) The Deduplicate Snap uses the same set of comparators (including Levenshtein) but is intended for deduplication within a single dataset. It can still be leveraged to identify how "different" records are from each other with a configurable threshold, but it's less suited for general-purpose pairwise string comparison. Option 3: Script Snap (Custom Workaround for Raw Distance) If you need the raw Levenshtein integer distance (e.g., "kitten" vs "sitting" = 3), you can implement it using a Script Snap with Python or JavaScript: Example (Python-style pseudologic inside a Script Snap): import Levenshtein # if available, or implement manually distance = Levenshtein.distance(input['string1'], input['string2']) output['levenshtein_distance'] = distance Note: Library availability depends on your Snaplex configuration. A custom implementation of the algorithm can also be coded directly in the script. For most use cases involving quantitative string similarity, the Match Snap from the Machine Learning Snap Pack is the recommended starting point due to its built-in support for Levenshtein and many other algorithms.
