diff --git a/frontend/src/lib/formatters/formatLanguage.ts b/frontend/src/lib/formatters/formatLanguage.ts new file mode 100644 index 0000000..c162f3e --- /dev/null +++ b/frontend/src/lib/formatters/formatLanguage.ts @@ -0,0 +1,9 @@ +const languageNames: Record = { + en: 'English', + fr: 'French', + es: 'Spanish', + it: 'Italian', + de: 'German' +}; + +export const formatLanguage = (code: string) => languageNames[code] ?? code.toUpperCase(); diff --git a/frontend/src/lib/formatters/index.ts b/frontend/src/lib/formatters/index.ts new file mode 100644 index 0000000..87f8b84 --- /dev/null +++ b/frontend/src/lib/formatters/index.ts @@ -0,0 +1 @@ +export { formatLanguage } from './formatLanguage'; diff --git a/frontend/src/lib/spacy/types.ts b/frontend/src/lib/spacy/types.ts new file mode 100644 index 0000000..0a2bad6 --- /dev/null +++ b/frontend/src/lib/spacy/types.ts @@ -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; +}