///|
fn example_config() -> @phonetic.MatchConfig {
{
normalization: @phonetic.name_normalization_config(),
encoders: [
{ algorithm: @phonetic.Soundex, weight: 0.3 },
{ algorithm: @phonetic.DoubleMetaphone, weight: 0.3 },
],
metric: @phonetic.JaroWinkler(0.1),
string_weight: 0.4,
threshold: 0.7,
token_policy: @phonetic.WholeInput,
unmatched_token_penalty: 0.5,
}
}
///|
fn main {
match @phonetic.match_names("Smith", "Schmidt", example_config()) {
Err(_) => println("matching failed")
Ok(evidence) => {
println("left=\{evidence.left_normalized}")
println("right=\{evidence.right_normalized}")
for component in evidence.components {
println(
"component=\{component.name} raw=\{component.raw_score} weight=\{component.weight} contribution=\{component.contribution}",
)
}
println("score=\{evidence.score}")
println("threshold=\{evidence.threshold}")
println("matched=\{evidence.matched}")
}
}
}