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