Skip to content

seqtree 0.5.0 — plain edit distances

Choose a tag to compare

@mikessh mikessh released this 16 Jul 05:24
· 35 commits to master since this release

Added — seqtree.distance

Plain, unweighted Hamming and Levenshtein string distances in C++ — unit costs, no substitution matrix, no gap model, no alphabet. When all you need is how many edits apart two strings are, you no longer build a SubstitutionMatrix or add python-Levenshtein / rapidfuzz. seqtree still needs nothing at runtime.

distance.hamming(a, b) differing positions; equal length only (raises ValueError otherwise)
distance.levenshtein(a, b) insertions + deletions + substitutions, each cost 1, O(min(m,n)) memory
distance.hamming_matrix(a, b, threads=0) dense len(a) × len(b) int32, GIL released, zero-copy numpy
distance.levenshtein_matrix(a, b, threads=0) same, for mixed-length sequences

Comparison is case-sensitive, byte for byte. For a weighted alignment (a matrix, affine gaps, local mode) use seqtree.pairwise instead. Verified against pure-Python oracles over random data.

Full changelog: see CHANGELOG.md.