예제 #1
0
        public override int Compare(T o1, T o2)

        {
            if (o1 != null && o2 != null)
            {
                InflVar var1 = o1 as InflVar;
                InflVar var2 = o2 as InflVar;

                int @out = var1.GetEui().CompareTo(var2.GetEui());

                if (@out == 0)

                {
                    @out = var1.GetInflection().Length - var2.GetInflection().Length;
                    if (@out == 0)

                    {
                        @out = var1.GetInflection().CompareTo(var2.GetInflection());
                    }
                }

                if (@out == 0)

                {
                    @out = var1.GetVar().CompareTo(var2.GetVar());
                }

                return(@out);
            }

            return(-1);
        }
예제 #2
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());
            }
        }
예제 #3
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);
            }
        }