Fast banded edit distance
Project description
tinyalign
A small Python module providing edit distance (aka Levenshtein distance, that is, counting insertions, deletions and substitutions) and Hamming distance computation.
Its main purpose is to speed up computation of edit distance by
allowing to specify a maximum number of differences maxdiff (banding). If
that parameter is provided, the returned edit distance is anly accurate up to
maxdiff. That is, if the actual edit distance is higher than maxdiff, a
value larger than maxdiff is returned, but not necessarily the actual edit
distance.
For computing regular edit distances or if your maxdiff is less than 4, you
should prefer https://github.com/fujimotos/polyleven, as that is
faster in that case. When maxdiff is 4 or more, but not too close to the
length of the shortest string, this module is faster.
>>> from tinyalign import edit_distance, hamming_distance
>>> edit_distance("banana", "ananas")
2
>>> hamming_distance("hello", "yello")
1
>>> edit_distance("hello", "world", maxdiff=2)
3
Changes
v0.2.2
- Added type hints
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tinyalign-0.2.2.tar.gz.
File metadata
- Download URL: tinyalign-0.2.2.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c6dc91ae4a886ab9369a106115add04c71fb62b45f706247d494e43ccf7a588
|
|
| MD5 |
b00bb362dbda4a0ad6ec2b7eb1a32da8
|
|
| BLAKE2b-256 |
a75087554aae2814534b487080408a9c2f34903735bfe45eef3b5412239b9600
|
File details
Details for the file tinyalign-0.2.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: tinyalign-0.2.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 29.9 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c14d02281d7e679dc6142fc352bfc65887df1cbef35dcf294de0639cc94ec91
|
|
| MD5 |
1a4a32e189dccc27d48d7378a7b5b916
|
|
| BLAKE2b-256 |
5e7d535f4b84f8bff2d53cf8392795ee9ea626e387fd8b02f1ca16de5b9528fb
|
File details
Details for the file tinyalign-0.2.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: tinyalign-0.2.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 30.6 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1753e9ff2d4737d253b5ffe7d0694e58aaf88eeab85e67802af54637f78e46b
|
|
| MD5 |
1b515bbeaf56893ab5803812f13d2a72
|
|
| BLAKE2b-256 |
ff82161919829efd1b4582cbbab0c75c3bf374fe580eb0fc669d40d05427898a
|
File details
Details for the file tinyalign-0.2.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: tinyalign-0.2.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 30.2 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8056ef795d5ba9c3f5213604b74c0402509e521f54806c2fbdba9595fcddce82
|
|
| MD5 |
e9f3ef1eee4e319429796b91cf2cc205
|
|
| BLAKE2b-256 |
1cdd779a4bc2ad81ddf8276f4dfee4beb178ae8d0a78edb8f9554e523018a214
|
File details
Details for the file tinyalign-0.2.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: tinyalign-0.2.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 30.1 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b611b4ed27fe33d785b7db2eff10862457e11753d8fac79e54ec4eb0ad05a1bf
|
|
| MD5 |
4babaf82ed34acc8fcf7a0b8597f0107
|
|
| BLAKE2b-256 |
d9d8792a51a36605b448659f491afc5c96fc7da3fd51d42e5e6757110d149d5f
|
File details
Details for the file tinyalign-0.2.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: tinyalign-0.2.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 30.1 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed63ba6dffc8c50d43fc7dd0b7d1ca0bd025059f0386129105384eb5339be93e
|
|
| MD5 |
561c493b950b0e85f592b37c029e26e3
|
|
| BLAKE2b-256 |
4d972c1d29a8d9463b2cc29fa98db3656f2d1b346068dbedc3ee8bc0a68e6043
|
File details
Details for the file tinyalign-0.2.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: tinyalign-0.2.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 30.2 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc28439b0238308aff0a48544e2b6c60ba97bdf58a9da7c3cbcc05733c942222
|
|
| MD5 |
24f0c44c39818b7bedcb15404cf5d707
|
|
| BLAKE2b-256 |
dc37353e79beba75bbb5500290f66df40735655cf9b4b2adb36dead426c63158
|
File details
Details for the file tinyalign-0.2.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: tinyalign-0.2.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 30.7 kB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8398796014dc8452a8d4497dd6cb0848b380f097d10801f8ff4727760f8ed5bf
|
|
| MD5 |
e59f22123fdfed423f09883a6d9e826b
|
|
| BLAKE2b-256 |
583fe509d1faaafd6c34a37b0546a39a6b7bd3a306e87c1b4a77f2a928c607f3
|