Skip to main content

Implementation of edit distance calculation.

Project description

Fast calculation of Edit Distance (ED)

A implementation of edit distance with improved runtime. Implemented using C and cython.

Highlight:

This edit distance calculation is significantly faster than most of existing python package. It enables a max edit distance search, specifically, if you have a query sequence and wanted to find the most similar item in a long list, you could set a maximum edit distance and enable a fast search.

Installation:

Install using pip:

pip install fast-edit-distance

or build from source

git clone https://github.com/youyupei/fast_edit_distance.git
cd fast_edit_distance
python3 setup.py build
python3 setup.py install --user

Usage:

from fast_edit_distance import edit_distance

# example
edit_distance(string1, string2, max_ed=5)

Compare with Levenshtein.distance

The fast_edit_distance.edit_distance has the same function as Levenshtein.distance with significantly improved runtime. Especially when people need to identied pair of strings whose ED are smaller than a number (set max_ed in fast_edit_distance.edit_distance). Here is the runtime test with some random sequence (Run the test/test.py to reproduce this comparison):

Runtime test no max ed cutoff(1_000_000 iteration):
Levenshtein.distance: 46.49s
fast_edit_distance.edit_distance: 12.75s

Runtime test with max ed cutoff 1 (1_000_000 iteration):
Levenshtein.distance: 46.45s
fast_edit_distance.edit_distance: 0.50s

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fast_edit_distance-1.2.2.tar.gz (76.3 kB view hashes)

Uploaded Source

Built Distributions

fast_edit_distance-1.2.2-pp310-pypy310_pp73-win_amd64.whl (23.2 kB view hashes)

Uploaded PyPy Windows x86-64

fast_edit_distance-1.2.2-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25.0 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

fast_edit_distance-1.2.2-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (26.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fast_edit_distance-1.2.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl (20.8 kB view hashes)

Uploaded PyPy macOS 11.0+ ARM64

fast_edit_distance-1.2.2-pp310-pypy310_pp73-macosx_10_15_x86_64.whl (21.4 kB view hashes)

Uploaded PyPy macOS 10.15+ x86-64

fast_edit_distance-1.2.2-pp39-pypy39_pp73-win_amd64.whl (23.2 kB view hashes)

Uploaded PyPy Windows x86-64

fast_edit_distance-1.2.2-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25.0 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

fast_edit_distance-1.2.2-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (26.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fast_edit_distance-1.2.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl (20.8 kB view hashes)

Uploaded PyPy macOS 11.0+ ARM64

fast_edit_distance-1.2.2-pp39-pypy39_pp73-macosx_10_15_x86_64.whl (21.4 kB view hashes)

Uploaded PyPy macOS 10.15+ x86-64

fast_edit_distance-1.2.2-pp38-pypy38_pp73-win_amd64.whl (22.6 kB view hashes)

Uploaded PyPy Windows x86-64

fast_edit_distance-1.2.2-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (24.2 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

fast_edit_distance-1.2.2-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (24.8 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fast_edit_distance-1.2.2-pp38-pypy38_pp73-macosx_11_0_arm64.whl (20.2 kB view hashes)

Uploaded PyPy macOS 11.0+ ARM64

fast_edit_distance-1.2.2-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (20.6 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

fast_edit_distance-1.2.2-pp37-pypy37_pp73-win_amd64.whl (22.6 kB view hashes)

Uploaded PyPy Windows x86-64

fast_edit_distance-1.2.2-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (24.2 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

fast_edit_distance-1.2.2-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (24.8 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fast_edit_distance-1.2.2-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (20.6 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

fast_edit_distance-1.2.2-cp313-cp313-win_amd64.whl (24.7 kB view hashes)

Uploaded CPython 3.13 Windows x86-64

fast_edit_distance-1.2.2-cp313-cp313-win32.whl (22.4 kB view hashes)

Uploaded CPython 3.13 Windows x86

fast_edit_distance-1.2.2-cp313-cp313-musllinux_1_2_x86_64.whl (129.6 kB view hashes)

Uploaded CPython 3.13 musllinux: musl 1.2+ x86-64

fast_edit_distance-1.2.2-cp313-cp313-musllinux_1_2_i686.whl (121.0 kB view hashes)

Uploaded CPython 3.13 musllinux: musl 1.2+ i686

fast_edit_distance-1.2.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (128.7 kB view hashes)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

fast_edit_distance-1.2.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (119.0 kB view hashes)

Uploaded CPython 3.13 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fast_edit_distance-1.2.2-cp313-cp313-macosx_11_0_arm64.whl (23.4 kB view hashes)

Uploaded CPython 3.13 macOS 11.0+ ARM64

fast_edit_distance-1.2.2-cp313-cp313-macosx_10_13_x86_64.whl (24.1 kB view hashes)

Uploaded CPython 3.13 macOS 10.13+ x86-64

fast_edit_distance-1.2.2-cp312-cp312-win_amd64.whl (25.4 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

fast_edit_distance-1.2.2-cp312-cp312-win32.whl (23.0 kB view hashes)

Uploaded CPython 3.12 Windows x86

fast_edit_distance-1.2.2-cp312-cp312-musllinux_1_2_x86_64.whl (135.5 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ x86-64

fast_edit_distance-1.2.2-cp312-cp312-musllinux_1_2_i686.whl (126.8 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ i686

fast_edit_distance-1.2.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (134.6 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

fast_edit_distance-1.2.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (124.7 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fast_edit_distance-1.2.2-cp312-cp312-macosx_11_0_arm64.whl (24.1 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

fast_edit_distance-1.2.2-cp312-cp312-macosx_10_13_x86_64.whl (24.9 kB view hashes)

Uploaded CPython 3.12 macOS 10.13+ x86-64

fast_edit_distance-1.2.2-cp311-cp311-win_amd64.whl (25.1 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

fast_edit_distance-1.2.2-cp311-cp311-win32.whl (22.8 kB view hashes)

Uploaded CPython 3.11 Windows x86

fast_edit_distance-1.2.2-cp311-cp311-musllinux_1_2_x86_64.whl (132.4 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ x86-64

fast_edit_distance-1.2.2-cp311-cp311-musllinux_1_2_i686.whl (122.6 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ i686

fast_edit_distance-1.2.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (129.0 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

fast_edit_distance-1.2.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (120.0 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fast_edit_distance-1.2.2-cp311-cp311-macosx_11_0_arm64.whl (24.0 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

fast_edit_distance-1.2.2-cp311-cp311-macosx_10_9_x86_64.whl (24.4 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

fast_edit_distance-1.2.2-cp310-cp310-win_amd64.whl (25.1 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

fast_edit_distance-1.2.2-cp310-cp310-win32.whl (22.9 kB view hashes)

Uploaded CPython 3.10 Windows x86

fast_edit_distance-1.2.2-cp310-cp310-musllinux_1_2_x86_64.whl (117.5 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

fast_edit_distance-1.2.2-cp310-cp310-musllinux_1_2_i686.whl (114.2 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ i686

fast_edit_distance-1.2.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (117.3 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

fast_edit_distance-1.2.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (109.8 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fast_edit_distance-1.2.2-cp310-cp310-macosx_11_0_arm64.whl (24.1 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

fast_edit_distance-1.2.2-cp310-cp310-macosx_10_9_x86_64.whl (24.6 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

fast_edit_distance-1.2.2-cp39-cp39-win_amd64.whl (25.1 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

fast_edit_distance-1.2.2-cp39-cp39-win32.whl (22.9 kB view hashes)

Uploaded CPython 3.9 Windows x86

fast_edit_distance-1.2.2-cp39-cp39-musllinux_1_2_x86_64.whl (117.3 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ x86-64

fast_edit_distance-1.2.2-cp39-cp39-musllinux_1_2_i686.whl (114.0 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ i686

fast_edit_distance-1.2.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (117.1 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

fast_edit_distance-1.2.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (109.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fast_edit_distance-1.2.2-cp39-cp39-macosx_11_0_arm64.whl (24.1 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

fast_edit_distance-1.2.2-cp39-cp39-macosx_10_9_x86_64.whl (24.6 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

fast_edit_distance-1.2.2-cp38-cp38-win_amd64.whl (25.1 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

fast_edit_distance-1.2.2-cp38-cp38-win32.whl (22.9 kB view hashes)

Uploaded CPython 3.8 Windows x86

fast_edit_distance-1.2.2-cp38-cp38-musllinux_1_2_x86_64.whl (117.2 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ x86-64

fast_edit_distance-1.2.2-cp38-cp38-musllinux_1_2_i686.whl (114.4 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ i686

fast_edit_distance-1.2.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (117.8 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

fast_edit_distance-1.2.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (110.3 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fast_edit_distance-1.2.2-cp38-cp38-macosx_11_0_arm64.whl (24.1 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

fast_edit_distance-1.2.2-cp38-cp38-macosx_10_9_x86_64.whl (24.6 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

fast_edit_distance-1.2.2-cp37-cp37m-win_amd64.whl (25.2 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

fast_edit_distance-1.2.2-cp37-cp37m-win32.whl (22.5 kB view hashes)

Uploaded CPython 3.7m Windows x86

fast_edit_distance-1.2.2-cp37-cp37m-musllinux_1_2_x86_64.whl (109.9 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.2+ x86-64

fast_edit_distance-1.2.2-cp37-cp37m-musllinux_1_2_i686.whl (106.3 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.2+ i686

fast_edit_distance-1.2.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (109.3 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

fast_edit_distance-1.2.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (102.0 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fast_edit_distance-1.2.2-cp37-cp37m-macosx_10_9_x86_64.whl (24.4 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page