Open the context
Choose the project folder and name the files or behavior involved.
Measure Levenshtein distance by Unicode code point without normalizing the strings. Check empty input, one emoji substitution and composed versus decomposed text, counting the original sequences rather than claiming visual-character equivalence.
Choose the project folder and name the files or behavior involved.
Describe the input, expected output and boundaries that must stay intact.
Review the proposed edits and any commands before relying on their result.
Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
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]The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.