//Creates a noun phrase from a noun modified by an adjective: public NP(Noun head, Adjective mod) { if (mod.isPre) { Noun prefixedHead = new Noun(head.printXml()); //create a copy of the head noun string prefix = mod.getLemma(); foreach (Form f in prefixedHead.sgNom) { f.value = Opers.Prefix(prefix, f.value); } foreach (Form f in prefixedHead.sgGen) { f.value = Opers.Prefix(prefix, f.value); } foreach (Form f in prefixedHead.sgDat) { f.value = Opers.Prefix(prefix, f.value); } foreach (Form f in prefixedHead.sgVoc) { f.value = Opers.Prefix(prefix, f.value); } foreach (Form f in prefixedHead.plNom) { f.value = Opers.Prefix(prefix, f.value); } foreach (Form f in prefixedHead.plGen) { f.value = Opers.Prefix(prefix, f.value); } foreach (Form f in prefixedHead.plVoc) { f.value = Opers.Prefix(prefix, f.value); } foreach (Form f in prefixedHead.count) { f.value = Opers.Prefix(prefix, f.value); } NP np = new NP(prefixedHead); this.isDefinite = np.isDefinite; this.sgNom = np.sgNom; this.sgNomArt = np.sgNomArt; this.sgGen = np.sgGen; this.sgGenArt = np.sgGenArt; this.sgDat = np.sgDat; this.sgDatArtN = np.sgDatArtN; this.sgDatArtS = np.sgDatArtS; this.plNom = np.plNom; this.plNomArt = np.plNomArt; this.plGen = np.plGen; this.plGenArt = np.plGenArt; this.plDat = np.plDat; this.plDatArt = np.plDatArt; } else { this.isDefinite = head.isDefinite; this.isImmutable = head.isImmutable; this.forceNominative = true; #region singular-nominative foreach (FormSg headForm in head.sgNom) { { //without article: foreach (Form modForm in mod.sgNom) { Mutation mutA = (headForm.gender == Gender.Masc ? Mutation.None : Mutation.Len1); string value = headForm.value + " " + Opers.Mutate(mutA, modForm.value); this.sgNom.Add(new FormSg(value, headForm.gender)); } } if (!head.isDefinite) //with article: { foreach (Form modForm in mod.sgNom) { Mutation mutN = (headForm.gender == Gender.Masc ? Mutation.PrefT : Mutation.Len3); if (head.isImmutable) { mutN = Mutation.None; } Mutation mutA = (headForm.gender == Gender.Masc ? Mutation.None : Mutation.Len1); string value = "an " + Opers.Mutate(mutN, headForm.value) + " " + Opers.Mutate(mutA, modForm.value); this.sgNomArt.Add(new FormSg(value, headForm.gender)); } } } #endregion #region singular-genitive foreach (FormSg headForm in head.sgGen) { { //without article: List <Form> modForms = (headForm.gender == Gender.Masc ? mod.sgGenMasc : mod.sgGenFem); foreach (Form modForm in modForms) { Mutation mutN = (head.isProper ? Mutation.Len1 : Mutation.None); //proper nouns are always lenited in the genitive if (head.isImmutable) { mutN = Mutation.None; } Mutation mutA = (headForm.gender == Gender.Masc ? Mutation.Len1 : Mutation.None); string value = Opers.Mutate(mutN, headForm.value) + " " + Opers.Mutate(mutA, modForm.value); this.sgGen.Add(new FormSg(value, headForm.gender)); } } } foreach (FormSg headForm in head.sgGen) { //with article: if (!head.isDefinite || head.allowArticledGenitive) { List <Form> modForms = (headForm.gender == Gender.Masc ? mod.sgGenMasc : mod.sgGenFem); foreach (Form modForm in modForms) { Mutation mutN = (headForm.gender == Gender.Masc ? Mutation.Len3 : Mutation.PrefH); if (head.isImmutable) { mutN = Mutation.None; } Mutation mutA = (headForm.gender == Gender.Masc ? Mutation.Len1 : Mutation.None); string article = (headForm.gender == Gender.Masc ? "an" : "na"); string value = article + " " + Opers.Mutate(mutN, headForm.value) + " " + Opers.Mutate(mutA, modForm.value); this.sgGenArt.Add(new FormSg(value, headForm.gender)); } } } #endregion #region plural-nominative foreach (Form headForm in head.plNom) { { //without article: foreach (Form modForm in mod.plNom) { Mutation mutA = (Opers.IsSlender(headForm.value) ? Mutation.Len1 : Mutation.None); string value = headForm.value + " " + Opers.Mutate(mutA, modForm.value); this.plNom.Add(new Form(value)); } } if (!head.isDefinite) //with article: { foreach (Form modForm in mod.plNom) { Mutation mutN = Mutation.PrefH; if (head.isImmutable) { mutN = Mutation.None; } Mutation mutA = (Opers.IsSlender(headForm.value) ? Mutation.Len1 : Mutation.None); string value = "na " + Opers.Mutate(mutN, headForm.value) + " " + Opers.Mutate(mutA, modForm.value); this.plNomArt.Add(new Form(value)); } } } #endregion #region plural-genitive foreach (FormPlGen headForm in head.plGen) { { //without article: List <Form> modForms = (headForm.strength == Strength.Strong ? mod.plNom : mod.sgNom); foreach (Form modForm in modForms) { Mutation mutA = (Opers.IsSlender(headForm.value) ? Mutation.Len1 : Mutation.None); if (headForm.strength == Strength.Weak) { mutA = (Opers.IsSlenderI(headForm.value) ? Mutation.Len1 : Mutation.None); //"Gael", "captaen" are not slender } string value = headForm.value + " " + Opers.Mutate(mutA, modForm.value); this.plGen.Add(new Form(value)); } } } foreach (FormPlGen headForm in head.plGen) { //with article: if (!head.isDefinite || head.allowArticledGenitive) { List <Form> modForms = (headForm.strength == Strength.Strong ? mod.plNom : mod.sgNom); foreach (Form modForm in modForms) { Mutation mutN = Mutation.Ecl1; if (head.isImmutable) { mutN = Mutation.None; } Mutation mutA = (Opers.IsSlender(headForm.value) ? Mutation.Len1 : Mutation.None); if (headForm.strength == Strength.Weak) { mutA = (Opers.IsSlenderI(headForm.value) ? Mutation.Len1 : Mutation.None); //"Gael", "captaen" are not slender } string value = "na " + Opers.Mutate(mutN, headForm.value) + " " + Opers.Mutate(mutA, modForm.value); this.plGenArt.Add(new Form(value)); } } } #endregion #region singular-dative foreach (FormSg headForm in head.sgDat) { { //without article: foreach (Form modForm in mod.sgNom) { Mutation mutA = (headForm.gender == Gender.Masc ? Mutation.None : Mutation.Len1); string value = headForm.value + " " + Opers.Mutate(mutA, modForm.value); this.sgDat.Add(new FormSg(value, headForm.gender)); } } if (!head.isDefinite) //with article: { foreach (Form modForm in mod.sgNom) { Mutation mutA = (headForm.gender == Gender.Masc ? Mutation.None : Mutation.Len1); string value = headForm.value + " " + Opers.Mutate(mutA, modForm.value); this.sgDatArtS.Add(new FormSg(value, headForm.gender)); } foreach (Form modForm in mod.sgNom) { string value = headForm.value + " " + Opers.Mutate(Mutation.Len1, modForm.value); this.sgDatArtN.Add(new FormSg(value, headForm.gender)); } } } #endregion #region plural-dative foreach (Form headForm in head.plNom) { { //without article: foreach (Form modForm in mod.plNom) { Mutation mutA = (Opers.IsSlender(headForm.value) ? Mutation.Len1 : Mutation.None); string value = headForm.value + " " + Opers.Mutate(mutA, modForm.value); this.plDat.Add(new Form(value)); } } if (!head.isDefinite) //with article: { foreach (Form modForm in mod.plNom) { Mutation mutA = (Opers.IsSlender(headForm.value) ? Mutation.Len1 : Mutation.None); string value = headForm.value + " " + Opers.Mutate(mutA, modForm.value); this.plDatArt.Add(new Form(value)); } } } #endregion } }