Levenshtein distance


Hi there! I’m trying to do something where Levenshtein distance could help, UIpath have something like that?


Nothing built-in that I know of, but it shouldn’t be hard to build a custom code activity for it.


thank you!


Hello, @carmen! I need an activity that computes Levenshtein distance. Did you make it?



Hi @Bernardo_Ferreira, I’m sorry I didn’t.


@Bernardo_Ferreira, if you can settle for what I think is Damerau-Levenshtein instead of Levenshtein, try this workflow below.
You’ll need a “Run Auto Hot Key Script”, so that means installing UiPath.Script.Activities if you don’t already have it.
The results of 'wordIn = “tset”, 'listIn = "“random,task,test,text,toast” are:


I think true Levenshtein would be:


but I may well have it backwards. Either way, if you fiddle with the script you can use either, I suppose.
I think if you want to pass in a collection as anything but a string you’ll have to convert this to an “Invoke Code” activity or “AHKActivities”.

There’s a link in the script “Fuzzy Test Function.ahk” to the AutoHotkey forum, or here, where I got the script that I modified for the workflow. The original “Fuzzy Test.ahk” is included also, as is the “LDistance.ahk” library itself.

Levenshtein.zip (4.3 KB)

EDIT: Okay, here’s two workflows, L3 is Damerau-Levenshtein, L4 is Levenshtein.

Levenshtein_and_Damerau-Levenshtein.zip (15.8 KB)

Levenshtein screenshot confirming my suspicions above:



Thank you @burque505. I will try to see if I can solve my issue with this.

Best Regards,
Bernardo Ferreira


Good luck with it, Bernardo. If it works for you please let me know. Thanks!




I got it working in my colleague’s computer, but when i tried to execute it in mine, I found out that I don’t have UiPath.Script.Activities. Can you help me installing it, please?

Best Regards,
Bernardo Ferreira


I got it working, just for future reference, here is the link for the UiPath.Script.Activities package:


If you need help installing a package, use this:

Best Regards,
Bernardo Ferreira


@Bernardo_Ferreira, glad to hear it!


You could also try this in the Code activity


Updated to reflect changes in code at the AHK link above.

Levenshtein_and_Damerau_Levenshtein_updated.zip (7.5 KB)


Very interested in this, company content restrictions don’t let me download zip files though. Could you upload the .xamls separately please?