Repository navigation
v0.4.2
Summary
v0.4.2 is a patch release that restores three public API behaviors lost in the
0.4.0 Rust rewrite and fixes two SIFT4 tokenizer bugs. There are no breaking
changes and no code changes are required when upgrading from 0.4.x.
Compatibility restored
- Pickling and multiprocessing — every calculator (
Levenshtein,NGram,
QGram,Cosine,JaroWinkler,WeightedLevenshtein, ...) can be pickled
again. Constructor options are preserved (JaroWinklerthreshold,NGram.n,
the shinglekand weighted-Levenshtein cost functions), so
multiprocessing.Pool.starmap(Levenshtein().distance, ...)works as it did
before the rewrite
(#44). JaroWinkler.matches(s0, s1)— the public static method is available
again and returns[matches, transpositions, prefix_length, longer_input_length], for example[6, 1, 3, 6]for
("martha", "marhta"). It also works through an instance
(#45).- Mapping-based profiles —
Cosine.similarity_profiles()and
QGram.distance_profile()accept any PythonMappingagain, including
read-onlyMappingProxyTypeviews andUserDictwrappers, not onlydict
(#46).
Bug fixes
- SIFT4 n-gram tokenizer —
SIFT4Options.ngramtokenizer()now emits all
len(s) - n + 1windows instead of dropping the last two, so differences
confined to the end of a string are no longer invisible. For example,
ngramtokenizer("abcd", 2)returns["ab", "bc", "cd"](previously
["ab"])
(#42). tokenizer="ngram"preset — the named preset no longer raises
TypeError: missing required positional argument 'n'. Character n-grams
default ton=2; use
functools.partial(SIFT4Options.ngramtokenizer, n=...)for another size
(#43).
Installation
pip install -U strsimpyPrebuilt abi3 wheels are available for Python 3.10+ on Linux (x86_64 and
aarch64, manylinux and musllinux), macOS (x86_64 and arm64) and Windows x64.
Full Changelog:
v0.4.1...v0.4.2