Пример #1
0
        public string printPrepositionXml(Preposition p)
        {
            string nl = Environment.NewLine;

            string ret = "";

            if (this.withXmlDeclarations)
            {
                ret += "<?xml version='1.0' encoding='utf-8'?>" + nl;
            }
            if (this.withXmlDeclarations)
            {
                ret += "<?xml-stylesheet type='text/xsl' href='!gram.xsl'?>" + nl;
            }
            ret += "<Lemma lemma='" + clean4xml(p.lemma) + "' uid='" + clean4xml(p.getNickname()) + "'>" + nl;
            ret += "<preposition>" + nl;
            //Inflected forms:
            for (int i = 0; i < p.sg1.Count; i++)
            {
                ret += "\t<persSg1>" + p.sg1[i].value + "</persSg1>" + nl;
            }
            for (int i = 0; i < p.sg2.Count; i++)
            {
                ret += "\t<persSg2>" + p.sg2[i].value + "</persSg2>" + nl;
            }
            for (int i = 0; i < p.sg3Masc.Count; i++)
            {
                ret += "\t<persSg3Masc>" + p.sg3Masc[i].value + "</persSg3Masc>" + nl;
            }
            for (int i = 0; i < p.sg3Fem.Count; i++)
            {
                ret += "\t<persSg3Fem>" + p.sg3Fem[i].value + "</persSg3Fem>" + nl;
            }
            for (int i = 0; i < p.pl1.Count; i++)
            {
                ret += "\t<persPl1>" + p.pl1[i].value + "</persPl1>" + nl;
            }
            for (int i = 0; i < p.pl2.Count; i++)
            {
                ret += "\t<persPl2>" + p.pl2[i].value + "</persPl2>" + nl;
            }
            for (int i = 0; i < p.pl3.Count; i++)
            {
                ret += "\t<persPl3>" + p.pl3[i].value + "</persPl3>" + nl;
            }
            ret += "</preposition>" + nl;
            ret += "</Lemma>";
            return(ret);
        }
Пример #2
0
 //Creates a prepositional phrase from a preposition and a noun phrase:
 public PP(Preposition prep, NP np)
 {
     this.prepNick = prep.getNickname();
     if (this.prepNick == "ag_prep")
     {
         foreach (FormSg f in np.sgDat)
         {
             this.sg.Add(new FormSg("ag " + f.value, f.gender));
         }
         foreach (Form f in np.plDat)
         {
             this.pl.Add(new Form("ag " + f.value));
         }
         foreach (FormSg f in np.sgDatArtN)
         {
             this.sgArtN.Add(new FormSg("ag an " + Opers.Mutate(Mutation.Len3, f.value), f.gender));
         }
         foreach (FormSg f in np.sgDatArtS)
         {
             this.sgArtS.Add(new FormSg("ag an " + Opers.Mutate((f.gender == Gender.Fem?Mutation.Ecl3:Mutation.Ecl2), f.value), f.gender));
         }
         foreach (Form f in np.plDatArt)
         {
             this.plArt.Add(new Form("ag na " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
     }
     if (this.prepNick == "ar_prep")
     {
         foreach (FormSg f in np.sgDat)
         {
             this.sg.Add(new FormSg("ar " + Opers.Mutate(Mutation.Len1, f.value), f.gender));
         }
         foreach (Form f in np.plDat)
         {
             this.pl.Add(new Form("ar " + Opers.Mutate(Mutation.Len1, f.value)));
         }
         foreach (FormSg f in np.sgDatArtN)
         {
             this.sgArtN.Add(new FormSg("ar an " + Opers.Mutate(Mutation.Len3, f.value), f.gender));
         }
         foreach (FormSg f in np.sgDatArtS)
         {
             this.sgArtS.Add(new FormSg("ar an " + Opers.Mutate((f.gender == Gender.Fem?Mutation.Ecl3:Mutation.Ecl2), f.value), f.gender));
         }
         foreach (Form f in np.plDatArt)
         {
             this.plArt.Add(new Form("ar na " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
     }
     if (this.prepNick == "thar_prep")
     {
         foreach (FormSg f in np.sgDat)
         {
             this.sg.Add(new FormSg("thar " + Opers.Mutate(Mutation.Len1, f.value), f.gender));
         }
         foreach (Form f in np.plDat)
         {
             this.pl.Add(new Form("thar " + Opers.Mutate(Mutation.Len1, f.value)));
         }
         foreach (FormSg f in np.sgDatArtN)
         {
             this.sgArtN.Add(new FormSg("thar an " + Opers.Mutate(Mutation.Len3, f.value), f.gender));
         }
         foreach (FormSg f in np.sgDatArtS)
         {
             this.sgArtS.Add(new FormSg("thar an " + Opers.Mutate((f.gender == Gender.Fem?Mutation.Ecl3:Mutation.Ecl2), f.value), f.gender));
         }
         foreach (Form f in np.plDatArt)
         {
             this.plArt.Add(new Form("thar na " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
     }
     if (this.prepNick == "as_prep")
     {
         foreach (FormSg f in np.sgDat)
         {
             this.sg.Add(new FormSg("as " + f.value, f.gender));
         }
         foreach (Form f in np.plDat)
         {
             this.pl.Add(new Form("as " + f.value));
         }
         foreach (FormSg f in np.sgDatArtN)
         {
             this.sgArtN.Add(new FormSg("as an " + Opers.Mutate(Mutation.Len3, f.value), f.gender));
         }
         foreach (FormSg f in np.sgDatArtS)
         {
             this.sgArtS.Add(new FormSg("as an " + Opers.Mutate((f.gender == Gender.Fem?Mutation.Ecl3:Mutation.Ecl2), f.value), f.gender));
         }
         foreach (Form f in np.plDatArt)
         {
             this.plArt.Add(new Form("as na " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
     }
     if (this.prepNick == "chuig_prep")
     {
         foreach (FormSg f in np.sgDat)
         {
             this.sg.Add(new FormSg("chuig " + f.value, f.gender));
         }
         foreach (Form f in np.plDat)
         {
             this.pl.Add(new Form("chuig " + f.value));
         }
         foreach (FormSg f in np.sgDatArtN)
         {
             this.sgArtN.Add(new FormSg("chuig an " + Opers.Mutate(Mutation.Len3, f.value), f.gender));
         }
         foreach (FormSg f in np.sgDatArtS)
         {
             this.sgArtS.Add(new FormSg("chuig an " + Opers.Mutate((f.gender == Gender.Fem?Mutation.Ecl3:Mutation.Ecl2), f.value), f.gender));
         }
         foreach (Form f in np.plDatArt)
         {
             this.plArt.Add(new Form("chuig na " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
     }
     if (this.prepNick == "de_prep")
     {
         foreach (FormSg f in np.sgDat)
         {
             string txt = Opers.Mutate(Mutation.Len1, f.value); if (Opers.StartsVowelFhx(txt))
             {
                 txt = "d'" + txt;
             }
             else
             {
                 txt = "de " + txt;
             }
             this.sg.Add(new FormSg(txt, f.gender));
         }
         foreach (Form f in np.plDat)
         {
             string txt = Opers.Mutate(Mutation.Len1, f.value); if (Opers.StartsVowelFhx(txt))
             {
                 txt = "d'" + txt;
             }
             else
             {
                 txt = "de " + txt;
             }
             this.pl.Add(new Form(txt));
         }
         foreach (FormSg f in np.sgDatArtN)
         {
             this.sgArtN.Add(new FormSg("den " + Opers.Mutate(Mutation.Len3, f.value), f.gender));
         }
         foreach (FormSg f in np.sgDatArtS)
         {
             this.sgArtS.Add(new FormSg("den " + Opers.Mutate((f.gender == Gender.Fem?Mutation.Len3:Mutation.Len2), f.value), f.gender));
         }
         foreach (Form f in np.plDatArt)
         {
             this.plArt.Add(new Form("de na " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
     }
     if (this.prepNick == "do_prep")
     {
         foreach (FormSg f in np.sgDat)
         {
             string txt = Opers.Mutate(Mutation.Len1, f.value); if (Opers.StartsVowelFhx(txt))
             {
                 txt = "d'" + txt;
             }
             else
             {
                 txt = "do " + txt;
             }
             this.sg.Add(new FormSg(txt, f.gender));
         }
         foreach (Form f in np.plDat)
         {
             string txt = Opers.Mutate(Mutation.Len1, f.value); if (Opers.StartsVowelFhx(txt))
             {
                 txt = "d'" + txt;
             }
             else
             {
                 txt = "do " + txt;
             }
             this.pl.Add(new Form(txt));
         }
         foreach (FormSg f in np.sgDatArtN)
         {
             this.sgArtN.Add(new FormSg("don " + Opers.Mutate(Mutation.Len3, f.value), f.gender));
         }
         foreach (FormSg f in np.sgDatArtS)
         {
             this.sgArtS.Add(new FormSg("don " + Opers.Mutate((f.gender == Gender.Fem?Mutation.Len3:Mutation.Len2), f.value), f.gender));
         }
         foreach (Form f in np.plDatArt)
         {
             this.plArt.Add(new Form("do na " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
     }
     if (this.prepNick == "faoi_prep")
     {
         foreach (FormSg f in np.sgDat)
         {
             this.sg.Add(new FormSg("faoi " + Opers.Mutate(Mutation.Len1, f.value), f.gender));
         }
         foreach (Form f in np.plDat)
         {
             this.pl.Add(new Form("faoi " + Opers.Mutate(Mutation.Len1, f.value)));
         }
         foreach (FormSg f in np.sgDatArtN)
         {
             this.sgArtN.Add(new FormSg("faoin " + Opers.Mutate(Mutation.Len3, f.value), f.gender));
         }
         foreach (FormSg f in np.sgDatArtS)
         {
             this.sgArtS.Add(new FormSg("faoin " + Opers.Mutate((f.gender == Gender.Fem?Mutation.Ecl3:Mutation.Ecl2), f.value), f.gender));
         }
         foreach (Form f in np.plDatArt)
         {
             this.plArt.Add(new Form("faoi na " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
     }
     if (this.prepNick == "i_prep")
     {
         foreach (FormSg f in np.sgDat)
         {
             if (Opers.StartsVowel(f.value))
             {
                 this.sg.Add(new FormSg("in " + f.value, f.gender));
             }
             else
             {
                 this.sg.Add(new FormSg("i " + Opers.Mutate(Mutation.Ecl1x, f.value), f.gender));
             }
         }
         foreach (Form f in np.plDat)
         {
             if (Opers.StartsVowel(f.value))
             {
                 this.pl.Add(new Form("in " + f.value));
             }
             else
             {
                 this.pl.Add(new Form("i " + Opers.Mutate(Mutation.Ecl1x, f.value)));
             }
         }
         foreach (FormSg f in np.sgDatArtN)
         {
             string txt = Opers.Mutate(Mutation.Len3, f.value);
             if (Opers.StartsVowelFhx(txt))
             {
                 txt = "san " + txt;
             }
             else
             {
                 txt = "sa " + txt;
             }
             this.sgArtN.Add(new FormSg(txt, f.gender));
         }
         foreach (FormSg f in np.sgDatArtS)
         {
             string txt = Opers.Mutate((f.gender == Gender.Fem?Mutation.Len3:Mutation.Len2), f.value);
             if (Opers.StartsVowelFhx(txt))
             {
                 txt = "san " + txt;
             }
             else
             {
                 txt = "sa " + txt;
             }
             this.sgArtS.Add(new FormSg(txt, f.gender));
         }
         foreach (Form f in np.plDatArt)
         {
             this.plArt.Add(new Form("sna " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
     }
     if (this.prepNick == "le_prep")
     {
         foreach (FormSg f in np.sgDat)
         {
             this.sg.Add(new FormSg("le " + Opers.Mutate(Mutation.PrefH, f.value), f.gender));
         }
         foreach (Form f in np.plDat)
         {
             this.pl.Add(new Form("le " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
         foreach (FormSg f in np.sgDatArtN)
         {
             this.sgArtN.Add(new FormSg("leis an " + Opers.Mutate(Mutation.Len3, f.value), f.gender));
         }
         foreach (FormSg f in np.sgDatArtS)
         {
             this.sgArtS.Add(new FormSg("leis an " + Opers.Mutate((f.gender == Gender.Fem?Mutation.Ecl3:Mutation.Ecl2), f.value), f.gender));
         }
         foreach (Form f in np.plDatArt)
         {
             this.plArt.Add(new Form("leis na " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
     }
     if (this.prepNick == "ó_prep")
     {
         foreach (FormSg f in np.sgDat)
         {
             this.sg.Add(new FormSg("ó " + Opers.Mutate(Mutation.Len1, f.value), f.gender));
         }
         foreach (Form f in np.plDat)
         {
             this.pl.Add(new Form("ó " + Opers.Mutate(Mutation.Len1, f.value)));
         }
         foreach (FormSg f in np.sgDatArtN)
         {
             this.sgArtN.Add(new FormSg("ón " + Opers.Mutate(Mutation.Len3, f.value), f.gender));
         }
         foreach (FormSg f in np.sgDatArtS)
         {
             this.sgArtS.Add(new FormSg("ón " + Opers.Mutate((f.gender == Gender.Fem?Mutation.Ecl3:Mutation.Ecl2), f.value), f.gender));
         }
         foreach (Form f in np.plDatArt)
         {
             this.plArt.Add(new Form("ó na " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
     }
     if (this.prepNick == "roimh_prep")
     {
         foreach (FormSg f in np.sgDat)
         {
             this.sg.Add(new FormSg("roimh " + Opers.Mutate(Mutation.Len1, f.value), f.gender));
         }
         foreach (Form f in np.plDat)
         {
             this.pl.Add(new Form("roimh " + Opers.Mutate(Mutation.Len1, f.value)));
         }
         foreach (FormSg f in np.sgDatArtN)
         {
             this.sgArtN.Add(new FormSg("roimh an " + Opers.Mutate(Mutation.Len3, f.value), f.gender));
         }
         foreach (FormSg f in np.sgDatArtS)
         {
             this.sgArtS.Add(new FormSg("roimh an " + Opers.Mutate((f.gender == Gender.Fem?Mutation.Ecl3:Mutation.Ecl2), f.value), f.gender));
         }
         foreach (Form f in np.plDatArt)
         {
             this.plArt.Add(new Form("roimh na " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
     }
     if (this.prepNick == "trí_prep")
     {
         foreach (FormSg f in np.sgDat)
         {
             this.sg.Add(new FormSg("trí " + Opers.Mutate(Mutation.Len1, f.value), f.gender));
         }
         foreach (Form f in np.plDat)
         {
             this.pl.Add(new Form("trí " + Opers.Mutate(Mutation.Len1, f.value)));
         }
         foreach (FormSg f in np.sgDatArtN)
         {
             this.sgArtN.Add(new FormSg("tríd an " + Opers.Mutate(Mutation.Len3, f.value), f.gender));
         }
         foreach (FormSg f in np.sgDatArtS)
         {
             this.sgArtS.Add(new FormSg("tríd an " + Opers.Mutate((f.gender == Gender.Fem?Mutation.Ecl3:Mutation.Ecl2), f.value), f.gender));
         }
         foreach (Form f in np.plDatArt)
         {
             this.plArt.Add(new Form("trí na " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
     }
     if (this.prepNick == "um_prep")
     {
         foreach (FormSg f in np.sgDat)
         {
             string txt = f.value; if (!Opers.StartsBilabial(txt))
             {
                 txt = Opers.Mutate(Mutation.Len1, txt);
             }
             this.sg.Add(new FormSg("um " + txt, f.gender));
         }
         foreach (Form f in np.plDat)
         {
             string txt = f.value; if (!Opers.StartsBilabial(txt))
             {
                 txt = Opers.Mutate(Mutation.Len1, txt);
             }
             this.pl.Add(new Form("um " + txt));
         }
         foreach (FormSg f in np.sgDatArtN)
         {
             this.sgArtN.Add(new FormSg("um an " + Opers.Mutate(Mutation.Len3, f.value), f.gender));
         }
         foreach (FormSg f in np.sgDatArtS)
         {
             this.sgArtS.Add(new FormSg("um an " + Opers.Mutate((f.gender == Gender.Fem?Mutation.Ecl3:Mutation.Ecl2), f.value), f.gender));
         }
         foreach (Form f in np.plDatArt)
         {
             this.plArt.Add(new Form("um na " + Opers.Mutate(Mutation.PrefH, f.value)));
         }
     }
 }