feat: expand ingredient-alias seed list to ~137 entries, ignore accents in name matching (v0.86.0)
Ingredient-alias matching (pantry, can-cook, auto-deduct, shopping-list generation) now covers common bilingual EN/FR ingredients across all 8 grocery categories, up from ~10 staples. Also: matching now ignores accents as well as case (NFD-normalize + strip combining marks) in both the alias resolver (lib/ingredient-match.ts) and the older name-fallback matcher (pantry-shopping-match.ts) — "café"/"Café"/"cafe" and "Épinard"/"epinard" all recognize as the same ingredient without needing every accent variant manually listed as an alias. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,9 +15,10 @@ export function scoreRecipesAgainstPantry<T>(
|
||||
pantry: { rawName: string; expiresAt: Date | null }[],
|
||||
aliasIndex?: IngredientAliasIndex
|
||||
) {
|
||||
// With no alias index, this resolves to a plain lowercase compare —
|
||||
// same behavior as before aliases existed.
|
||||
const keyOf = (name: string) => (aliasIndex ? resolveIngredientKey(name, aliasIndex) : name.trim().toLowerCase());
|
||||
// With no alias index, this resolves to a plain case/accent-insensitive
|
||||
// compare — same behavior as before aliases existed, just accent-aware.
|
||||
const keyOf = (name: string) =>
|
||||
aliasIndex ? resolveIngredientKey(name, aliasIndex) : name.trim().toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g, "");
|
||||
|
||||
const pantryKeys = new Set(pantry.map((p) => keyOf(p.rawName)));
|
||||
const expiringSoonKeys = new Set(
|
||||
|
||||
Reference in New Issue
Block a user