Add language formatter and spaCy types

This commit is contained in:
wilson 2026-03-31 07:22:43 +01:00
parent 0d0c2491e7
commit 7d6947338a
3 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,9 @@
const languageNames: Record<string, string> = {
en: 'English',
fr: 'French',
es: 'Spanish',
it: 'Italian',
de: 'German'
};
export const formatLanguage = (code: string) => languageNames[code] ?? code.toUpperCase();

View file

@ -0,0 +1 @@
export { formatLanguage } from './formatLanguage';

View file

@ -0,0 +1,19 @@
export interface PartsOfSpeechData {
language: string;
sentences: {
text: string;
tokens: PartOfSpeechToken[];
}[];
}
export interface PartOfSpeechToken {
dep: string;
pos: string;
tag: string;
text: string;
type: null | string;
lemma: string;
is_stop: boolean;
is_alpha: boolean;
is_punct: boolean;
}