The `distance` library provides utilities for comparing arbitrary sequences, implementing metrics such as Levenshtein, Hamming, Jaccard, and Sorensen distances. It offers both pure Python implementations and C extensions for performance. The library's last release was in 2013, indicating it is no longer actively maintained.
pip install DistanceVerified import paths — ran on the pinned version, not inferred.
Calculates Levenshtein, Hamming, and Jaccard distances between sequences using the primary functions provided by the library.
Consider using actively maintained alternatives such as `textdistance`, `python-Levenshtein` (now `Levenshtein`), `editdistance`, or `scipy.spatial.distance` for similar functionality, which offer better compatibility and performance with current Python environments.
If C extension installation fails, remove the `--global-option="--with-c"` flag and use the pure Python implementation. For better performance with C extensions, consider modern libraries that are actively maintained and provide optimized C/Cython implementations (e.g., `Levenshtein` for string distances).
Thoroughly test distance calculations with diverse string inputs, especially those involving non-ASCII characters or complex Unicode, if you choose to use this library. Prefer modern libraries for robust Unicode support.
Install the package using pip: `pip install distance`
Install a C compiler and Python development files for your operating system. For Debian/Ubuntu, use `sudo apt-get install build-essential python3-dev`. For macOS, use `xcode-select --install`. For Windows, install Microsoft Visual C++ Build Tools.
Import the `distance` module and then access the function as an attribute: `import distance` followed by `distance.levenshtein(...)`.
No dependency data recorded yet.