thefuzz-parity 0.1.0

Unicode fuzzy scoring and ranked choice extraction. Not affiliated with SeatGeek or the thefuzz maintainers. Parity is a tested claim against thefuzz 0.22.1.
Documentation

thefuzz-parity

thefuzz-parity scores string similarity and ranks choices. It counts Unicode scalar values for matcher indices, lengths, and slices. The crate has no runtime dependencies. Not affiliated with SeatGeek or the thefuzz maintainers. Score parity is a tested claim against thefuzz 0.22.1.

The scoring module provides base, partial, token, and weighted scorers. Text processing replaces characters outside Unicode letter and number categories with spaces, lowercases the result, and trims its ends. Interior space runs remain.

use thefuzz_parity::{partial_ratio, token_set_ratio};

assert_eq!(partial_ratio("こんにちは世界", "こんにちは"), 100);
assert_eq!(token_set_ratio("new york", "new york mets", true, true), 100);

The process module ranks borrowed choices and returns each input string unchanged. Cutoffs are inclusive. Equal unrounded scores retain input order.

use thefuzz_parity::process::{extract, Scorer};

let choices = ["new york mets", "chicago cubs", "new york jets"];
let matches = extract("new york", choices, Scorer::WRatio, Some(2), 0);

assert_eq!(matches.len(), 2);
assert_eq!(matches[0].item, "new york mets");

Duplicate removal chooses the longest member of each similarity group. A length tie selects the lexicographically greatest string. The output contains each representative once, ordered by the first input that selects it.

Compatibility

The minimum supported Rust version is 1.70.0. Version 0.1 uses the standard library and forbids unsafe code.

License

MIT