edit_operation
There are already several Python packages that implement levenshtein distance, which are writtend by C or C++ to improve the efficiency. In certain occasions, besides the edit distance, the edit operations are also needed. python-Levenshtein has the editops function but doesn't support transpose operations. So here comes the project, editdistpy supports the function of edit operations under Damerau–Levenshtein distance.
Install
pip install -U edit_operation
Usage
The package supports distance and edit_operations two functions. They have the same parameters
- string a
- string b
- max_distance: Only return right result under max_distance.
- is_damerau: Whether support transpose operation or not.
distance
from edit_operation import levenshtein
a = 'absolute'
b = 'absiluti'
dis = levenshtein.distance(a, b)
return -1 if the actual distance is beyond max_distance, by default max_distance is -1, which means no max_distance limit.
edit_operations
from edit_operation import levenshtein
a = 'absolute'
b = 'bsiluti'
operations = levenshtein.edit_operations(a, b, is_damerau=True)
"""
[{'operation': 'replace', 'location': 7, 'char_x': 'e', 'char_y': 'i'},
{'operation': 'delete', 'location': 0, 'char_x': '@', 'char_y': 'a'}]
"""
@ character means the beginning of the input string. Return empty list if the actual distance is beyond max_distance.
Metadata
Release files for edit-operation 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 536.1 kB
Release files / edit_operation-1.0.0-cp38-cp38-win_amd64.whl
| Download URL | edit_operation-1.0.0-cp38-cp38-win_amd64.whl |
|---|---|
| Size | 20.0 kB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
99a6a6defe65ffb82d359cd93d2ea1d90141e5532a14ceee60057e8f4824863d
|
|
BLAKE2b-256 checksum How to use checksums |
aca79c704231faf31b26fdf016610d92a1cb9afa5902551c9ccc04883381aae2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.11
|
Release files / edit_operation-1.0.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | edit_operation-1.0.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 157.8 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
b12290aa62d21b132234fc9baf4914607ba2ae208e90cf002bb5cd643c73c67a
|
|
BLAKE2b-256 checksum How to use checksums |
d30af5725029c8e00b938eb5bc28c045e035e2cfac37003c55ef5dc809d129a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.11
|
Release files / edit_operation-1.0.0-cp38-cp38-macosx_10_9_x86_64.whl
| Download URL | edit_operation-1.0.0-cp38-cp38-macosx_10_9_x86_64.whl |
|---|---|
| Size | 19.7 kB |
| Tags | CPython 3.8 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
8bef55cd43e5c39245c97bd6b7b657ffcfaf24cb2211271713d392e14623ddd8
|
|
BLAKE2b-256 checksum How to use checksums |
92267e7c337aac52626849887d2dca519ba53a5791cf3a3931d6f71465f078bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.11
|
Release files / edit_operation-1.0.0-cp37-cp37m-win_amd64.whl
| Download URL | edit_operation-1.0.0-cp37-cp37m-win_amd64.whl |
|---|---|
| Size | 19.9 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
994ab4270ef900ee06a87085ecf1bc35cd73b9a22f58607fad3a4dfafad56a25
|
|
BLAKE2b-256 checksum How to use checksums |
ba158d1e224038036a3cfebb2b6d83d95ea552dd68b4c4b041419a7453e60c0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.11
|
Release files / edit_operation-1.0.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | edit_operation-1.0.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 149.1 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
8f69ea6c75f08d1181efcf5649540025496fc4b167e6e0498d8f7e9f67ee57b8
|
|
BLAKE2b-256 checksum How to use checksums |
4ab06ec0cd8ead92e50d727f5bd10200a30e4b379f5c718a89d5017ef15bf261
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.11
|
Release files / edit_operation-1.0.0-cp36-cp36m-win_amd64.whl
| Download URL | edit_operation-1.0.0-cp36-cp36m-win_amd64.whl |
|---|---|
| Size | 21.6 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a24fbde78a33a0b8b3559b1cb784e82dfda0cfc6acb2cfbd23f48a9bbedec2e1
|
|
BLAKE2b-256 checksum How to use checksums |
86847a6df6f3fb8950696dc4714a2a4c8dce3b711e8d3520b5bf7618c5fc9432
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.11
|
Release files / edit_operation-1.0.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | edit_operation-1.0.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 148.0 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
396f4aae097ad949eb9e8978ef19785271751ffa4f2cb534c5e2d8efd1b381ca
|
|
BLAKE2b-256 checksum How to use checksums |
500ec121ecb77b00509ec0b24483dcd3ae90f7da179ffb9d83246ca0e2475de8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.11
|
Security for edit-operation 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.