@fpw/en-wiktionary-la-modules 0.1.1 → 0.1.4

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 (30) hide show
  1. package/dist/modules/conjugation/LaVerb.d.ts +3 -1
  2. package/dist/modules/conjugation/LaVerb.js +201 -31
  3. package/dist/modules/conjugation/LaVerb.js.map +1 -1
  4. package/dist/modules/conjugation/VerbType.d.ts +5 -1
  5. package/dist/modules/conjugation/VerbType.js +4 -0
  6. package/dist/modules/conjugation/VerbType.js.map +1 -1
  7. package/dist/modules/declination/LaAdjData.d.ts +1 -1
  8. package/dist/modules/declination/LaAdjData.js +45 -24
  9. package/dist/modules/declination/LaAdjData.js.map +1 -1
  10. package/dist/modules/declination/LaNominal.d.ts +9 -5
  11. package/dist/modules/declination/LaNominal.js +195 -171
  12. package/dist/modules/declination/LaNominal.js.map +1 -1
  13. package/dist/modules/declination/LaNounData.js +65 -64
  14. package/dist/modules/declination/LaNounData.js.map +1 -1
  15. package/dist/modules/declination/LaPersonalPronoun.js +1 -0
  16. package/dist/modules/declination/LaPersonalPronoun.js.map +1 -1
  17. package/dist/modules/declination/NominalType.d.ts +116 -0
  18. package/dist/modules/declination/NominalType.js +142 -0
  19. package/dist/modules/declination/NominalType.js.map +1 -0
  20. package/dist/modules/headword/HeadwordParser.js +2 -1
  21. package/dist/modules/headword/HeadwordParser.js.map +1 -1
  22. package/package.json +1 -1
  23. package/src/modules/conjugation/LaVerb.ts +206 -34
  24. package/src/modules/conjugation/VerbType.ts +4 -0
  25. package/src/modules/declination/LaAdjData.ts +47 -24
  26. package/src/modules/declination/LaNominal.ts +223 -187
  27. package/src/modules/declination/LaNounData.ts +67 -66
  28. package/src/modules/declination/LaPersonalPronoun.ts +1 -0
  29. package/src/modules/declination/NominalType.ts +153 -0
  30. package/src/modules/headword/HeadwordParser.ts +2 -1
@@ -6,7 +6,7 @@ exports.LaNominal = exports.NumberTantum = exports.Gender = void 0;
6
6
  * It was converted from Lua to TypeScript by Folke Will <folko@solhost.org>.
7
7
  *
8
8
  * Original source: https://en.wiktionary.org/wiki/Module:la-nominal
9
- * Based on version: https://en.wiktionary.org/w/index.php?title=Module:la-nominal&oldid=62391877
9
+ * Based on version: https://en.wiktionary.org/w/index.php?title=Module:la-nominal&oldid=68705587
10
10
  *
11
11
  * Lua idioms, function and variable names kept as in the original in order to easily
12
12
  * backport later changes to this implementation.
@@ -19,6 +19,7 @@ const common_1 = require("../common");
19
19
  const LaAdjData_1 = require("./LaAdjData");
20
20
  const LaNounData_1 = require("./LaNounData");
21
21
  const NominalForm_1 = require("./NominalForm");
22
+ const NominalType_1 = require("./NominalType");
22
23
  var Gender;
23
24
  (function (Gender) {
24
25
  Gender["M"] = "M";
@@ -88,8 +89,9 @@ class LaNominal {
88
89
  ]);
89
90
  this.options = options || {};
90
91
  }
91
- do_generate_noun_forms(args, pos = "nouns", from_headword = false) {
92
+ do_generate_noun_forms(args, pos = "nouns", from_headword = false, title) {
92
93
  var _a;
94
+ this.title = title;
93
95
  const parsed_run = this.parse_segment_run_allowing_alternants(((_a = args.get("1")) === null || _a === void 0 ? void 0 : _a.trim()) || "");
94
96
  parsed_run.loc = parsed_run.loc || args.has("loc_sg") || args.has("loc_pl");
95
97
  let num = args.get("num");
@@ -134,8 +136,9 @@ class LaNominal {
134
136
  this.process_noun_forms_and_overrides(all_data, args);
135
137
  return all_data;
136
138
  }
137
- do_generate_adj_forms(args, pos = "adjectives", from_headword = false) {
139
+ do_generate_adj_forms(args, pos = "adjectives", from_headword = false, title) {
138
140
  var _a;
141
+ this.title = title;
139
142
  let segment_run = ((_a = args.get("1")) === null || _a === void 0 ? void 0 : _a.trim()) || "";
140
143
  if (!segment_run.match(/[<(]/)) {
141
144
  segment_run = segment_run + (args.has("indecl") ? "<0+>" : "<+>");
@@ -178,6 +181,7 @@ class LaNominal {
178
181
  user_specified: new Set(),
179
182
  voc: declensions.voc,
180
183
  noneut: args.has("noneut") || declensions.noneut,
184
+ nomf: args.has("nomf") || declensions.nomf,
181
185
  pos: pos,
182
186
  num_type: args.get("type"),
183
187
  // only if headword
@@ -221,11 +225,13 @@ class LaNominal {
221
225
  if (parsed_run.loc) {
222
226
  post_text_parts.push(", with locative");
223
227
  }
224
- if (parsed_run.num == "sg") {
225
- post_text_parts.push(", singular only");
226
- }
227
- else if (parsed_run.num == "pl") {
228
- post_text_parts.push(", plural only");
228
+ if (parsed_run.apparent_decl == "indecl") {
229
+ if (parsed_run.num == "sg") {
230
+ post_text_parts.push(", singular only");
231
+ }
232
+ else if (parsed_run.num == "pl") {
233
+ post_text_parts.push(", plural only");
234
+ }
229
235
  }
230
236
  const post_text = post_text_parts.join("");
231
237
  if (from_headword) {
@@ -284,6 +290,9 @@ class LaNominal {
284
290
  if (data.noneut && slot.match(/_n/)) {
285
291
  (0, NominalForm_1.setNominalForm)(data.forms, slot, undefined);
286
292
  }
293
+ if (data.nomf && (slot.match(/_m/) || slot.match(/_f/))) {
294
+ (0, NominalForm_1.setNominalForm)(data.forms, slot, undefined);
295
+ }
287
296
  let val;
288
297
  const ovr = args.get(slot);
289
298
  if (ovr) {
@@ -459,7 +468,7 @@ class LaNominal {
459
468
  num: num,
460
469
  gender: gender,
461
470
  is_adj: is_adj,
462
- propses: propses
471
+ propses: propses,
463
472
  };
464
473
  }
465
474
  parse_alternant(alternant) {
@@ -571,7 +580,7 @@ class LaNominal {
571
580
  loc: loc,
572
581
  num: num,
573
582
  gender: gender,
574
- propses: propses
583
+ propses: propses,
575
584
  };
576
585
  }
577
586
  capturing_split(str, pattern) {
@@ -601,11 +610,13 @@ class LaNominal {
601
610
  const begins_with_hypen = m2[1];
602
611
  spec = m2[2];
603
612
  spec = begins_with_hypen + spec.replace(/-/g, "_");
604
- types.add(spec);
613
+ if (spec) {
614
+ (0, NominalType_1.addNominalType)(types, spec);
615
+ }
605
616
  }
606
617
  }
607
618
  }
608
- const orig_lemma = stems[0];
619
+ const orig_lemma = stems[0] || this.title;
609
620
  if (!orig_lemma) {
610
621
  throw Error("No lemma");
611
622
  }
@@ -630,8 +641,8 @@ class LaNominal {
630
641
  headword_decl = decl + "+";
631
642
  }
632
643
  for (const subtype of detected_subtypes) {
633
- if (types.has("-" + subtype)) {
634
- types.delete("-" + subtype);
644
+ if ((0, NominalType_1.hasNominalType)(types, "-" + subtype)) {
645
+ (0, NominalType_1.delNominalType)(types, "-" + subtype);
635
646
  }
636
647
  else {
637
648
  types.add(subtype);
@@ -648,44 +659,46 @@ class LaNominal {
648
659
  headword_decl = decl;
649
660
  }
650
661
  for (const subtype of detected_subtypes) {
651
- if (types.has("-" + subtype)) {
652
- types.delete("-" + subtype);
662
+ if ((0, NominalType_1.hasNominalType)(types, "-" + subtype)) {
663
+ (0, NominalType_1.delNominalType)(types, "-" + subtype);
653
664
  }
654
- else if ((subtype == "M" || subtype == "F" || subtype == "N") && (types.has("M") || types.has("F") || types.has("N"))) {
665
+ else if ((subtype == NominalType_1.NominalType.Masculine || subtype == NominalType_1.NominalType.Feminine || subtype == NominalType_1.NominalType.Neuter) &&
666
+ (types.has(NominalType_1.NominalType.Masculine) || types.has(NominalType_1.NominalType.Feminine) || types.has(NominalType_1.NominalType.Neuter))) {
655
667
  // don't create conflicting gender specs
656
668
  }
657
- else if ((subtype == "sg" || subtype == "pl" || subtype == "both") && (types.has("sg") || types.has("pl") || types.has("both"))) {
669
+ else if ((subtype == NominalType_1.NominalType.Singular || subtype == NominalType_1.NominalType.Plural || subtype == NominalType_1.NominalType.Both) &&
670
+ (types.has(NominalType_1.NominalType.Singular) || types.has(NominalType_1.NominalType.Plural) || types.has(NominalType_1.NominalType.Both))) {
658
671
  // don't create conflicting number restrictions
659
672
  }
660
673
  else {
661
674
  types.add(subtype);
662
675
  }
663
676
  }
664
- if (!types.has("pl") && !types.has("both") && lemma.match(/^[A-ZĀĒĪŌŪȲĂĔĬŎŬ]/)) {
665
- types.add("sg");
677
+ if (!types.has(NominalType_1.NominalType.Plural) && !types.has(NominalType_1.NominalType.Both) && lemma.match(/^[A-ZĀĒĪŌŪȲĂĔĬŎŬ]/)) {
678
+ types.add(NominalType_1.NominalType.Singular);
666
679
  }
667
680
  }
668
- if (types.has("loc")) {
681
+ if (types.has(NominalType_1.NominalType.Locative)) {
669
682
  loc = true;
670
- types.delete("loc");
683
+ types.delete(NominalType_1.NominalType.Locative);
671
684
  }
672
685
  let gender;
673
- if (types.has("M")) {
686
+ if (types.has(NominalType_1.NominalType.Masculine)) {
674
687
  gender = Gender.M;
675
688
  }
676
- else if (types.has("F")) {
689
+ else if (types.has(NominalType_1.NominalType.Feminine)) {
677
690
  gender = Gender.F;
678
691
  }
679
- else if (types.has("N")) {
692
+ else if (types.has(NominalType_1.NominalType.Neuter)) {
680
693
  gender = Gender.N;
681
694
  }
682
- if (types.has("pl")) {
695
+ if (types.has(NominalType_1.NominalType.Plural)) {
683
696
  num = NumberTantum.Plural;
684
- types.delete("pl");
697
+ types.delete(NominalType_1.NominalType.Plural);
685
698
  }
686
- else if (types.has("sg")) {
699
+ else if (types.has(NominalType_1.NominalType.Singular)) {
687
700
  num = NumberTantum.Singular;
688
- types.delete("sg");
701
+ types.delete(NominalType_1.NominalType.Singular);
689
702
  }
690
703
  const args = [base, stem2];
691
704
  return {
@@ -704,9 +717,9 @@ class LaNominal {
704
717
  };
705
718
  }
706
719
  detect_adj_type_and_subtype(lemma, stem2, typ, subtypes) {
707
- if (!typ.match(/^[0123]/) && !typ.match(/^irreg/)) {
720
+ if (!typ.match(/^[0123]/) && !typ.match(/^irreg/) && typ) {
708
721
  subtypes = new Set(subtypes);
709
- subtypes.add(typ);
722
+ (0, NominalType_1.addNominalType)(subtypes, typ);
710
723
  typ = "";
711
724
  }
712
725
  function base_as_stem2(base, stem2x) {
@@ -725,17 +738,17 @@ class LaNominal {
725
738
  ["us", "1&2", []],
726
739
  ["a", "1&2", []],
727
740
  ["um", "1&2", []],
728
- ["ī", "1&2", ["pl"]],
729
- ["ae", "1&2", ["pl"]],
730
- ["a", "1&2", ["pl"]],
731
- ["os", "1&2", ["greekA", "-greekE"]],
732
- ["os", "1&2", ["greekE", "-greekA"]],
733
- ["ē", "1&2", ["greekE", "-greekA"]],
734
- ["on", "1&2", ["greekA", "-greekE"]],
735
- ["on", "1&2", ["greekE", "-greekA"]],
736
- ["^(.*er)$", "1&2", ["er"]],
737
- ["^(.*ur)$", "1&2", ["er"]],
738
- ["^(h)ic$", "1&2", ["ic"]],
741
+ ["ī", "1&2", [NominalType_1.NominalType.Plural]],
742
+ ["ae", "1&2", [NominalType_1.NominalType.Plural]],
743
+ ["a", "1&2", [NominalType_1.NominalType.Plural]],
744
+ ["os", "1&2", [NominalType_1.NominalType.GreekA, NominalType_1.NominalType.NoGreekE]],
745
+ ["os", "1&2", [NominalType_1.NominalType.GreekE, NominalType_1.NominalType.NoGreekA]],
746
+ ["ē", "1&2", [NominalType_1.NominalType.GreekE, NominalType_1.NominalType.NoGreekA]],
747
+ ["on", "1&2", [NominalType_1.NominalType.GreekA, NominalType_1.NominalType.NoGreekE]],
748
+ ["on", "1&2", [NominalType_1.NominalType.GreekE, NominalType_1.NominalType.NoGreekA]],
749
+ ["^(.*er)$", "1&2", [NominalType_1.NominalType.Er]],
750
+ ["^(.*ur)$", "1&2", [NominalType_1.NominalType.Er]],
751
+ ["^(h)ic$", "1&2", [NominalType_1.NominalType.Ic]],
739
752
  ];
740
753
  const decl3_entries = [
741
754
  ["^(.*er)$", "3-3", []],
@@ -743,16 +756,16 @@ class LaNominal {
743
756
  ["e", "3-2", []],
744
757
  ["^(.*[ij])or$", "3-C", []],
745
758
  ["^(min)or$", "3-C", []],
746
- ["^(.*ēs)$", "3-1", ["I"]],
747
- ["^(.*ēs)$", "3-1", ["par"]],
748
- ["^(.*[ij])ōrēs$", "3-C", ["pl"]],
749
- ["^(min)ōrēs$", "3-C", ["pl"]],
750
- ["ēs", "3-2", ["pl", "I"]],
751
- ["ēs", "3-1", ["pl", "par"], base_as_stem2],
752
- ["ia", "3-2", ["pl", "I"]],
753
- ["a", "3-1", ["pl", "par"], base_as_stem2],
754
- ["", "3-1", ["I"]],
755
- ["", "3-1", ["par"]],
759
+ ["^(.*ēs)$", "3-1", [NominalType_1.NominalType.I]],
760
+ ["^(.*ēs)$", "3-1", [NominalType_1.NominalType.Par]],
761
+ ["^(.*[ij])ōrēs$", "3-C", [NominalType_1.NominalType.Plural]],
762
+ ["^(min)ōrēs$", "3-C", [NominalType_1.NominalType.Plural]],
763
+ ["ēs", "3-2", [NominalType_1.NominalType.Plural, NominalType_1.NominalType.I]],
764
+ ["ēs", "3-1", [NominalType_1.NominalType.Plural, NominalType_1.NominalType.Par], base_as_stem2],
765
+ ["ia", "3-2", [NominalType_1.NominalType.Plural, NominalType_1.NominalType.I]],
766
+ ["a", "3-1", [NominalType_1.NominalType.Plural, NominalType_1.NominalType.Par], base_as_stem2],
767
+ ["", "3-1", [NominalType_1.NominalType.I]],
768
+ ["", "3-1", [NominalType_1.NominalType.Par]],
756
769
  ];
757
770
  if (!typ) {
758
771
  const [base, new_stem2, rettype, new_subtypes] = this.get_adj_type_and_subtype_by_ending(lemma, stem2, undefined, subtypes, decl12_entries, decl12_stem2);
@@ -775,30 +788,30 @@ class LaNominal {
775
788
  else if (typ == "1-1") {
776
789
  return this.get_adj_type_and_subtype_by_ending(lemma, stem2, typ, subtypes, [
777
790
  ["a", "1-1", []],
778
- ["ae", "1-1", ["pl"]]
791
+ ["ae", "1-1", [NominalType_1.NominalType.Plural]]
779
792
  ]);
780
793
  }
781
794
  else if (typ == "2-2") {
782
795
  return this.get_adj_type_and_subtype_by_ending(lemma, stem2, typ, subtypes, [
783
796
  ["us", "2-2", []],
784
797
  ["um", "2-2", []],
785
- ["ī", "2-2", ["pl"]],
786
- ["a", "2-2", ["pl"]],
787
- ["os", "2-2", ["greek"]],
788
- ["on", "2-2", ["greek"]],
789
- ["oe", "2-2", ["greek", "pl"]],
798
+ ["ī", "2-2", [NominalType_1.NominalType.Plural]],
799
+ ["a", "2-2", [NominalType_1.NominalType.Plural]],
800
+ ["os", "2-2", [NominalType_1.NominalType.greek]],
801
+ ["on", "2-2", [NominalType_1.NominalType.greek]],
802
+ ["oe", "2-2", [NominalType_1.NominalType.greek, NominalType_1.NominalType.Plural]],
790
803
  ]);
791
804
  }
792
805
  else if (typ == "3-1") {
793
806
  return this.get_adj_type_and_subtype_by_ending(lemma, stem2, typ, subtypes, [
794
- ["^(.*ēs)$", "3-1", ["I"]],
795
- ["^(.*ēs)$", "3-1", ["par"]],
796
- ["ēs", "3-1", ["pl", "I"], base_as_stem2],
797
- ["ēs", "3-1", ["pl", "par"], base_as_stem2],
798
- ["ia", "3-1", ["pl", "I"], base_as_stem2],
799
- ["a", "3-1", ["pl", "par"], base_as_stem2],
800
- ["", "3-1", ["I"]],
801
- ["", "3-1", ["par"]],
807
+ ["^(.*ēs)$", "3-1", [NominalType_1.NominalType.I]],
808
+ ["^(.*ēs)$", "3-1", [NominalType_1.NominalType.Par]],
809
+ ["ēs", "3-1", [NominalType_1.NominalType.Plural, NominalType_1.NominalType.I], base_as_stem2],
810
+ ["ēs", "3-1", [NominalType_1.NominalType.Plural, NominalType_1.NominalType.Par], base_as_stem2],
811
+ ["ia", "3-1", [NominalType_1.NominalType.Plural, NominalType_1.NominalType.I], base_as_stem2],
812
+ ["a", "3-1", [NominalType_1.NominalType.Plural, NominalType_1.NominalType.Par], base_as_stem2],
813
+ ["", "3-1", [NominalType_1.NominalType.I]],
814
+ ["", "3-1", [NominalType_1.NominalType.Par]],
802
815
  ], decl3_stem2);
803
816
  }
804
817
  else if (typ == "3-2") {
@@ -806,52 +819,52 @@ class LaNominal {
806
819
  ["is", "3-2", []],
807
820
  ["e", "3-2", []],
808
821
  ["ēs", "3-2", []],
809
- ["ēs", "3-2", ["pl"]],
810
- ["ia", "3-2", ["pl"]],
822
+ ["ēs", "3-2", [NominalType_1.NominalType.Plural]],
823
+ ["ia", "3-2", [NominalType_1.NominalType.Plural]],
811
824
  ], decl3_stem2);
812
825
  }
813
826
  else if (typ == "3-C") {
814
827
  return this.get_adj_type_and_subtype_by_ending(lemma, stem2, typ, subtypes, [
815
828
  ["^(.*[ij])or$", "3-C", []],
816
829
  ["^(min)or$", "3-C", []],
817
- ["^(.*[ij])ōrēs$", "3-C", ["pl"]],
818
- ["^(min)ōrēs$", "3-C", ["pl"]],
830
+ ["^(.*[ij])ōrēs$", "3-C", [NominalType_1.NominalType.Plural]],
831
+ ["^(min)ōrēs$", "3-C", [NominalType_1.NominalType.Plural]],
819
832
  ], decl3_stem2);
820
833
  }
821
834
  else if (typ == "irreg") {
822
835
  return this.get_adj_type_and_subtype_by_ending(lemma, stem2, typ, subtypes, [
823
- ["^(duo)$", typ, ["pl"]],
824
- ["^(ambō)$", typ, ["pl"]],
825
- ["^(mīll?ia)$", typ, ["N", "pl"], constant_base("mīlle")],
836
+ ["^(duo)$", typ, [NominalType_1.NominalType.Plural]],
837
+ ["^(ambō)$", typ, [NominalType_1.NominalType.Plural]],
838
+ ["^(mīll?ia)$", typ, [NominalType_1.NominalType.Neuter, NominalType_1.NominalType.Plural], constant_base("mīlle")],
826
839
  ["^(ea)$", typ, [], constant_base("is")],
827
840
  ["^(id)$", typ, [], constant_base("is")],
828
- ["^([ei]ī)$", typ, ["pl"], constant_base("is")],
829
- ["^(eae?)$", typ, ["pl"], constant_base("is")],
841
+ ["^([ei]ī)$", typ, [NominalType_1.NominalType.Plural], constant_base("is")],
842
+ ["^(eae?)$", typ, [NominalType_1.NominalType.Plural], constant_base("is")],
830
843
  ["^(eadem)$", typ, [], constant_base("īdem")],
831
844
  ["^([īi]dem)$", typ, [], constant_base("īdem")],
832
- ["^(īdem)$", typ, ["pl"]],
833
- ["^(eae?dem)$", typ, ["pl"], constant_base("īdem")],
845
+ ["^(īdem)$", typ, [NominalType_1.NominalType.Plural]],
846
+ ["^(eae?dem)$", typ, [NominalType_1.NominalType.Plural], constant_base("īdem")],
834
847
  ["^(i[lps][lst])a$", typ, [], (base, s2) => [base + "e", ""]],
835
848
  ["^(i[ls][lt])ud$", typ, [], (base, s2) => [base + "e", ""]],
836
849
  ["^(ipsum)$", typ, [], constant_base("ipse")],
837
- ["^(i[lps][lst])ī$", typ, ["pl"], (base, s2) => [base + "e", ""]],
838
- ["^(i[lps][lst])ae?$", typ, ["pl"], (base, s2) => [base + "e", ""]],
850
+ ["^(i[lps][lst])ī$", typ, [NominalType_1.NominalType.Plural], (base, s2) => [base + "e", ""]],
851
+ ["^(i[lps][lst])ae?$", typ, [NominalType_1.NominalType.Plural], (base, s2) => [base + "e", ""]],
839
852
  ["^(quī)$", typ, []],
840
- ["^(quī)$", typ, ["pl"]],
853
+ ["^(quī)$", typ, [NominalType_1.NominalType.Plural]],
841
854
  ["^(quae)$", typ, [], constant_base("quī")],
842
- ["^(quae)$", typ, ["pl"], constant_base("quī")],
855
+ ["^(quae)$", typ, [NominalType_1.NominalType.Plural], constant_base("quī")],
843
856
  ["^(quid)$", typ, [], constant_base("quis")],
844
857
  ["^(quod)$", typ, [], constant_base("quī")],
845
858
  ["^(qui[cd]quid)$", typ, [], constant_base("quisquis")],
846
- ["^(quīquī)$", typ, ["pl"], constant_base("quisquis")],
847
- ["^(quaequae)$", typ, ["pl"], constant_base("quisquis")],
859
+ ["^(quīquī)$", typ, [NominalType_1.NominalType.Plural], constant_base("quisquis")],
860
+ ["^(quaequae)$", typ, [NominalType_1.NominalType.Plural], constant_base("quisquis")],
848
861
  ["", typ, []],
849
862
  ]);
850
863
  }
851
864
  else {
852
865
  return this.get_adj_type_and_subtype_by_ending(lemma, stem2, typ, subtypes, [
853
- ["ēs", typ, ["pl"], base_as_stem2],
854
- ["ia", typ, ["pl"], base_as_stem2],
866
+ ["ēs", typ, [NominalType_1.NominalType.Plural], base_as_stem2],
867
+ ["ia", typ, [NominalType_1.NominalType.Plural], base_as_stem2],
855
868
  ["", typ, []],
856
869
  ], decl3_stem2);
857
870
  }
@@ -859,17 +872,17 @@ class LaNominal {
859
872
  get_adj_type_and_subtype_by_ending(lemma, stem2, decltype, specified_subtypes, endings_and_subtypes, process_stem2) {
860
873
  for (const [ending, rettype, subtypes, process_retval] of endings_and_subtypes) {
861
874
  let not_this_subtype = false;
862
- if (specified_subtypes.has("pl") && !subtypes.includes("pl")) {
875
+ if (specified_subtypes.has(NominalType_1.NominalType.Plural) && !subtypes.includes(NominalType_1.NominalType.Plural)) {
863
876
  not_this_subtype = true;
864
877
  }
865
878
  else {
866
879
  for (const subtype of subtypes) {
867
- if (specified_subtypes.has("-" + subtype)) {
880
+ if (!subtype.startsWith("-") && (0, NominalType_1.hasNominalType)(specified_subtypes, "-" + subtype)) {
868
881
  not_this_subtype = true;
869
882
  break;
870
883
  }
871
884
  const must_not_be_present = subtype.match(/^-(.*)$/);
872
- if (must_not_be_present && specified_subtypes.has(must_not_be_present[1])) {
885
+ if (must_not_be_present && (0, NominalType_1.hasNominalType)(specified_subtypes, must_not_be_present[1])) {
873
886
  not_this_subtype = true;
874
887
  break;
875
888
  }
@@ -918,49 +931,49 @@ class LaNominal {
918
931
  detect_noun_subtype(lemma, stem2, typ, subtypes) {
919
932
  if (typ == "1") {
920
933
  return this.get_noun_subtype_by_ending(lemma, stem2, typ, subtypes, [
921
- ["ām", ["F", "am"]],
922
- ["ās", ["M", "Greek", "Ma"]],
923
- ["ēs", ["M", "Greek", "Me"]],
924
- ["ē", ["F", "Greek"]],
925
- ["ae", ["F", "pl"]],
926
- ["a", ["F"]],
934
+ ["ām", [NominalType_1.NominalType.Feminine, NominalType_1.NominalType.Am]],
935
+ ["ās", [NominalType_1.NominalType.Masculine, NominalType_1.NominalType.Greek, NominalType_1.NominalType.Ma]],
936
+ ["ēs", [NominalType_1.NominalType.Masculine, NominalType_1.NominalType.Greek, NominalType_1.NominalType.Me]],
937
+ ["ē", [NominalType_1.NominalType.Feminine, NominalType_1.NominalType.Greek]],
938
+ ["ae", [NominalType_1.NominalType.Feminine, NominalType_1.NominalType.Plural]],
939
+ ["a", [NominalType_1.NominalType.Feminine]],
927
940
  ]);
928
941
  }
929
942
  else if (typ == "2") {
930
943
  let detected_subtypes;
931
944
  [lemma, stem2, detected_subtypes] = this.get_noun_subtype_by_ending(lemma, stem2, typ, subtypes, [
932
- ["^(.*r)$", ["M", "er"]],
933
- ["^(.*v)os$", ["M", "vos"]],
934
- ["^(.*v)om$", ["N", "vom"]],
935
- ["os", ["M", "Greek"]],
936
- ["os", ["N", "Greek", "us"]],
937
- ["on", ["N", "Greek"]],
938
- ["^([A-ZĀĒĪŌŪȲĂĔĬŎŬ].*)ius$", ["M", "ius", "voci", "sg"]],
939
- ["ius", ["M", "ius"]],
940
- ["ium", ["N", "ium"]],
941
- ["us", ["M"]],
942
- ["us", ["N", "us"]],
943
- ["um", ["N"]],
944
- ["iī", ["M", "ius", "pl"]],
945
- ["ia", ["N", "ium", "pl"]],
946
- ["ī", ["M", "pl"]],
947
- ["ī", ["N", "us", "pl"]],
948
- ["a", ["N", "pl"]],
945
+ ["^(.*r)$", [NominalType_1.NominalType.Masculine, NominalType_1.NominalType.Er]],
946
+ ["^(.*v)os$", [NominalType_1.NominalType.Masculine, NominalType_1.NominalType.Vos]],
947
+ ["^(.*v)om$", [NominalType_1.NominalType.Neuter, NominalType_1.NominalType.Vom]],
948
+ ["os", [NominalType_1.NominalType.Masculine, NominalType_1.NominalType.Greek]],
949
+ ["os", [NominalType_1.NominalType.Neuter, NominalType_1.NominalType.Greek, NominalType_1.NominalType.Us]],
950
+ ["on", [NominalType_1.NominalType.Neuter, NominalType_1.NominalType.Greek]],
951
+ ["^([A-ZĀĒĪŌŪȲĂĔĬŎŬ].*)ius$", [NominalType_1.NominalType.Masculine, NominalType_1.NominalType.Ius, NominalType_1.NominalType.VocI, NominalType_1.NominalType.Singular]],
952
+ [NominalType_1.NominalType.Ius, [NominalType_1.NominalType.Masculine, NominalType_1.NominalType.Ius]],
953
+ [NominalType_1.NominalType.Ium, [NominalType_1.NominalType.Neuter, NominalType_1.NominalType.Ium]],
954
+ [NominalType_1.NominalType.Us, [NominalType_1.NominalType.Masculine]],
955
+ [NominalType_1.NominalType.Us, [NominalType_1.NominalType.Neuter, NominalType_1.NominalType.Us]],
956
+ ["um", [NominalType_1.NominalType.Neuter]],
957
+ ["iī", [NominalType_1.NominalType.Masculine, NominalType_1.NominalType.Ius, NominalType_1.NominalType.Plural]],
958
+ ["ia", [NominalType_1.NominalType.Neuter, NominalType_1.NominalType.Ium, NominalType_1.NominalType.Plural]],
959
+ ["ī", [NominalType_1.NominalType.Masculine, NominalType_1.NominalType.Plural]],
960
+ ["ī", [NominalType_1.NominalType.Neuter, NominalType_1.NominalType.Us, NominalType_1.NominalType.Plural]],
961
+ ["a", [NominalType_1.NominalType.Neuter, NominalType_1.NominalType.Plural]],
949
962
  ]);
950
963
  stem2 = stem2 || lemma;
951
964
  return [lemma, stem2, detected_subtypes];
952
965
  }
953
966
  else if (typ == "3") {
954
967
  let match;
955
- if (subtypes.has("pl")) {
956
- if (subtypes.has("Greek")) {
968
+ if (subtypes.has(NominalType_1.NominalType.Plural)) {
969
+ if (subtypes.has(NominalType_1.NominalType.Greek)) {
957
970
  match = lemma.match(/^(.*)erēs$/);
958
971
  if (match) {
959
- return [match[1] + "ēr", match[1] + "er", new Set(["er"])];
972
+ return [match[1] + "ēr", match[1] + "er", new Set([NominalType_1.NominalType.Er])];
960
973
  }
961
974
  match = lemma.match(/^(.*)ontēs$/);
962
975
  if (match) {
963
- return [match[1] + "ōn", match[1] + "ont", new Set(["on"])];
976
+ return [match[1] + "ōn", match[1] + "ont", new Set([NominalType_1.NominalType.On])];
964
977
  }
965
978
  match = lemma.match(/^(.*)es$/);
966
979
  if (match) {
@@ -970,11 +983,11 @@ class LaNominal {
970
983
  }
971
984
  match = lemma.match(/^(.*)ia$/);
972
985
  if (match) {
973
- return ["foo", stem2 || match[1], new Set(["N", "I", "pure"])];
986
+ return ["foo", stem2 || match[1], new Set([NominalType_1.NominalType.Neuter, NominalType_1.NominalType.I, NominalType_1.NominalType.Pure])];
974
987
  }
975
988
  match = lemma.match(/^(.*)a$/);
976
989
  if (match) {
977
- return ["foo", stem2 || match[1], new Set(["N"])];
990
+ return ["foo", stem2 || match[1], new Set([NominalType_1.NominalType.Neuter])];
978
991
  }
979
992
  match = lemma.match(/^(.*)ēs$/);
980
993
  if (match) {
@@ -986,46 +999,46 @@ class LaNominal {
986
999
  let detected_subtypes;
987
1000
  let base;
988
1001
  let tmp;
989
- if (subtypes.has("Greek")) {
1002
+ if (subtypes.has(NominalType_1.NominalType.Greek)) {
990
1003
  [base, tmp, detected_subtypes] = this.get_noun_subtype_by_ending(lemma, stem2, "", subtypes, [
991
- [["is", ""], ["I"]],
992
- ["ēr", ["er"]],
993
- ["ōn", ["on"]],
1004
+ [["is", ""], [NominalType_1.NominalType.I]],
1005
+ ["ēr", [NominalType_1.NominalType.Er]],
1006
+ ["ōn", [NominalType_1.NominalType.On]],
994
1007
  ]);
995
1008
  if (base) {
996
1009
  return [lemma, stem2, detected_subtypes];
997
1010
  }
998
1011
  return [lemma, stem2, new Set()];
999
1012
  }
1000
- if (!subtypes.has("N")) {
1013
+ if (!subtypes.has(NominalType_1.NominalType.Neuter)) {
1001
1014
  [base, tmp, detected_subtypes] = this.get_noun_subtype_by_ending(lemma, stem2, "", subtypes, [
1002
- [["^([A-ZĀĒĪŌŪȲĂĔĬŎŬ].*pol)is$", ""], ["F", "polis", "sg", "loc"]],
1003
- [["tūdō", "tūdin"], ["F"]],
1004
- [["tās", "tāt"], ["F"]],
1005
- [["tūs", "tūt"], ["F"]],
1006
- [["tiō", "tiōn"], ["F"]],
1007
- [["siō", "siōn"], ["F"]],
1008
- [["xiō", "xiōn"], ["F"]],
1009
- [["gō", "gin"], ["F"]],
1010
- [["or", "ōr"], ["M"]],
1011
- [["trīx", "trīc"], ["F"]],
1012
- [["trix", "trīc"], ["F"]],
1013
- [["is", ""], ["I"]],
1014
- [["^([a-zāēīōūȳăĕĭŏŭ].*)ēs$", ""], ["I"]],
1015
+ [["^([A-ZĀĒĪŌŪȲĂĔĬŎŬ].*pol)is$", ""], [NominalType_1.NominalType.Feminine, NominalType_1.NominalType.Polis, NominalType_1.NominalType.Singular, NominalType_1.NominalType.Locative]],
1016
+ [["tūdō", "tūdin"], [NominalType_1.NominalType.Feminine]],
1017
+ [["tās", "tāt"], [NominalType_1.NominalType.Feminine]],
1018
+ [["tūs", "tūt"], [NominalType_1.NominalType.Feminine]],
1019
+ [["tiō", "tiōn"], [NominalType_1.NominalType.Feminine]],
1020
+ [["siō", "siōn"], [NominalType_1.NominalType.Feminine]],
1021
+ [["xiō", "xiōn"], [NominalType_1.NominalType.Feminine]],
1022
+ [["gō", "gin"], [NominalType_1.NominalType.Feminine]],
1023
+ [["or", "ōr"], [NominalType_1.NominalType.Masculine]],
1024
+ [["trīx", "trīc"], [NominalType_1.NominalType.Feminine]],
1025
+ [["trix", "trīc"], [NominalType_1.NominalType.Feminine]],
1026
+ [["is", ""], [NominalType_1.NominalType.I]],
1027
+ [["^([a-zāēīōūȳăĕĭŏŭ].*)ēs$", ""], [NominalType_1.NominalType.I]],
1015
1028
  ]);
1016
1029
  if (base) {
1017
1030
  return [lemma, stem2, detected_subtypes];
1018
1031
  }
1019
1032
  }
1020
1033
  [base, tmp, detected_subtypes] = this.get_noun_subtype_by_ending(lemma, stem2, "", subtypes, [
1021
- [["us", "or"], ["N"]],
1022
- [["us", "er"], ["N"]],
1023
- [["ma", "mat"], ["N"]],
1024
- [["men", "min"], ["N"]],
1025
- [["^([A-ZĀĒĪŌŪȲĂĔĬŎŬ].*)e$", ""], ["N", "sg"]],
1026
- [["e", ""], ["N", "I", "pure"]],
1027
- [["al", "āl"], ["N", "I", "pure"]],
1028
- [["ar", "ār"], ["N", "I", "pure"]],
1034
+ [["us", "or"], [NominalType_1.NominalType.Neuter]],
1035
+ [["us", "er"], [NominalType_1.NominalType.Neuter]],
1036
+ [["ma", "mat"], [NominalType_1.NominalType.Neuter]],
1037
+ [["men", "min"], [NominalType_1.NominalType.Neuter]],
1038
+ [["^([A-ZĀĒĪŌŪȲĂĔĬŎŬ].*)e$", ""], [NominalType_1.NominalType.Neuter, NominalType_1.NominalType.Singular]],
1039
+ [["e", ""], [NominalType_1.NominalType.Neuter, NominalType_1.NominalType.I, NominalType_1.NominalType.Pure]],
1040
+ [["al", "āl"], [NominalType_1.NominalType.Neuter, NominalType_1.NominalType.I, NominalType_1.NominalType.Pure]],
1041
+ [["ar", "ār"], [NominalType_1.NominalType.Neuter, NominalType_1.NominalType.I, NominalType_1.NominalType.Pure]],
1029
1042
  ]);
1030
1043
  if (base) {
1031
1044
  return [lemma, stem2, detected_subtypes];
@@ -1033,39 +1046,39 @@ class LaNominal {
1033
1046
  return [lemma, stem2, new Set()];
1034
1047
  }
1035
1048
  else if (typ == "4") {
1036
- if (subtypes.has("echo") || subtypes.has("argo") || subtypes.has("Callisto")) {
1049
+ if (subtypes.has(NominalType_1.NominalType.Echo) || subtypes.has(NominalType_1.NominalType.argo) || subtypes.has(NominalType_1.NominalType.Callisto)) {
1037
1050
  const match = lemma.match(/^(.*)ō$/);
1038
1051
  if (!match) {
1039
1052
  throw Error(`Declension-4 noun of subtype .echo, .argo or .Callisto should end in -ō: ${lemma}`);
1040
1053
  }
1041
1054
  const base = match[1];
1042
- if (subtypes.has("Callisto")) {
1043
- return [base, "", new Set(["F", "sg"])];
1055
+ if (subtypes.has(NominalType_1.NominalType.Callisto)) {
1056
+ return [base, "", new Set([NominalType_1.NominalType.Feminine, NominalType_1.NominalType.Singular])];
1044
1057
  }
1045
1058
  else {
1046
- return [base, "", new Set(["F"])];
1059
+ return [base, "", new Set([NominalType_1.NominalType.Feminine])];
1047
1060
  }
1048
1061
  }
1049
1062
  return this.get_noun_subtype_by_ending(lemma, stem2, typ, subtypes, [
1050
- ["us", ["M"]],
1051
- ["ū", ["N"]],
1052
- ["ūs", ["M", "pl"]],
1053
- ["ua", ["N", "pl"]],
1063
+ ["us", [NominalType_1.NominalType.Masculine]],
1064
+ ["ū", [NominalType_1.NominalType.Neuter]],
1065
+ ["ūs", [NominalType_1.NominalType.Masculine, NominalType_1.NominalType.Plural]],
1066
+ ["ua", [NominalType_1.NominalType.Neuter, NominalType_1.NominalType.Plural]],
1054
1067
  ]);
1055
1068
  }
1056
1069
  else if (typ == "5") {
1057
1070
  return this.get_noun_subtype_by_ending(lemma, stem2, typ, subtypes, [
1058
- ["iēs", ["F", "i"]],
1059
- ["iēs", ["F", "i", "pl"]],
1060
- ["ēs", ["F"]],
1061
- ["ēs", ["F", "pl"]],
1071
+ ["iēs", [NominalType_1.NominalType.Feminine, NominalType_1.NominalType.i]],
1072
+ ["iēs", [NominalType_1.NominalType.Feminine, NominalType_1.NominalType.i, NominalType_1.NominalType.Plural]],
1073
+ ["ēs", [NominalType_1.NominalType.Feminine]],
1074
+ ["ēs", [NominalType_1.NominalType.Feminine, NominalType_1.NominalType.Plural]],
1062
1075
  ]);
1063
1076
  }
1064
1077
  else if (typ == "irreg" && lemma == "domus") {
1065
- return [lemma, "", new Set(["loc"])];
1078
+ return [lemma, "", new Set([NominalType_1.NominalType.Locative])];
1066
1079
  }
1067
1080
  else if (typ == "indecl" || (typ == "irreg" && (lemma == "Deus" || lemma == "Iēsus" || lemma == "Jēsus" || lemma == "Athōs" || lemma == "vēnum"))) {
1068
- return [lemma, "", new Set(["sg"])];
1081
+ return [lemma, "", new Set([NominalType_1.NominalType.Singular])];
1069
1082
  }
1070
1083
  else {
1071
1084
  return [lemma, "", new Set()];
@@ -1110,16 +1123,16 @@ class LaNominal {
1110
1123
  const ending = ending_and_subtype[0];
1111
1124
  const subtypes = ending_and_subtype[1];
1112
1125
  let not_this_subtype = false;
1113
- if (specified_subtypes.has("pl") && !subtypes.includes("pl")) {
1126
+ if (specified_subtypes.has(NominalType_1.NominalType.Plural) && !subtypes.includes(NominalType_1.NominalType.Plural)) {
1114
1127
  not_this_subtype = true;
1115
1128
  }
1116
1129
  else {
1117
1130
  for (const subtype of subtypes) {
1118
- if (specified_subtypes.has("-" + subtype) ||
1119
- (subtype == "N" && (specified_subtypes.has("M") || specified_subtypes.has("F"))) ||
1120
- ((subtype == "M" || subtype == "F") && specified_subtypes.has("N")) ||
1121
- (subtype == "sg" && specified_subtypes.has("pl")) ||
1122
- (subtype == "pl" && specified_subtypes.has("sg"))) {
1131
+ if ((0, NominalType_1.hasNominalType)(specified_subtypes, "-" + subtype) ||
1132
+ (subtype == NominalType_1.NominalType.Neuter && (specified_subtypes.has(NominalType_1.NominalType.Masculine) || specified_subtypes.has(NominalType_1.NominalType.Feminine))) ||
1133
+ ((subtype == NominalType_1.NominalType.Masculine || subtype == NominalType_1.NominalType.Feminine) && specified_subtypes.has(NominalType_1.NominalType.Neuter)) ||
1134
+ (subtype == NominalType_1.NominalType.Singular && specified_subtypes.has(NominalType_1.NominalType.Plural)) ||
1135
+ (subtype == NominalType_1.NominalType.Plural && specified_subtypes.has(NominalType_1.NominalType.Singular))) {
1123
1136
  not_this_subtype = true;
1124
1137
  break;
1125
1138
  }
@@ -1157,6 +1170,7 @@ class LaNominal {
1157
1170
  categories: [],
1158
1171
  voc: true,
1159
1172
  noneut: false,
1173
+ nomf: false,
1160
1174
  };
1161
1175
  for (const slot of this.iter_slots(is_adj)) {
1162
1176
  (0, NominalForm_1.setNominalForm)(declensions.forms, slot, [""]);
@@ -1180,8 +1194,10 @@ class LaNominal {
1180
1194
  footnote: "",
1181
1195
  num: seg.num,
1182
1196
  gender: seg.gender,
1197
+ loc: seg.loc,
1183
1198
  voc: true,
1184
1199
  noneut: false,
1200
+ nomf: false,
1185
1201
  pos: is_adj ? pos : "adjectives",
1186
1202
  forms: new Map(),
1187
1203
  types: seg.types,
@@ -1195,10 +1211,13 @@ class LaNominal {
1195
1211
  if (data.noneut) {
1196
1212
  declensions.noneut = true;
1197
1213
  }
1198
- if (data.types.has("sufn")) {
1214
+ if (data.nomf) {
1215
+ declensions.nomf = true;
1216
+ }
1217
+ if (data.types.has(NominalType_1.NominalType.SuffixN)) {
1199
1218
  data.subtitles.push(["with", " 'm' optionally → 'n' in compounds"]);
1200
1219
  }
1201
- else if (data.types.has("not_sufn")) {
1220
+ else if (data.types.has(NominalType_1.NominalType.NotSuffixN)) {
1202
1221
  data.subtitles.push(["without", " 'm' optionally → 'n' in compounds"]);
1203
1222
  }
1204
1223
  if (data.title) {
@@ -1264,12 +1283,13 @@ class LaNominal {
1264
1283
  else {
1265
1284
  throw Error(`Internal error! Don't recognize noun declension ${apparent_decl}`);
1266
1285
  }
1286
+ parsed_run.apparent_decl = apparent_decl;
1267
1287
  data.title = data.title + " noun";
1268
1288
  }
1269
- if (data.types.has("sufn")) {
1289
+ if (data.types.has(NominalType_1.NominalType.SuffixN)) {
1270
1290
  data.subtitles.push(["with", " 'm' optionally → 'n' in compounds"]);
1271
1291
  }
1272
- else if (data.types.has("not_sufn")) {
1292
+ else if (data.types.has(NominalType_1.NominalType.NotSuffixN)) {
1273
1293
  data.subtitles.push(["without", " 'm' optionally → 'n' in compounds"]);
1274
1294
  }
1275
1295
  declensions.orig_titles.push(data.title);
@@ -1304,10 +1324,10 @@ class LaNominal {
1304
1324
  (0, NominalForm_1.setNominalForm)(data.forms, `linked_${slot}`, linked_forms);
1305
1325
  }
1306
1326
  }
1307
- if (seg.types.has("lig")) {
1327
+ if (seg.types.has(NominalType_1.NominalType.Ligature)) {
1308
1328
  this.apply_ligatures(data.forms, is_adj);
1309
1329
  }
1310
- if (seg.types.has("sufn")) {
1330
+ if (seg.types.has(NominalType_1.NominalType.SuffixN)) {
1311
1331
  this.apply_sufn(data.forms, is_adj);
1312
1332
  }
1313
1333
  this.propagate_number_restrictions(data.forms, seg.num, is_adj);
@@ -1346,7 +1366,7 @@ class LaNominal {
1346
1366
  (0, NominalForm_1.setNominalForm)(declensions.forms, slot, forms);
1347
1367
  declensions.notes.set(slot, notes);
1348
1368
  }
1349
- if (!seg.types.has("nocat") && (is_adj || !seg.is_adj)) {
1369
+ if (!seg.types.has(NominalType_1.NominalType.NoCategories) && (is_adj || !seg.is_adj)) {
1350
1370
  for (const cat of data.categories) {
1351
1371
  this.insert_if_not(declensions.categories, cat);
1352
1372
  }
@@ -1401,7 +1421,7 @@ class LaNominal {
1401
1421
  if (segment.type == "Segment" && segment.decl) {
1402
1422
  const neg_subtypes = this.set_difference(subtypeses, segment.types);
1403
1423
  for (const neg_subtype of neg_subtypes) {
1404
- segment.types.add("not_" + neg_subtype);
1424
+ (0, NominalType_1.addNominalType)(segment.types, "not_" + neg_subtype);
1405
1425
  }
1406
1426
  }
1407
1427
  }
@@ -1418,6 +1438,9 @@ class LaNominal {
1418
1438
  if (this_declensions.noneut) {
1419
1439
  declensions.noneut = true;
1420
1440
  }
1441
+ if (this_declensions.nomf) {
1442
+ declensions.nomf = true;
1443
+ }
1421
1444
  if (this_parsed_run.num == "sg" || this_parsed_run.num == "pl") {
1422
1445
  for (const slot of (this.iter_slots(is_adj))) {
1423
1446
  if ((this_parsed_run.num == "sg" && slot.includes("pl")) ||
@@ -1752,6 +1775,7 @@ class LaNominal {
1752
1775
  }
1753
1776
  newval.push(form);
1754
1777
  }
1778
+ (0, NominalForm_1.setNominalForm)(forms, slot, newval);
1755
1779
  }
1756
1780
  }
1757
1781
  }