ObservationCard previously bridged SVG zones to the JSON findings
catalog with a strict FR-name equality check. That broke as soon as the
JSON used "(ATM)" while the SVG carried "Articulation Temporo-
Mandibulaire (ATM)" or whenever either side picked up a minor casse /
accent / typo drift.
The new matcher (src/lib/zoneMatch.ts) normalizes both sides
aggressively (lowercase + NFD-strip accents + drop non-alphanumerics)
and scores each pairing across all four (bone-lang, zone-lang)
combinations:
0 exact normalized match
1 one normalized string is contained in the other
2+d Levenshtein distance d, capped at max(2, ceil(maxLen * 0.25))
∞ beyond tolerance — discarded
Preference order: English exact/substring first (no accents → fewer
normalization edge cases), then French exact/substring, then fuzzy
across both languages.
Real-world payoff for the current equine catalog:
bone EN "Sphenoid" → sphenoid (score 0)
bone EN "Spheno-Basilar Synchondrosis (SBS)" → ssb (score 0)
bone EN "Temporomandibular Joint (TMJ)" → atm (score 0)
bone FR "(ATM)" alone → atm (score 1)
bone EN "sphenoi" / "shenoide" (typo) → sphenoid (fuzzy)
bone EN "Hyoid", "Hip joint", "Stifle", ... → undefined (correct)
23 new unit tests cover normalization, Levenshtein, scorePair branches,
the full matchZoneFindings strategy ladder, and the absence of false
positives (Sphenoid ↛ SSB, Hyoid/Hanche/etc ↛ anything).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>