GGlyphMetrum
Product

Product features · Levenshtein edit distance

01

Measure Levenshtein distance by Unicode code point without normalizing the strings.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Levenshtein edit distance

● ● ●GlyphMetrum●
A concrete starting point · Levenshtein edit distance ×
def edit_distance(a, b):
    if not isinstance(a, str) or not isinstance(b, str):
        raise ValueError("text.required")
    previous = list(range(len(b) + 1))
    for i, left in enumerate(a, 1):
        current = [i]
        for j, right in enumerate(b, 1):
            current.append(min(current[-1] + 1, previous[j] + 1,
                               previous[j - 1] + (left != right)))
        previous = current
    return previous[-1]
✳Measure Levenshtein distance by Unicode code point without normalizing the strings.
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗