How to use the editdistance.byctypes.PatternMap function in editdistance

To help you get started, we’ve selected a few editdistance examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aflc / editdistance / editdistance / byctypes.py View on Github external
def __init__(self, s):
        if len(s) > 255:
            raise ValueError('size of your sequence length must be < 256')
        self._m = {}
        for e in s:
            self._m.setdefault(e, len(self._m))
        sl = [self._m[x] for x in s]
        sarr = ctypes.c_int64 * len(sl)
        sp = sarr(*sl)
        self._pm = PatternMap()
        dll.create_patternmap(ctypes.byref(self._pm), ctypes.byref(sp), len(sl))

editdistance

Fast implementation of the edit distance (Levenshtein distance)

MIT
Latest version published 10 months ago

Package Health Score

75 / 100
Full package analysis

Similar packages