editdistance

Fast implementation of the edit distance(Levenshtein distance)

https://github.com/roy-ht/editdistance

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 12 committers (8.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.8%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Fast implementation of the edit distance(Levenshtein distance)

Basic Info
  • Host: GitHub
  • Owner: roy-ht
  • License: mit
  • Language: C++
  • Default Branch: master
  • Size: 158 KB
Statistics
  • Stars: 689
  • Watchers: 19
  • Forks: 66
  • Open Issues: 29
  • Releases: 6
Archived
Created almost 13 years ago · Last pushed over 2 years ago
Metadata Files
Readme Funding License

README.md

editdistance

Fast implementation of the edit distance (Levenshtein distance).

This library simply implements Levenshtein distance with C++ and Cython.

The algorithm used in this library is proposed by Heikki Hyyrö, "Explaining and extending the bit-parallel approximate string matching algorithm of Myers", (2001)

Binary wheels

Thanks to pypa/cibuildwheel There are binary wheels on Linux, Mac OS, and Windows.

Install

You can install via pip:

bash pip install editdistance

Usage

It's quite simple:

```python import editdistance editdistance.eval('banana', 'bahama')

2L

```

Simple Benchmark

With IPython, I tried several libraries:

On Python 2.7.5:

```python a = 'fsffvfdsbbdfvvdavavavavavava' b = 'fvdaabavvvvvadvdvavavadfsfsdafvvav' import pylev timeit pylev.levenshtein(a, b)

100 loops, best of 3: 7.48 ms per loop

from pyxdameraulevenshtein import dameraulevenshteindistance timeit dameraulevenshteindistance(a, b)

100000 loops, best of 3: 11.4 µs per loop

timeit editdistance.eval(a, b) # my library

100000 loops, best of 3: 3.5 µs per loop

import Levenshtein

timeit Levenshtein.distance(a, b)

100000 loops, best of 3: 3.21 µs per loop

```

Distance with Any Object

Above libraries only support strings. But Sometimes other type of objects such as list of strings(words). I support any iterable, only requires hashable object of it:

```python Levenshtein.distance(['spam', 'egg'], ['spam', 'ham'])

---------------------------------------------------------------------------

TypeError Traceback (most recent call last)

in ()

----> 1 Levenshtein.distance(['spam', 'egg'], ['spam', 'ham'])

TypeError: distance expected two Strings or two Unicodes

editdistance.eval(['spam', 'egg'], ['spam', 'ham'])

1L

```

So if object's hash is same, it's same. You can provide __hash__ method to your object instances.

Enjoy!

License

It is released under the MIT license.

``` Copyright (c) 2013 Hiroyuki Tanaka

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ```

Owner

  • Name: Hiroyuki Tanaka
  • Login: roy-ht
  • Kind: user

GitHub Events

Total
  • Issues event: 2
  • Watch event: 32
  • Issue comment event: 7
  • Pull request event: 1
  • Fork event: 2
Last Year
  • Issues event: 2
  • Watch event: 32
  • Issue comment event: 7
  • Pull request event: 1
  • Fork event: 2

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 94
  • Total Committers: 12
  • Avg Commits per committer: 7.833
  • Development Distribution Score (DDS): 0.5
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Hiroyuki Tanaka a****x@g****m 47
hi6tanaka a****x@g****a 22
s-weigand s****y@g****m 10
Jacob Hayes j****s@g****m 4
Ԝеѕ 5****r 2
Joshix-1 j****v@m****g 2
Christoph Boeddeker c****j@m****e 2
zoharby z****y@g****m 1
blag b****g 1
Joe Gordon j****o@p****m 1
Amr Keleg a****d@l****m 1
vlemonidis v****s@u****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 55
  • Total pull requests: 55
  • Average time to close issues: 10 months
  • Average time to close pull requests: 3 months
  • Total issue authors: 53
  • Total pull request authors: 19
  • Average comments per issue: 1.71
  • Average comments per pull request: 1.25
  • Merged pull requests: 17
  • Bot issues: 0
  • Bot pull requests: 30
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: 5 months
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 2.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • kloczek (3)
  • joanise (2)
  • shchye95 (1)
  • davidhadas (1)
  • narolski (1)
  • ekreutz (1)
  • neonlight1203 (1)
  • pengyu (1)
  • ouening (1)
  • brady-ds (1)
  • riya-maan (1)
  • pasteman (1)
  • mburazin (1)
  • sdreher (1)
  • sunpoet (1)
Pull Request Authors
  • dependabot[bot] (33)
  • roy-ht (4)
  • Joshix-1 (2)
  • s-weigand (2)
  • VasLem (2)
  • JacobHayes (2)
  • aflc (2)
  • boeddeker (2)
  • odidev (1)
  • ofek (1)
  • wesinator (1)
  • volker48 (1)
  • okapies (1)
  • AMR-KELEG (1)
  • joanise (1)
Top Labels
Issue Labels
bug (1)
Pull Request Labels
dependencies (33)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 2,840,506 last-month
  • Total docker downloads: 140,783
  • Total dependent packages: 92
    (may contain duplicates)
  • Total dependent repositories: 2,595
    (may contain duplicates)
  • Total versions: 16
  • Total maintainers: 1
pypi.org: editdistance

Fast implementation of the edit distance (Levenshtein distance)

  • Versions: 13
  • Dependent Packages: 92
  • Dependent Repositories: 2,578
  • Downloads: 2,840,506 Last month
  • Docker Downloads: 140,783
Rankings
Dependent repos count: 0.2%
Dependent packages count: 0.2%
Downloads: 0.4%
Docker downloads count: 1.2%
Average: 1.7%
Stargazers count: 2.5%
Forks count: 5.6%
Maintainers (1)
Last synced: 11 months ago
anaconda.org: editdistance

Fast implementation of the edit distance(Levenshtein distance)

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 17
Rankings
Stargazers count: 28.6%
Dependent repos count: 33.1%
Forks count: 37.5%
Average: 37.5%
Dependent packages count: 51.0%
Last synced: 11 months ago

Dependencies

.github/workflows/CI_CD_workflow.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • docker/setup-qemu-action v1 composite
  • joerick/cibuildwheel v2.11.1 composite
  • pypa/gh-action-pypi-publish release/v1 composite