//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static void CheckLexRecords(java.util.Vector<gov.nih.nlm.nls.lexCheck.Lib.LexRecord> lexRecords, java.io.BufferedWriter out, java.io.BufferedWriter dupOut, boolean verbose, java.util.Hashtable<String, java.util.HashSet<String>> dupRecExpList, java.util.HashSet<String> notBaseFormSet) throws java.io.IOException
        public static void CheckLexRecords(List <LexRecord> lexRecords, System.IO.StreamWriter @out,
                                           System.IO.StreamWriter dupOut, bool verbose, Dictionary <string, HashSet <string> > dupRecExpList,
                                           HashSet <string> notBaseFormSet)


        {
            if (verbose == true)

            {
                Console.WriteLine("===== Check Lexicon Cross-Ref Contents =====");
            }

            ErrMsgUtil.ResetErrMsg();
            bool validFlag = true;

            bool dupEuiFlag = CrossCheckDupEuis.Check(lexRecords);

            bool dupRecFlag = CrossCheckDupLexRecords.Check(lexRecords, dupRecExpList, dupOut, verbose);

            validFlag = (dupEuiFlag) && (dupRecFlag);

            int recSize = lexRecords.Count;

            for (int i = 0; i < recSize; i++)

            {
                LexRecord lexRecord = (LexRecord)lexRecords[i];

                bool nomFlag = CrossCheckNomEui.Check(lexRecord);


                bool abbFlag = CrossCheckAbbEui.Check(lexRecord, notBaseFormSet);

                bool acrFlag = CrossCheckAcrEui.Check(lexRecord, notBaseFormSet);
                validFlag = (validFlag) && (nomFlag) && (abbFlag) && (acrFlag);

                if (@out != null)

                {
                    string text = lexRecord.GetText();
                    @out.Write(text);
                }
            }

            bool symFlag = CrossCheckNomSym.Check(lexRecords);

            validFlag = (symFlag) && (validFlag);


            if (!validFlag)

            {
                Console.WriteLine(ErrMsgUtil.GetErrMsg());
            }

            Console.WriteLine("----- Total lexRecords checked: " + recSize);
            Console.WriteLine("----- cross-ref content error type stats -----");
            Console.WriteLine(ErrMsgUtilLexicon.GetErrStats());
        }
Esempio n. 2
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static void CheckLexRecords(java.util.Vector<gov.nih.nlm.nls.lexCheck.Lib.LexRecord> lexRecords, java.io.BufferedWriter out, boolean verbose, java.util.HashSet<String> irregExpEuiList) throws Exception
        public static void CheckLexRecords(List <LexRecord> lexRecords, System.IO.StreamWriter @out, bool verbose,
                                           HashSet <string> irregExpEuiList)


        {
            int errRecordNo = 0;
            int okRecordNo  = 0;
            int recSize     = lexRecords.Count;

            if (verbose == true)

            {
                Console.WriteLine("===== Check LexRecord Contents =====");
            }

            if (lexRecords.Count > 0)

            {
                for (int i = 0; i < recSize; i++)

                {
                    LexRecord lexRecord = (LexRecord)lexRecords[i];
                    if (verbose == true)

                    {
                        Console.WriteLine("--- Checking: " + lexRecord.GetEui() + " ---");
                    }

                    if (!StaticCheckLexRecord(lexRecord, irregExpEuiList))

                    {
                        Console.WriteLine(ErrMsgUtil.GetErrMsg());
                        errRecordNo++;
                    }
                    else

                    {
                        okRecordNo++;
                    }

                    if (@out != null)

                    {
                        string text = lexRecord.GetText();
                        @out.Write(text);
                    }
                }
            }

            Console.WriteLine("----- Total lexRecords checked: " + recSize);

            Console.WriteLine("--- lexRecord has no error: " + okRecordNo);
            Console.WriteLine("--- lexRecord has error(s): " + errRecordNo);
            Console.WriteLine("----- content error type stats -----");
            Console.WriteLine(ErrMsgUtilLexRecord.GetErrStats());
        }
        public virtual void SetJavaObjs(List <LexRecord> lexReocrdObjs)

        {
            lexRecordObjs_ = lexReocrdObjs;

            text_ = "";

            if (lexRecordObjs_ != null)

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

                {
                    LexRecord temp = (LexRecord)lexRecordObjs_[i];
                    text_ += temp.GetText();
                }
            }
        }
Esempio n. 4
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);
            }
        }
Esempio n. 5
0
        public static void Main(string[] args)

        {
            string bat = "{base=bat\nentry=E0012112\n\tcat=noun\n\tvariants=reg\nsignature=vanni\n}";

            string molt =
                "{base=molt\nspelling_variant=moult\nentry=E0040723\n\tcat=noun\n\tvariants=reg\n\tacronym_of=test123\n\tabbreviation_of=test456\n\tacronym_of=test789\nsignature=vanni\n}\n{base=molt\nspelling_variant=moult\nentry=E0040724\n\tcat=verb\n\tvariants=reg\n\tintran\n\ttran=np\n\tnominalization=molting|noun|E0412675\nsignature=vanni\n}";

            if (args.Length == 0)

            {
                try

                {
                    LexRecord        lexRecord;
                    List <LexRecord> lexRecords = ToJavaObjsFromText(molt);
                    for (int i = 0; i < lexRecords.Count; i++)

                    {
                        lexRecord = (LexRecord)lexRecords[i];
                        Console.WriteLine(lexRecord.GetText());

                        Console.WriteLine("---------------------------------");
                    }

                    lexRecord = ToJavaObjFromText(molt);
                    Console.WriteLine(lexRecord.GetText());
                }
                catch (Exception e)

                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                }
            }
            else if (args.Length == 1)

            {
                try

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

                    {
                        Environment.Exit(1);
                    }
                    else

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

                        {
                            LexRecord lexRecord = (LexRecord)lexRecords[i];
                            Console.WriteLine(lexRecord.GetText());
                            Console.WriteLine(lexRecord.GetXml());
                            Console.WriteLine("---------------------------------");
                            InflVarsAndAgreements infls = new InflVarsAndAgreements(lexRecord);

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

                            {
                                InflVar inflVar = (InflVar)inflVars[j];
                                Console.WriteLine("unInfl: " + inflVar.GetUnInfl() + "; infl: " +
                                                  inflVar.GetInflection() + "; var: " + inflVar.GetVar());
                            }
                        }
                    }
                }
                catch (Exception e)

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

            {
                Console.Error.WriteLine("*** Usage: java ToJavaObjApi <filename>");
                Environment.Exit(1);
            }
        }