The Levenshtein distance is used for measuring the “distance” or similarity of two character strings. Other similarity algorithms can be supplied to the code that does the matching.
This code is used in pot2po and in the lookupserver. It is implemented in the toolkit, but can optionally use the fast C implementation provided by python-Levenshtein if it is installed.
To exercise the code, the lookupserver can be used with the method “matches(message, max_candidates=15, min_similarity=50)”, or the classfile “Levenshtein.py” can be executed directly with
python Levenshtein.py "The first string." "The second string"
(remember to quote the two parameters)
The following things should be noted:
The following shortcommings have been identified: