Repository navigation
Text matchratingapproach
Home › Text › Phonetic encoding
The Match Rating Approach (Western Airlines, 1977) — a codex like the other three, plus the rule for deciding whether two codices name a match.
public static class MatchRatingApproachExample — the pair from the 1977 description itself, encoded and then compared.
using Lodestar.Text.Phonetics;
string byrne = MatchRatingApproach.Codex("Byrne"); // => BYRN
string boern = MatchRatingApproach.Codex("Boern"); // => BRN
bool? match = MatchRatingApproach.Compare("Byrne", "Boern"); // => TrueRemarks — the odd one out in this namespace on two counts. First, Compare answers a question
the other three do not: not "what does this sound like" but "do these two sound alike", and its
answer depends on both codices at once — their combined length picks a stricter or looser
threshold from a fixed table, so a caller holding two codices already still needs Compare rather
than comparing them by hand. Second, its accepted alphabet is narrower and stricter: any alphabetic
character plus a space is accepted, and anything else — a digit, an apostrophe, a hyphen — is
refused: Codex throws ArgumentException and Compare answers null, where
Soundex, Metaphone and Nysiis accept it. The
published algorithm has no rule for what a digit sounds like, and refusing says so rather than
guessing.
Reference behaviour is jellyfish.match_rating_codex and jellyfish.match_rating_comparison
1.2.1, rule for rule — codex length included, which jellyfish measures in UTF-8 bytes —
decision 0009.
Applies to — net10.0, netstandard2.0.
See also — Soundex, Metaphone, Nysiis,
the phonetics index.
| Member | What it does |
|---|---|
MatchRatingApproach.Codex |
The Match Rating codex of one name. |
MatchRatingApproach.Compare |
Whether two names' codices rate as a match. |