Skip to content

Instantly share code, notes, and snippets.

View VincentYZ's full-sized avatar

Vincent Zhao VincentYZ

  • null
  • Sydney, Australia
View GitHub Profile
@tuxedocat
tuxedocat / levd.py
Last active May 31, 2024 19:44
compute levenshtein distance
import numpy as np
from numba import jit
def levenshtein(x, y):
""" levenshtein distance for iterable sequences
"""
# check type
if (np.all(map(type, x)) is str) and (np.all(map(type, y)) is str):
_x = np.array(x, dtype=np.str)