Add language formatter and spaCy types
This commit is contained in:
parent
0d0c2491e7
commit
7d6947338a
3 changed files with 29 additions and 0 deletions
9
frontend/src/lib/formatters/formatLanguage.ts
Normal file
9
frontend/src/lib/formatters/formatLanguage.ts
Normal 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();
|
||||
1
frontend/src/lib/formatters/index.ts
Normal file
1
frontend/src/lib/formatters/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { formatLanguage } from './formatLanguage';
|
||||
19
frontend/src/lib/spacy/types.ts
Normal file
19
frontend/src/lib/spacy/types.ts
Normal 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;
|
||||
}
|
||||
Loading…
Reference in a new issue