mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 08:21:39 -06:00
5527852b4b
Looking up a plural showed only "plural of candelabra", and looking up "candelabra" added a Latin declension line beneath it. Both come from the Wiktionary path, which English lookups fall through to whenever api.dictionaryapi.dev fails; it 502s often enough that readers hit it regularly. Read only the requested language section. Wiktionary keys a page by language and returns every language that spells the word the same way, so iterating Object.values() merged Latin into English. This was not a rare edge case: of 14 common words sampled, 13 carried foreign senses, and "fare" rendered 129 definitions of which 18 were English. Follow an inflection gloss to the word that carries the meaning, bounded to depth 2, three lemma fetches and a visited set for cycles. Only a pointer in the leading sense of its block is followed, which is what separates "candelabras" from the "simple past of bake" buried at sense 10 of "book". A lemma that fails to resolve is dropped rather than failing the lookup. Detection requires every word before "of" to be grammatical, so "Informal form of address used by juniors" stays a definition rather than sending the reader to "address". Drop script and style elements before reading textContent. Wiktionary ships an inline <style> with some senses and its CSS was rendering as part of the definition, visibly so on "fare". Merge blocks that share a part of speech and cap each at five senses, so a resolved chain stays readable and the popover stops keying a v-for on a duplicated part of speech. Pointer following is deliberately English-only. fr.wiktionary writes "pluriel de chat", and guessing at sixteen languages of grammar vocabulary is not worth it; non-English lookups still gain the language filter. The Free Dictionary path is also unchanged for "candelabras", where its own gloss "A single candelabrum." is circular but not a recognizable pointer. Closes #1020