import rawDefinitions from "./json/definitions/word-definitions.json"; export type WordDefinitionEntry = { headword: string; definitions: { lang: string; text: string }[]; nativeDefinition?: string; clue?: string; }; type RawEntry = { word: string; defs: { def: string; pos?: string }[]; definitionNative?: string; clue?: string; }; type RawFile = { generatedAt: string; entries: RawEntry[]; }; const raw = rawDefinitions as RawFile; export const frenchDefinitions: WordDefinitionEntry[] = raw.entries.map((e) => ({ headword: e.word, definitions: e.defs.map((d) => ({ lang: "en", text: d.def })), nativeDefinition: e.definitionNative, clue: e.clue, })); const index = new Map( frenchDefinitions.map((e) => [e.headword, e]), ); export function getDefinition(headword: string): WordDefinitionEntry | undefined { return index.get(headword); }