Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            LexRecord lexRec = new LexRecord();

            lexRec.SetBase("123");
            lexRec.SetCat("noun");
            lexRec.GetCatEntry().GetNounEntry().AddVariant("irreg|123||");
            lexRec.GetCatEntry().GetNounEntry().AddVariant("group(irreg|123|222|)");
            Console.WriteLine("----------------");
            Console.WriteLine(lexRec.GetText());
            Console.WriteLine("----------------");
            InflVarsAndAgreements inflVars   = lexRec.GetInflVarsAndAgreements();
            List <InflVar>        inflValues = inflVars.GetInflValues();

            for (int i = 0; i < inflValues.Count; i++)
            {
                InflVar inflectionVar = inflValues[i];
                Console.WriteLine(inflectionVar.GetVar() + "|" + inflectionVar.GetCat() + "|" +
                                  inflectionVar.GetInflection() + "|" + inflectionVar.GetUnInfl() + "|" +
                                  inflectionVar.GetCit() + "|" + inflectionVar.GetType());
            }
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)

        {
            if ((args.Length == 0) || (args.Length > 2))

            {
                Console.Error.WriteLine("** Usage: java ToJavaObjectFromXmlFile <inFile(Xml)> <-i>");
                Console.Error.WriteLine("");
                Console.Error.WriteLine("Options:");
                Console.Error.WriteLine("  -i: generate inflection vars");
                Environment.Exit(1);
            }

            bool inflVarFlag = false;

            for (int i = 0; i < args.Length; i++)

            {
                if (args[i].Equals("-i"))

                {
                    inflVarFlag = true;
                    break;
                }
            }

            try

            {
                List <LexRecord> lexRecords = ToJavaObjApi.ToJavaObjsFromXmlFile(args[0]);
                if (lexRecords.Count <= 0)

                {
                    Environment.Exit(1);
                }
                else

                {
                    for (int i = 0; i < lexRecords.Count; i++)

                    {
                        LexRecord lexRecord = (LexRecord)lexRecords[i];
                        Console.Write(lexRecord.GetText());
                        if (inflVarFlag == true)

                        {
                            Console.WriteLine("---------- Inflection Vars ----------");

                            List <InflVar> inflVars = lexRecord.GetInflVarsAndAgreements().GetInflValues();
                            for (int j = 0; j < inflVars.Count; j++)

                            {
                                InflVar inflVar = (InflVar)inflVars[j];
                                Console.WriteLine(inflVar.GetVar() + "|" + Category.ToValue(inflVar.GetCat()) + "|" +
                                                  Inflection.ToValue(inflVar.GetInflection()) + "|" + inflVar.GetEui() +
                                                  "|" + inflVar.GetUnInfl() + "|" + inflVar.GetCit());
                            }
                        }
                    }
                }
            }
            catch (Exception e)

            {
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
            }
        }