Skip to content

Commit

Permalink
add docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
fiveham authored Nov 15, 2019
1 parent da53506 commit 9d1d432
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions levendist.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
"""A pure-python Levenshtein distance calculator."""

def levendist(s, t, matrix=False, subst_cost=1):
"""Return the Levenshtein distance between s and t.
:param s: a string
:param t: a string
:param matrix: if True, return the distance matrix for partial edits
:param subst_cost: the distance travelled by substituting one char for
another
:returns the distance or a matrix of distances (dict[int, int])"""

if not matrix:
if s == t:
return 0
Expand Down

0 comments on commit 9d1d432

Please sign in to comment.