@fpw/en-wiktionary-la-modules 0.0.16 → 0.1.3
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.
- package/dist/LaEngine.d.ts +7 -8
- package/dist/LaEngine.js +1 -1
- package/dist/LaEngine.js.map +1 -1
- package/dist/modules/conjugation/LaVerb.d.ts +5 -3
- package/dist/modules/conjugation/LaVerb.js +207 -31
- package/dist/modules/conjugation/LaVerb.js.map +1 -1
- package/dist/modules/conjugation/VerbType.d.ts +5 -1
- package/dist/modules/conjugation/VerbType.js +4 -0
- package/dist/modules/conjugation/VerbType.js.map +1 -1
- package/dist/modules/declination/LaAdjData.d.ts +1 -1
- package/dist/modules/declination/LaAdjData.js +45 -24
- package/dist/modules/declination/LaAdjData.js.map +1 -1
- package/dist/modules/declination/LaNominal.d.ts +6 -3
- package/dist/modules/declination/LaNominal.js +190 -168
- package/dist/modules/declination/LaNominal.js.map +1 -1
- package/dist/modules/declination/LaNounData.js +65 -64
- package/dist/modules/declination/LaNounData.js.map +1 -1
- package/dist/modules/declination/LaPersonalPronoun.d.ts +7 -29
- package/dist/modules/declination/LaPersonalPronoun.js +73 -56
- package/dist/modules/declination/LaPersonalPronoun.js.map +1 -1
- package/dist/modules/declination/NominalType.d.ts +116 -0
- package/dist/modules/declination/NominalType.js +142 -0
- package/dist/modules/declination/NominalType.js.map +1 -0
- package/dist/modules/headword/HeadWord.d.ts +3 -3
- package/dist/modules/headword/HeadwordParser.d.ts +2 -2
- package/dist/modules/headword/HeadwordParser.js.map +1 -1
- package/package.json +8 -9
- package/src/LaEngine.ts +8 -9
- package/src/modules/conjugation/LaVerb.ts +213 -36
- package/src/modules/conjugation/VerbType.ts +4 -0
- package/src/modules/declination/LaAdjData.ts +47 -24
- package/src/modules/declination/LaNominal.ts +216 -184
- package/src/modules/declination/LaNounData.ts +67 -66
- package/src/modules/declination/LaPersonalPronoun.ts +76 -63
- package/src/modules/declination/NominalType.ts +153 -0
- package/src/modules/headword/HeadWord.ts +3 -3
- package/src/modules/headword/HeadwordParser.ts +18 -18
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { is_enum_value } from "../common";
|
|
2
|
+
|
|
3
|
+
export enum NominalType {
|
|
4
|
+
Singular = "sg",
|
|
5
|
+
NoSingular = "-sg",
|
|
6
|
+
Plural = "pl",
|
|
7
|
+
NoPlural = "-pl",
|
|
8
|
+
Both = "both",
|
|
9
|
+
NotBoth = "not_both",
|
|
10
|
+
|
|
11
|
+
Masculine = "M",
|
|
12
|
+
Feminine = "F",
|
|
13
|
+
Neuter = "N",
|
|
14
|
+
neuter = "n",
|
|
15
|
+
NoMasculine = "-M",
|
|
16
|
+
NotMasculine = "not_M",
|
|
17
|
+
NoFeminine = "-F",
|
|
18
|
+
NoNeuter = "-N",
|
|
19
|
+
NotNeuter = "not_N",
|
|
20
|
+
NotNoNeuter = "not_-N",
|
|
21
|
+
|
|
22
|
+
GenPluM = "genplum",
|
|
23
|
+
NotGenPluM = "not_genplum",
|
|
24
|
+
|
|
25
|
+
AccIm = "acc_im",
|
|
26
|
+
NotAccIm = "not_acc_im",
|
|
27
|
+
AccImEm = "acc_im_em",
|
|
28
|
+
NotAccImEm = "not_acc_im_em",
|
|
29
|
+
AccEmIm = "acc_em_im",
|
|
30
|
+
NotAccEmIm = "not_acc_em_im",
|
|
31
|
+
AccImIn = "acc_im_in",
|
|
32
|
+
AccImInEm = "acc_im_in_em",
|
|
33
|
+
NotAccImInEm = "not_acc_im_in_em",
|
|
34
|
+
NotAccImIn = "not_acc_im_in",
|
|
35
|
+
AccImOccEm = "acc_im_occ_em",
|
|
36
|
+
NotAccImOccEm = "not_acc_im_occ_em",
|
|
37
|
+
AblEI = "abl_e_i",
|
|
38
|
+
NotAblEI = "not_abl_e_i",
|
|
39
|
+
AblI = "abl_i",
|
|
40
|
+
NotAblI = "not_abl_i",
|
|
41
|
+
AblIE = "abl_i_e",
|
|
42
|
+
NotAblIE = "not_abl_i_e",
|
|
43
|
+
AblEOccI = "abl_e_occ_i",
|
|
44
|
+
NotAblEOccI = "not_abl_e_occ_i",
|
|
45
|
+
|
|
46
|
+
VocI = "voci",
|
|
47
|
+
NoVocI = "-voci",
|
|
48
|
+
|
|
49
|
+
Abus = "abus",
|
|
50
|
+
NotAbus = "not_abus",
|
|
51
|
+
Ubus = "ubus",
|
|
52
|
+
NotUbus = "not_ubus",
|
|
53
|
+
|
|
54
|
+
Ium = "ium",
|
|
55
|
+
NoIum = "-ium",
|
|
56
|
+
Ius = "ius",
|
|
57
|
+
NoIus = "-ius",
|
|
58
|
+
NotIus = "not_ius",
|
|
59
|
+
Us = "us",
|
|
60
|
+
NoUs = "-us",
|
|
61
|
+
NotUs = "not_us",
|
|
62
|
+
Am = "am",
|
|
63
|
+
NoAm = "-am",
|
|
64
|
+
NotAm = "not_am",
|
|
65
|
+
|
|
66
|
+
Vos = "vos",
|
|
67
|
+
NoVos = "-vos",
|
|
68
|
+
Vom = "vom",
|
|
69
|
+
NoVom = "-vom",
|
|
70
|
+
|
|
71
|
+
Er = "er",
|
|
72
|
+
NoEr = "-er",
|
|
73
|
+
NotNoErr = "not_-er",
|
|
74
|
+
|
|
75
|
+
a = "a",
|
|
76
|
+
i = "i",
|
|
77
|
+
I = "I",
|
|
78
|
+
Noi = "-i",
|
|
79
|
+
NoI = "-I",
|
|
80
|
+
NotI = "not_I",
|
|
81
|
+
Pure = "pure",
|
|
82
|
+
NoPure = "-pure",
|
|
83
|
+
NotPure = "not_pure",
|
|
84
|
+
Par = "par",
|
|
85
|
+
NoPar = "-par",
|
|
86
|
+
NotPar = "not_par",
|
|
87
|
+
Ic = "ic",
|
|
88
|
+
NoIc = "-ic",
|
|
89
|
+
|
|
90
|
+
greek = "greek",
|
|
91
|
+
Nogreek = "-greek",
|
|
92
|
+
Notgreek = "not_greek",
|
|
93
|
+
Greek = "Greek",
|
|
94
|
+
NoGreek = "-Greek",
|
|
95
|
+
NotGreek = "not_Greek",
|
|
96
|
+
GreekA = "greekA",
|
|
97
|
+
NoGreekA = "-greekA",
|
|
98
|
+
GreekE = "greekE",
|
|
99
|
+
NoGreekE = "-greekE",
|
|
100
|
+
Echo = "echo",
|
|
101
|
+
argo = "argo",
|
|
102
|
+
Callisto = "Callisto",
|
|
103
|
+
Polis = "polis",
|
|
104
|
+
NotPolis = "not_polis",
|
|
105
|
+
NoPolis = "-polis",
|
|
106
|
+
On = "on",
|
|
107
|
+
NoOn = "-on",
|
|
108
|
+
NotOn = "not_on",
|
|
109
|
+
Me = "Me",
|
|
110
|
+
NoMe = "-Me",
|
|
111
|
+
Ma = "Ma",
|
|
112
|
+
NoMa = "-Ma",
|
|
113
|
+
|
|
114
|
+
Locative = "loc",
|
|
115
|
+
NoLocative = "-loc",
|
|
116
|
+
Ligature = "lig",
|
|
117
|
+
NoCategories = "nocat",
|
|
118
|
+
|
|
119
|
+
SuffixN = "sufn",
|
|
120
|
+
NotSuffixN = "not_sufn",
|
|
121
|
+
|
|
122
|
+
poetic_esi = "poetic_esi",
|
|
123
|
+
|
|
124
|
+
// added by fpw to explicitly choose -e / -i in -ens adecl
|
|
125
|
+
Participle = "ptc",
|
|
126
|
+
|
|
127
|
+
// probably errors
|
|
128
|
+
Gr = "Gr",
|
|
129
|
+
gr = "gr",
|
|
130
|
+
navis = "navis",
|
|
131
|
+
Second = "2nd",
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function addNominalType(types: Set<NominalType>, nomType: string) {
|
|
135
|
+
if (!is_enum_value(NominalType, nomType)) {
|
|
136
|
+
throw Error(`Invalid nominal type '${nomType}'`);
|
|
137
|
+
}
|
|
138
|
+
types.add(nomType);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function hasNominalType(types: Set<NominalType>, nomType: string): boolean {
|
|
142
|
+
if (!is_enum_value(NominalType, nomType)) {
|
|
143
|
+
throw Error(`Invalid nominal type '${nomType}'`);
|
|
144
|
+
}
|
|
145
|
+
return types.has(nomType);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function delNominalType(types: Set<NominalType>, nomType: string): void {
|
|
149
|
+
if (!is_enum_value(NominalType, nomType)) {
|
|
150
|
+
throw Error(`Invalid nominal type '${nomType}'`);
|
|
151
|
+
}
|
|
152
|
+
types.delete(nomType);
|
|
153
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VerbData } from "../conjugation/LaVerb";
|
|
2
2
|
import { AdjectiveData, NounData } from "../declination/LaNominal";
|
|
3
3
|
|
|
4
|
-
export type
|
|
4
|
+
export type HeadwordData =
|
|
5
5
|
NominalHead | AdjectivalHead | PrepositionHead |
|
|
6
6
|
ComparativeHead | SuperlativeHead |
|
|
7
7
|
VerbalHead | ParticleHead | GerundHead |
|
|
@@ -60,7 +60,7 @@ export enum VerbalType {
|
|
|
60
60
|
export interface VerbalHead extends BaseHead {
|
|
61
61
|
headType: "verbal";
|
|
62
62
|
partOfSpeech: VerbalType;
|
|
63
|
-
data:
|
|
63
|
+
data: VerbData;
|
|
64
64
|
infinitives: string[];
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -16,11 +16,11 @@ import { LaVerb } from "../conjugation/LaVerb";
|
|
|
16
16
|
import { getVerbForm } from "../conjugation/VerbForm";
|
|
17
17
|
import { LaNominal } from "../declination/LaNominal";
|
|
18
18
|
import { getNominalForm } from "../declination/NominalForm";
|
|
19
|
-
import { AdjectivalType, AdverbType,
|
|
19
|
+
import { AdjectivalType, AdverbType, HeadwordData, NominalType, VerbalType } from "./HeadWord";
|
|
20
20
|
|
|
21
21
|
export type Args = Map<string, string>;
|
|
22
22
|
|
|
23
|
-
type Parser = (args: Args, lemma: string) =>
|
|
23
|
+
type Parser = (args: Args, lemma: string) => HeadwordData;
|
|
24
24
|
|
|
25
25
|
export class HeadwordParser {
|
|
26
26
|
private templateParsers: Map<string, Parser> = new Map([
|
|
@@ -89,7 +89,7 @@ export class HeadwordParser {
|
|
|
89
89
|
return this.templateParsers.has(templateName);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
public parse(template: string, lemma: string):
|
|
92
|
+
public parse(template: string, lemma: string): HeadwordData {
|
|
93
93
|
const args = parse_template(template);
|
|
94
94
|
const templateName = args.get("0") || "nil";
|
|
95
95
|
const parseFunc = this.templateParsers.get(templateName);
|
|
@@ -111,7 +111,7 @@ export class HeadwordParser {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
private parseNominalHead(args: Args, pos: NominalType):
|
|
114
|
+
private parseNominalHead(args: Args, pos: NominalType): HeadwordData {
|
|
115
115
|
const overridePos = args.get("pos") || pos;
|
|
116
116
|
const decl = this.nominal.do_generate_noun_forms(args, overridePos, true);
|
|
117
117
|
const isNum = (pos == "numerals");
|
|
@@ -142,7 +142,7 @@ export class HeadwordParser {
|
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
private parseAdjectivalHead(args: Args, pos: AdjectivalType):
|
|
145
|
+
private parseAdjectivalHead(args: Args, pos: AdjectivalType): HeadwordData {
|
|
146
146
|
const overridePos = args.get("pos") || pos;
|
|
147
147
|
const decl = this.nominal.do_generate_adj_forms(args, overridePos, true);
|
|
148
148
|
|
|
@@ -165,7 +165,7 @@ export class HeadwordParser {
|
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
private parseVerbalHead(args: Args, pos: VerbalType):
|
|
168
|
+
private parseVerbalHead(args: Args, pos: VerbalType): HeadwordData {
|
|
169
169
|
const conj = this.conj.make_data(args);
|
|
170
170
|
|
|
171
171
|
let lemma_forms = conj.data.overriding_lemma;
|
|
@@ -185,7 +185,7 @@ export class HeadwordParser {
|
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
private parseGerund(args: Args):
|
|
188
|
+
private parseGerund(args: Args): HeadwordData {
|
|
189
189
|
const gerund = args.get("1") || "";
|
|
190
190
|
const match = gerund.match(/^(.*)um$/);
|
|
191
191
|
if (!match) {
|
|
@@ -209,7 +209,7 @@ export class HeadwordParser {
|
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
private parseComparativeAdj(args: Args, lemma: string):
|
|
212
|
+
private parseComparativeAdj(args: Args, lemma: string): HeadwordData {
|
|
213
213
|
const a1 = args.get("1");
|
|
214
214
|
const a2 = args.get("2");
|
|
215
215
|
const is_lemma = args.get("is_lemma");
|
|
@@ -249,7 +249,7 @@ export class HeadwordParser {
|
|
|
249
249
|
};
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
private parseSuperlativeAdj(args: Args, lemma: string):
|
|
252
|
+
private parseSuperlativeAdj(args: Args, lemma: string): HeadwordData {
|
|
253
253
|
const a1 = args.get("1");
|
|
254
254
|
const a2 = args.get("2");
|
|
255
255
|
const is_lemma = args.get("is_lemma");
|
|
@@ -293,7 +293,7 @@ export class HeadwordParser {
|
|
|
293
293
|
};
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
private parseAdverb(args: Args, pos: AdverbType):
|
|
296
|
+
private parseAdverb(args: Args, pos: AdverbType): HeadwordData {
|
|
297
297
|
const a1 = args.get("1");
|
|
298
298
|
const a2 = args.get("2");
|
|
299
299
|
const a3 = args.get("3");
|
|
@@ -365,7 +365,7 @@ export class HeadwordParser {
|
|
|
365
365
|
};
|
|
366
366
|
}
|
|
367
367
|
|
|
368
|
-
private parseAdverbNumeral(args: Args):
|
|
368
|
+
private parseAdverbNumeral(args: Args): HeadwordData {
|
|
369
369
|
const a1 = args.get("1") || "";
|
|
370
370
|
const numType = args.get("type") || "";
|
|
371
371
|
|
|
@@ -377,7 +377,7 @@ export class HeadwordParser {
|
|
|
377
377
|
};
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
-
private parseAdverbCompSup(args: Args, pos: AdverbType):
|
|
380
|
+
private parseAdverbCompSup(args: Args, pos: AdverbType): HeadwordData {
|
|
381
381
|
const head = args.get("1");
|
|
382
382
|
let heads: string[] | undefined;
|
|
383
383
|
if (head) {
|
|
@@ -394,7 +394,7 @@ export class HeadwordParser {
|
|
|
394
394
|
};
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
-
private parseLetter(args: Args, lemma: string):
|
|
397
|
+
private parseLetter(args: Args, lemma: string): HeadwordData {
|
|
398
398
|
const upper = read_list(args, "upper");
|
|
399
399
|
const lower = read_list(args, "lower");
|
|
400
400
|
const mixed = read_list(args, "mixed");
|
|
@@ -416,7 +416,7 @@ export class HeadwordParser {
|
|
|
416
416
|
};
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
-
private parsePreposition(args: Args, lemma: string):
|
|
419
|
+
private parsePreposition(args: Args, lemma: string): HeadwordData {
|
|
420
420
|
let genitive = false;
|
|
421
421
|
let ablative = false;
|
|
422
422
|
let accusative = false;
|
|
@@ -451,7 +451,7 @@ export class HeadwordParser {
|
|
|
451
451
|
};
|
|
452
452
|
}
|
|
453
453
|
|
|
454
|
-
private parseInterjection(args: Args, lemma: string):
|
|
454
|
+
private parseInterjection(args: Args, lemma: string): HeadwordData {
|
|
455
455
|
const head = args.get("head");
|
|
456
456
|
let interj = head || args.get("1");
|
|
457
457
|
if (!interj) {
|
|
@@ -465,7 +465,7 @@ export class HeadwordParser {
|
|
|
465
465
|
};
|
|
466
466
|
}
|
|
467
467
|
|
|
468
|
-
private parsePhrase(args: Args, lemma: string):
|
|
468
|
+
private parsePhrase(args: Args, lemma: string): HeadwordData {
|
|
469
469
|
let phrase = args.get("1");
|
|
470
470
|
if (!phrase) {
|
|
471
471
|
phrase = lemma;
|
|
@@ -478,7 +478,7 @@ export class HeadwordParser {
|
|
|
478
478
|
};
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
-
private parseHead(args: Args, lemma: string):
|
|
481
|
+
private parseHead(args: Args, lemma: string): HeadwordData {
|
|
482
482
|
const pos = args.get("2");
|
|
483
483
|
const heads = read_list(args, "head");
|
|
484
484
|
|
|
@@ -498,7 +498,7 @@ export class HeadwordParser {
|
|
|
498
498
|
};
|
|
499
499
|
}
|
|
500
500
|
|
|
501
|
-
private parseForm(args: Args, lemma: string, pos: string):
|
|
501
|
+
private parseForm(args: Args, lemma: string, pos: string): HeadwordData {
|
|
502
502
|
let form = args.get("1");
|
|
503
503
|
if (!form) {
|
|
504
504
|
form = lemma;
|