JaroWinkler is a high-performance Python library for approximate string matching, implementing Jaro and Jaro-Winkler similarity algorithms. Currently at version 2.0.1, it leverages the `rapidfuzz` library for its core implementations, offering significant speed advantages over alternatives. The project maintains an active development cycle, with a focus on optimization and ease of integration.
pip install jarowinklerVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to calculate Jaro and Jaro-Winkler similarity scores between strings, including the use of an optional `score_cutoff` and its application to sequences of hashable objects.
Upgrade to Python 3.8 or newer, or use `pip install 'jarowinkler<2.0.0'`.
Ensure `rapidfuzz` is installed alongside `jarowinkler`. Review performance benchmarks if migrating from older versions.
Be aware of the prefix bias in Jaro-Winkler. For applications where prefix matching is less critical, consider using Jaro similarity or other string metrics. The `prefix_weight` parameter can be adjusted in `jarowinkler_similarity` (default 0.1) if using `rapidfuzz.distance.JaroWinkler.similarity` directly.
When using `jarowinkler` with sequences, ensure that elements within the sequences are consistently hashable and comparable. If comparing custom objects, verify their `__hash__` and `__eq__` implementations.
Run `pip install jarowinkler` to install the library.
The correct function in this library is `jarowinkler_similarity`. Update your code to `from jarowinkler import jarowinkler_similarity` and use `jarowinkler_similarity(str1, str2)`.
Ensure both arguments passed to `jaro_similarity` or `jarowinkler_similarity` are strings or iterable sequences of hashable objects (e.g., lists of strings/numbers). For example, `jarowinkler_similarity('test', 123)` will fail, it should be `jarowinkler_similarity('test', '123')` or `jarowinkler_similarity('test', ['1','2','3'])`.Ensure `prefix_weight` is set to a float between 0.0 and 0.25, inclusive. For example: `jarowinkler_similarity('foo', 'bar', prefix_weight=0.15)`.