@fpw/en-wiktionary-la-modules 0.0.10 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/LaEngine.js +6 -6
  2. package/dist/LaEngine.js.map +1 -1
  3. package/dist/index.js +5 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/modules/conjugation/LaVerb.d.ts +1 -1
  6. package/dist/modules/conjugation/LaVerb.js +379 -375
  7. package/dist/modules/conjugation/LaVerb.js.map +1 -1
  8. package/dist/modules/conjugation/VerbForm.js +2 -2
  9. package/dist/modules/conjugation/VerbForm.js.map +1 -1
  10. package/dist/modules/conjugation/VerbType.d.ts +1 -0
  11. package/dist/modules/conjugation/VerbType.js +3 -2
  12. package/dist/modules/conjugation/VerbType.js.map +1 -1
  13. package/dist/modules/declination/LaAdjData.d.ts +1 -1
  14. package/dist/modules/declination/LaAdjData.js +505 -428
  15. package/dist/modules/declination/LaAdjData.js.map +1 -1
  16. package/dist/modules/declination/LaNominal.d.ts +10 -0
  17. package/dist/modules/declination/LaNominal.js +79 -73
  18. package/dist/modules/declination/LaNominal.js.map +1 -1
  19. package/dist/modules/declination/LaNounData.js +467 -417
  20. package/dist/modules/declination/LaNounData.js.map +1 -1
  21. package/dist/modules/declination/NominalForm.js +2 -2
  22. package/dist/modules/declination/NominalForm.js.map +1 -1
  23. package/dist/modules/headword/HeadwordParser.js +17 -17
  24. package/dist/modules/headword/HeadwordParser.js.map +1 -1
  25. package/package.json +9 -8
  26. package/src/LaEngine.ts +82 -0
  27. package/src/index.ts +16 -0
  28. package/src/modules/common.ts +164 -0
  29. package/src/modules/conjugation/LaVerb.ts +2490 -0
  30. package/src/modules/conjugation/VerbAffix.ts +18 -0
  31. package/src/modules/conjugation/VerbForm.ts +223 -0
  32. package/src/modules/conjugation/VerbType.ts +51 -0
  33. package/src/modules/declination/LaAdjData.ts +913 -0
  34. package/src/modules/declination/LaNominal.ts +1992 -0
  35. package/src/modules/declination/LaNounData.ts +896 -0
  36. package/src/modules/declination/LaPersonalPronoun.ts +77 -0
  37. package/src/modules/declination/NominalForm.ts +89 -0
  38. package/src/modules/headword/HeadWord.ts +132 -0
  39. package/src/modules/headword/HeadwordParser.ts +514 -0
  40. package/dist/modules/LaEngine.d.ts +0 -15
  41. package/dist/modules/LaEngine.js +0 -46
  42. package/dist/modules/LaEngine.js.map +0 -1
  43. package/dist/modules/LaWiktionary.d.ts +0 -18
  44. package/dist/modules/LaWiktionary.js +0 -171
  45. package/dist/modules/LaWiktionary.js.map +0 -1
@@ -0,0 +1,77 @@
1
+ import { FormMap } from "../common";
2
+
3
+ export enum PPronForm {
4
+ NomSg1 = "nom_1s",
5
+ GenSg1 = "gen_1s",
6
+ DatSg1 = "dat_1s",
7
+ AccSg1 = "acc_1s",
8
+ AblSg1 = "abl_1s",
9
+
10
+ NomPl1 = "nom_1p",
11
+ GenPl1 = "gen_1p",
12
+ DatPl1 = "dat_1p",
13
+ AccPl1 = "acc_1p",
14
+ AblPl1 = "abl_1p",
15
+
16
+ NomSg2 = "nom_2s",
17
+ GenSg2 = "gen_2s",
18
+ DatSg2 = "dat_2s",
19
+ AccSg2 = "acc_2s",
20
+ AblSg2 = "abl_2s",
21
+
22
+ NomPl2 = "nom_2p",
23
+ GenPl2 = "gen_2p",
24
+ DatPl2 = "dat_2p",
25
+ AccPl2 = "acc_2p",
26
+ AblPl2 = "abl_2p",
27
+
28
+ GenRef = "gen_ref",
29
+ DatRef = "dat_ref",
30
+ AccRef = "acc_ref",
31
+ AblRef = "abl_ref",
32
+ }
33
+
34
+ export interface PersonalPronounData {
35
+ templateType: "ppron";
36
+ forms: FormMap<PPronForm>;
37
+ }
38
+
39
+ export class LaPersonalPronoun {
40
+ public make_data(): PersonalPronounData {
41
+ const forms = new Map<PPronForm, string[]>([
42
+ [PPronForm.NomSg1, ["ego"]],
43
+ [PPronForm.AccSg1, ["mē"]],
44
+ [PPronForm.GenSg1, ["meī"]],
45
+ [PPronForm.DatSg1, ["mihi"]],
46
+ [PPronForm.AblSg1, ["mē"]],
47
+
48
+ [PPronForm.NomPl1, ["nōs"]],
49
+ [PPronForm.AccPl1, ["nōs"]],
50
+ [PPronForm.GenPl1, ["nostrum", "nostrī"]],
51
+ [PPronForm.DatPl1, ["nōbīs"]],
52
+ [PPronForm.AblPl1, ["nōbīs"]],
53
+
54
+ [PPronForm.NomSg2, ["tū"]],
55
+ [PPronForm.AccSg2, ["tē"]],
56
+ [PPronForm.GenSg2, ["tuī"]],
57
+ [PPronForm.DatSg2, ["tibi", "tibī"]],
58
+ [PPronForm.AblSg2, ["tē"]],
59
+
60
+ [PPronForm.NomPl2, ["vōs"]],
61
+ [PPronForm.AccPl2, ["vōs"]],
62
+ [PPronForm.GenPl2, ["vestrum", "vestrī"]],
63
+ [PPronForm.DatPl2, ["vōbīs"]],
64
+ [PPronForm.AblPl2, ["vōbīs"]],
65
+
66
+ [PPronForm.AccRef, ["sē", "sēsē"]],
67
+ [PPronForm.GenRef, ["suī"]],
68
+ [PPronForm.DatRef, ["sibi"]],
69
+ [PPronForm.AblRef, ["sē", "sēsē"]],
70
+ ]);
71
+
72
+ return {
73
+ templateType: "ppron",
74
+ forms: forms
75
+ };
76
+ }
77
+ }
@@ -0,0 +1,89 @@
1
+ import { FormMap, is_enum_value } from "../common";
2
+
3
+ export enum NominalForm {
4
+ NomSg = "nom_sg",
5
+ LinkedNomSg = "linked_nom_sg",
6
+ NomPl = "nom_pl",
7
+ LinkedNomPl = "linked_nom_pl",
8
+ AccSg = "acc_sg",
9
+ AccPl = "acc_pl",
10
+ GenSg = "gen_sg",
11
+ GenPl = "gen_pl",
12
+ LocSg = "loc_sg",
13
+ LocPl = "loc_pl",
14
+ DatSg = "dat_sg",
15
+ DatPl = "dat_pl",
16
+ AblSg = "abl_sg",
17
+ AblPl = "abl_pl",
18
+ VocSg = "voc_sg",
19
+ VocPl = "voc_pl",
20
+
21
+ NomSgM = "nom_sg_m",
22
+ LinkedNomSgM = "linked_nom_sg_m",
23
+ NomPlM = "nom_pl_m",
24
+ LinkedNomPlM = "linked_nom_pl_m",
25
+ AccSgM = "acc_sg_m",
26
+ AccPlM = "acc_pl_m",
27
+ GenSgM = "gen_sg_m",
28
+ GenPlM = "gen_pl_m",
29
+ LocSgM = "loc_sg_m",
30
+ LocPlM = "loc_pl_m",
31
+ DatSgM = "dat_sg_m",
32
+ DatPlM = "dat_pl_m",
33
+ AblSgM = "abl_sg_m",
34
+ AblPlM = "abl_pl_m",
35
+ VocSgM = "voc_sg_m",
36
+ VocPlM = "voc_pl_m",
37
+
38
+ NomSgF = "nom_sg_f",
39
+ LinkedNomSgF = "linked_nom_sg_f",
40
+ NomPlF = "nom_pl_f",
41
+ LinkedNomPlF = "linked_nom_pl_f",
42
+ AccSgF = "acc_sg_f",
43
+ AccPlF = "acc_pl_f",
44
+ GenSgF = "gen_sg_f",
45
+ GenPlF = "gen_pl_f",
46
+ LocSgF = "loc_sg_f",
47
+ LocPlF = "loc_pl_f",
48
+ DatSgF = "dat_sg_f",
49
+ DatPlF = "dat_pl_f",
50
+ AblSgF = "abl_sg_f",
51
+ AblPlF = "abl_pl_f",
52
+ VocSgF = "voc_sg_f",
53
+ VocPlF = "voc_pl_f",
54
+
55
+ NomSgN = "nom_sg_n",
56
+ LinkedNomSgN = "linked_nom_sg_n",
57
+ NomPlN = "nom_pl_n",
58
+ LinkedNomPlN = "linked_nom_pl_n",
59
+ AccSgN = "acc_sg_n",
60
+ AccPlN = "acc_pl_n",
61
+ GenSgN = "gen_sg_n",
62
+ GenPlN = "gen_pl_n",
63
+ LocSgN = "loc_sg_n",
64
+ LocPlN = "loc_pl_n",
65
+ DatSgN = "dat_sg_n",
66
+ DatPlN = "dat_pl_n",
67
+ AblSgN = "abl_sg_n",
68
+ AblPlN = "abl_pl_n",
69
+ VocSgN = "voc_sg_n",
70
+ VocPlN = "voc_pl_n",
71
+ }
72
+
73
+ export function setNominalForm(forms: FormMap<NominalForm>, form: string, values: string[] | undefined) {
74
+ if (!is_enum_value(NominalForm, form)) {
75
+ throw Error(`Invalid nominal form ${form}: ${values}`);
76
+ }
77
+ if (values) {
78
+ forms.set(form, values);
79
+ } else {
80
+ forms.delete(form);
81
+ }
82
+ }
83
+
84
+ export function getNominalForm(forms: FormMap<NominalForm>, form: string): string[] | undefined {
85
+ if (!is_enum_value(NominalForm, form)) {
86
+ throw Error(`Invalid nominal form ${form}`);
87
+ }
88
+ return forms.get(form);
89
+ }
@@ -0,0 +1,132 @@
1
+ import { Conjugation } from "../conjugation/LaVerb";
2
+ import { AdjectiveData, NounData } from "../declination/LaNominal";
3
+
4
+ export type Headword =
5
+ NominalHead | AdjectivalHead | PrepositionHead |
6
+ ComparativeHead | SuperlativeHead |
7
+ VerbalHead | ParticleHead | GerundHead |
8
+ AdverbHead | NumeralAdverbHead |
9
+ LetterHead | InterjectionHead | PhraseHead | FormHead;
10
+
11
+ export interface BaseHead {
12
+ templateType: "headword";
13
+ heads: string[];
14
+ }
15
+
16
+ export interface FormHead extends BaseHead {
17
+ headType: "form";
18
+ partOfSpeech: string; // as below
19
+ }
20
+
21
+ export enum NominalType {
22
+ Noun = "nouns",
23
+ Numeral = "numerals",
24
+ Suffix = "suffixes",
25
+ ProperNoun = "proper nouns",
26
+ }
27
+
28
+ export interface NominalHead extends BaseHead {
29
+ headType: "nominal";
30
+ partOfSpeech: NominalType;
31
+ indeclinable: boolean;
32
+ data: NounData;
33
+ genders: string[];
34
+ }
35
+
36
+ export enum AdjectivalType {
37
+ Adjective = "adjectives",
38
+ Numeral = "numerals",
39
+ Suffix = "suffixes",
40
+ Pronoun = "pronouns",
41
+ Determiner = "determiners",
42
+ Participle = "participles",
43
+ }
44
+
45
+ export interface AdjectivalHead extends BaseHead {
46
+ headType: "adjectival";
47
+ partOfSpeech: AdjectivalType;
48
+ indeclinable: boolean;
49
+ data: AdjectiveData;
50
+ comparatives: string[];
51
+ superlatives: string[];
52
+ adverbs: string[];
53
+ }
54
+
55
+ export enum VerbalType {
56
+ Verb = "verbs",
57
+ Suffix = "suffixes",
58
+ }
59
+
60
+ export interface VerbalHead extends BaseHead {
61
+ headType: "verbal";
62
+ partOfSpeech: VerbalType;
63
+ data: Conjugation;
64
+ infinitives: string[];
65
+ }
66
+
67
+ export interface GerundHead extends BaseHead {
68
+ headType: "gerund";
69
+ gerundive?: string;
70
+ }
71
+
72
+ export interface ComparativeHead extends BaseHead {
73
+ headType: "comparative";
74
+ neuter: string[];
75
+ positive: string[];
76
+ isLemma: boolean;
77
+ }
78
+
79
+ export interface SuperlativeHead extends BaseHead {
80
+ headType: "superlative";
81
+ neuter: string[];
82
+ feminine: string[];
83
+ positive: string[];
84
+ isLemma: boolean;
85
+ }
86
+
87
+ export enum AdverbType {
88
+ Adverb = "adverbs",
89
+ Suffix = "suffixes",
90
+ Comparative = "comparatives",
91
+ Superlative = "superlatives",
92
+ }
93
+
94
+ export interface AdverbHead extends BaseHead {
95
+ headType: "adverb";
96
+ partOfSpeech: AdverbType;
97
+ comparatives: string[];
98
+ superlatives: string[];
99
+ }
100
+
101
+ export interface NumeralAdverbHead extends BaseHead {
102
+ headType: "numeral_adverb";
103
+ numType: string;
104
+ }
105
+
106
+ export interface LetterHead extends BaseHead {
107
+ headType: "letter";
108
+ upper: string[];
109
+ lower: string[];
110
+ mixed: string[];
111
+ scriptCode: string;
112
+ }
113
+
114
+ export interface PrepositionHead extends BaseHead {
115
+ headType: "preposition";
116
+ genitive: boolean;
117
+ accusative: boolean;
118
+ ablative: boolean;
119
+ }
120
+
121
+ export interface PhraseHead extends BaseHead {
122
+ headType: "phrase";
123
+ }
124
+
125
+ export interface InterjectionHead extends BaseHead {
126
+ headType: "interjection";
127
+ }
128
+
129
+ export interface ParticleHead extends BaseHead {
130
+ headType: "particle";
131
+ partOfSpeech: string; // unfortunately, this is not standardized
132
+ }