I've found a great python library implementing Levenshtein functions (distance, ratio, etc.) at http://code.google.com/p/pylevenshtein/ but the project seems inactive and the documentation is nowhere to be found. I was wondering if anyone knows better than me and can point me to the documentation.
Levenshtein is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the file COPYING for the full text of GNU General Public License version 2.
The python-Levenshtein ratio is computed as follows (in ratio_py): return (lensum - ldist) / lensum. ldist is the Levenshtein distance, lensum is the sum of the two string lengths. If lensum is zero (two empty strings), ratio_py returns 1.0 as a special case.
Here is an example:
# install with: pip install python-Levenshtein from Levenshtein import distance edit_dist = distance("ah", "aho")
You won't have to generate the docs yourself. There's an online copy of the original Python Levenshtein API: http://www.coli.uni-saarland.de/courses/LT1/2011/slides/Python-Levenshtein.html
Follow instructions at the updated version: https://github.com/joncasdam/python-Levenshtein
To get a generated documentation. This was updated 3 months back.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With