translate.search.lshtein

Package translate :: Package search :: Module lshtein |
[hide private]
[frames] | no frames]

# Module lshtein

source code

A class to calculate a similarity based on the Levenshtein distance. See http://en.wikipedia.org/wiki/Levenshtein_distance.

If available, the python-Levenshtein package will be used which will provide better performance as it is implemented natively. See http://trific.ath.cx/python/levenshtein/

Classes | [hide private]
| LevenshteinComparer

Functions | [hide private]
python_distance(a, b, stopvalue=-1) Calculates the distance for use in similarity calculation. | source code
native_distance(a, b, stopvalue=0) Same as python_distance in functionality. | source code
distance(a, b, stopvalue=0) Same as python_distance in functionality. | source code

Imports: math, Levenshtein, logging

Function Details | [hide private]

### python_distance(a, b, stopvalue=-1) | source code
Calculates the distance for use in similarity calculation. Python version.

### native_distance(a, b, stopvalue=0) | source code
Same as python_distance in functionality. This uses the fast C version if we detected it earlier. Note that this does not support arbitrary sequence types, but only string types.

### distance(a, b, stopvalue=0) | source code
Same as python_distance in functionality. This uses the fast C version if we detected it earlier. Note that this does not support arbitrary sequence types, but only string types.