示例#1
0
        /// <summary>
        /// Lists all entries in BuNaMo.
        /// </summary>
        public static void ListAll()
        {
            StreamWriter writer = new StreamWriter(@"C:\MBM\Gramadan\listAll.txt");

            foreach (string file in Directory.GetFiles(@"C:\MBM\Gramadan\BuNaMo\noun"))
            {
                XmlDocument doc  = new XmlDocument(); doc.Load(file);
                Noun        item = new Noun(doc);
                writer.WriteLine("ainmfhocal\t" + item.getLemma() + "\t" + item.getNickname());
            }
            foreach (string file in Directory.GetFiles(@"C:\MBM\Gramadan\BuNaMo\nounPhrase"))
            {
                XmlDocument doc  = new XmlDocument(); doc.Load(file);
                NP          item = new NP(doc);
                writer.WriteLine("frása ainmfhoclach\t" + item.getLemma() + "\t" + item.getNickname());
            }
            foreach (string file in Directory.GetFiles(@"C:\MBM\Gramadan\BuNaMo\adjective"))
            {
                XmlDocument doc  = new XmlDocument(); doc.Load(file);
                Adjective   item = new Adjective(doc);
                writer.WriteLine("aidiacht\t" + item.getLemma() + "\t" + item.getNickname());
            }
            foreach (string file in Directory.GetFiles(@"C:\MBM\Gramadan\BuNaMo\verb"))
            {
                XmlDocument doc  = new XmlDocument(); doc.Load(file);
                Verb        item = new Verb(doc);
                writer.WriteLine("briathar\t" + item.getLemma() + "\t" + item.getNickname());
            }
            foreach (string file in Directory.GetFiles(@"C:\MBM\Gramadan\BuNaMo\preposition"))
            {
                XmlDocument doc  = new XmlDocument(); doc.Load(file);
                Preposition item = new Preposition(doc);
                writer.WriteLine("réamhfhocal\t" + item.getLemma() + "\t" + item.getNickname());
            }
            writer.Close();
        }
示例#2
0
        /// <summary>
        /// Bulk-converts BuNaMo entries from minimal format into expanded format.
        /// Outputs each entry into an individual file.
        /// </summary>
        public static void Go()
        {
            bool          doFilter        = false;
            List <string> filterNicknames = new List <string>();
            //if(doFilter) filterNicknames=FilterFromNeidTrGrams();
            //if(doFilter) filterNicknames=FilterFromFile(filterNicknames);
            //NB: the nicknames returned by these have been lower-cased

            PrinterNeid printer = new PrinterNeid();

            foreach (string file in Directory.GetFiles(@"C:\MBM\michmech\BuNaMo\noun"))
            {
                XmlDocument doc  = new XmlDocument(); doc.Load(file);
                Noun        noun = new Noun(doc);
                if (!doFilter || filterNicknames.Contains(noun.getNickname().ToLower()))
                {
                    StreamWriter writer = new StreamWriter(@"C:\MBM\michmech\Gramadan\NeidOutput\" + noun.getNickname() + ".xml");
                    writer.Write(PrettyPrintXml(printer.printNounXml(noun)));
                    writer.Close();
                }
            }
            foreach (string file in Directory.GetFiles(@"C:\MBM\michmech\BuNaMo\adjective"))
            {
                XmlDocument doc       = new XmlDocument(); doc.Load(file);
                Adjective   adjective = new Adjective(doc);
                if (!doFilter || filterNicknames.Contains(adjective.getNickname().ToLower()))
                {
                    StreamWriter writer = new StreamWriter(@"C:\MBM\michmech\Gramadan\NeidOutput\" + adjective.getNickname() + ".xml");
                    writer.Write(PrettyPrintXml(printer.printAdjectiveXml(adjective)));
                    writer.Close();
                }
            }
            foreach (string file in Directory.GetFiles(@"C:\MBM\michmech\BuNaMo\nounPhrase"))
            {
                XmlDocument doc = new XmlDocument(); doc.Load(file);
                NP          np  = new NP(doc);
                if (!doFilter || filterNicknames.Contains(np.getNickname().ToLower()))
                {
                    StreamWriter writer = new StreamWriter(@"C:\MBM\michmech\Gramadan\NeidOutput\" + np.getNickname() + ".xml");
                    writer.Write(PrettyPrintXml(printer.printNPXml(np)));
                    writer.Close();
                }
            }
            foreach (string file in Directory.GetFiles(@"C:\MBM\michmech\BuNaMo\preposition"))
            {
                XmlDocument doc         = new XmlDocument(); doc.Load(file);
                Preposition preposition = new Preposition(doc);
                if (!doFilter || filterNicknames.Contains(preposition.getNickname().ToLower()))
                {
                    StreamWriter writer = new StreamWriter(@"C:\MBM\michmech\Gramadan\NeidOutput\" + preposition.getNickname() + ".xml");
                    writer.Write(PrettyPrintXml(printer.printPrepositionXml(preposition)));
                    writer.Close();
                }
            }
            foreach (string file in Directory.GetFiles(@"C:\MBM\michmech\BuNaMo\verb"))
            {
                XmlDocument doc  = new XmlDocument(); doc.Load(file);
                Verb        verb = new Verb(doc);
                if (!doFilter || filterNicknames.Contains(verb.getNickname().ToLower()))
                {
                    StreamWriter writer = new StreamWriter(@"C:\MBM\michmech\Gramadan\NeidOutput\" + verb.getNickname() + ".xml");
                    writer.Write(PrettyPrintXml(printer.printVerbXml(verb)));
                    writer.Close();
                }
            }
        }
示例#3
0
 /// <summary>
 /// Resaves BuNaMo entries (for example to update their file names).
 /// </summary>
 public static void Resave()
 {
     foreach (string file in Directory.GetFiles(@"C:\MBM\Gramadan\BuNaMo\noun"))
     {
         XmlDocument  doc    = new XmlDocument(); doc.Load(file);
         Noun         noun   = new Noun(doc);
         StreamWriter writer = new StreamWriter(@"C:\MBM\Gramadan\BuNaMo\noun\" + noun.getNickname() + ".xml");
         writer.Write(PrettyPrintXml(noun.printXml().DocumentElement.OuterXml));
         writer.Close();
     }
     foreach (string file in Directory.GetFiles(@"C:\MBM\Gramadan\BuNaMo\adjective"))
     {
         XmlDocument  doc       = new XmlDocument(); doc.Load(file);
         Adjective    adjective = new Adjective(doc);
         StreamWriter writer    = new StreamWriter(@"C:\MBM\Gramadan\BuNaMo\adjective\" + adjective.getNickname() + ".xml");
         writer.Write(PrettyPrintXml(adjective.printXml().DocumentElement.OuterXml));
         writer.Close();
     }
     foreach (string file in Directory.GetFiles(@"C:\MBM\Gramadan\BuNaMo\nounPhrase"))
     {
         XmlDocument  doc    = new XmlDocument(); doc.Load(file);
         NP           np     = new NP(doc);
         StreamWriter writer = new StreamWriter(@"C:\MBM\Gramadan\BuNaMo2\nounPhrase\" + np.getNickname() + ".xml");
         writer.Write(PrettyPrintXml(np.printXml().DocumentElement.OuterXml));
         writer.Close();
     }
     foreach (string file in Directory.GetFiles(@"C:\MBM\Gramadan\BuNaMo\preposition"))
     {
         XmlDocument  doc         = new XmlDocument(); doc.Load(file);
         Preposition  preposition = new Preposition(doc);
         StreamWriter writer      = new StreamWriter(@"C:\MBM\Gramadan\BuNaMo2\preposition\" + preposition.getNickname() + ".xml");
         writer.Write(PrettyPrintXml(preposition.printXml().DocumentElement.OuterXml));
         writer.Close();
     }
     foreach (string file in Directory.GetFiles(@"C:\MBM\Gramadan\BuNaMo\verb"))
     {
         XmlDocument  doc    = new XmlDocument(); doc.Load(file);
         Verb         verb   = new Verb(doc);
         StreamWriter writer = new StreamWriter(@"C:\MBM\Gramadan\BuNaMo2\verb\" + verb.getNickname() + ".xml");
         writer.Write(PrettyPrintXml(verb.printXml().DocumentElement.OuterXml));
         writer.Close();
     }
 }