Minimum Edit Distance in Cython
This provides String Distance functions in Cython.
Edit Based
With these metrics smaller is better.
levenshtein(1 for insert, 1 for delete, and 1 for substitution)levenshtein_no_sub(1 for insert, 1 for delete, 2 for substitution)brew(0.1 for insert, 15 for delete, and 1 for substitution)dameran_levenshtein(1 for insert, 1 for delete, 1 for substitution, 1 for transposition)
Token Based
cosine_distancebinary_cosine_distancejaccard_distance
Sequence Based
With these metrics Larger is better.
longest_common_subsequencelongest_common_substringRatcliff-Obershelft
Extending and rolling your own cost functions
There are 2 kinds of functions used to define costs for the dynamic programming minimum edit distance algorithm. The first is ctypedef int (*cmp_func)(int c1, int c2) which is used to compare two characters and return a cost. The second is ctypedef int (*char_func)(int c1, int c2). By implementing your own versions of these functions (I would recommned doing it in cost.pxd and inline'ing the function) you can pass them to the distance solver to implement your own weighting scheme. The cmp_func can be used to weight a substitution (for example a low cost to letter next to each other on the keyboard like w and e and high cost to far keys like z and p). The char_func can can be used to weight the insert or delete, for example you could weight inserts by their scabble scores.
Metadata
Release files for string-distance 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| string_distance-1.0.0.tar.gz | 495.3 kB | Without provenance | Details |
Release files / string_distance-1.0.0.tar.gz
| Download URL | string_distance-1.0.0.tar.gz |
|---|---|
| Size | 495.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e001d7ef9f643416ba3b060931504cbf59bc3e19da9dbfd454337dd3db966fd2
|
|
BLAKE2b-256 checksum How to use checksums |
e2c18241afb306a606aeee00a934cc77f24e9b20ec1842023289dbb54c83c7b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for string-distance 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.