44 lines
1 KiB
TypeScript
44 lines
1 KiB
TypeScript
import { LLM_CONFIG } from "../config/llm.js";
|
|
|
|
export type Language = "en" | "de" | "it" | "es" | "fr";
|
|
export type Pos = "noun" | "verb" | "adjective" | "adverb";
|
|
export type Gender = "masculine" | "feminine" | "neuter" | null;
|
|
export type Difficulty = "easy" | "medium" | "hard";
|
|
|
|
export interface Translation {
|
|
word: string;
|
|
gender: Gender;
|
|
}
|
|
|
|
export interface EnrichedSense {
|
|
id: string;
|
|
word: string;
|
|
language: Language;
|
|
pos: Pos;
|
|
sense: string;
|
|
example: string;
|
|
difficulty_level: Difficulty;
|
|
translations: {
|
|
de: Translation[];
|
|
it: Translation[];
|
|
es: Translation[];
|
|
fr: Translation[];
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Merges skeleton data with enriched LLM senses into the final pipeline output.
|
|
*/
|
|
export function mergeEnrichedData(
|
|
word: string,
|
|
senses: EnrichedSense[],
|
|
): Record<string, unknown> {
|
|
return {
|
|
word,
|
|
language: senses[0]?.language ?? "en",
|
|
pos: senses[0]?.pos ?? "noun",
|
|
senses,
|
|
enrichedAt: new Date().toISOString(),
|
|
model: LLM_CONFIG.model ?? "unknown",
|
|
};
|
|
}
|