예제 #1
0
        public static List<string> GetListFromLexRecord(LexRecord lexRecord, int contentType)
        {
            List<string> outList = new List<string>();
            switch (contentType)

            {
                case 2:
                    outList = lexRecord.GetSpellingVars();
                    break;
                case 5:
                    outList = lexRecord.GetVariants();
                    break;
                case 6:
                    outList = lexRecord.GetNominalizations();
                    break;
                case 7:
                    outList = lexRecord.GetAbbreviations();
                    break;
                case 8:
                    outList = lexRecord.GetAcronyms();
                    break;
            }

            return outList;
        }
예제 #2
0
        public LexRecordNomObj(LexRecord lexRecord)

        {
            if (lexRecord != null)

            {
                base_            = lexRecord.GetBase();
                eui_             = lexRecord.GetEui();
                category_        = lexRecord.GetCategory();
                nominalizations_ = lexRecord.GetNominalizations();
            }
        }
예제 #3
0
        private static bool CheckNomCat(LexRecord lexRecord)
        {
            bool          validFlag = true;
            string        cat       = lexRecord.GetCategory();
            List <string> nomList   = lexRecord.GetNominalizations();


            foreach (string nom in nomList)

            {
                if (!IsLegalCat(nom, cat))

                {
                    validFlag = false;
                    ErrMsgUtilLexRecord.AddContentErrMsg(6, 10, nom, lexRecord);
                }
            }

            return(validFlag);
        }
예제 #4
0
        public static void SetItemInListInLexRecordAt(LexRecord lexRecord, int contentType, string item, int index)
        {
            switch (contentType)

            {
                case 2:
                    lexRecord.GetSpellingVars()[index] = item;
                    break;
                case 5:
                    lexRecord.GetVariants()[index] = item;
                    break;
                case 6:
                    lexRecord.GetNominalizations()[index] = item;
                    break;
                case 7:
                    lexRecord.GetAbbreviations()[index] = item;
                    break;
                case 8:
                    lexRecord.GetAcronyms()[index] = item;
                    break;
            }
        }
예제 #5
0
        public static bool Check(LexRecord lexRecord)

        {
            bool          validFlag = true;
            List <string> nomList   = lexRecord.GetNominalizations();

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

            {
                string nom = (string)nomList[i];

                int    index1 = nom.IndexOf("|", StringComparison.Ordinal);
                int    index2 = nom.IndexOf("|", index1 + 1, StringComparison.Ordinal);
                string nomCit = nom.Substring(0, index1);
                string nomCat = "";
                string nomEui = "";
                if (index2 > 0)

                {
                    nomCat = nom.Substring(index1 + 1, index2 - (index1 + 1));
                    nomEui = nom.Substring(index2 + 1);
                }
                else

                {
                    nomCat = nom.Substring(index1 + 1);
                }

                string citCat = nomCit + "|" + nomCat;

                HashSet <string> euisByCit = CrossCheckDupLexRecords.GetEuisByCitCat(citCat);

                if (euisByCit == null)

                {
                    if (nomEui.Length > 0)

                    {
                        nomList[i] = citCat;

                        validFlag = false;
                        ErrMsgUtilLexicon.AddContentErrMsg(3, 3, nom + " - None", lexRecord);
                    }
                    else

                    {
                        validFlag = false;
                        ErrMsgUtilLexicon.AddContentErrMsg(3, 4, nom + " - New", lexRecord);
                    }
                }
                else if (euisByCit.Count == 1)

                {
                    List <string> euiList = new List <string>(euisByCit);
                    string        newEui  = (string)euiList[0];
                    if (nomEui.Length > 0)

                    {
                        if (euisByCit.Contains(nomEui) != true)

                        {
                            validFlag = false;
                            ErrMsgUtilLexicon.AddContentErrMsg(3, 6, nom + " - " + newEui, lexRecord);
                        }
                    }
                    else

                    {
                        string newNom = nom + "|" + newEui;
                        nomList[i] = newNom;

                        validFlag = false;
                        ErrMsgUtilLexicon.AddContentErrMsg(3, 5, nom + " - " + newEui, lexRecord);
                    }
                }
                else

                {
                    List <string> euiList = new List <string>(euisByCit);
                    if (nomEui.Length > 0)

                    {
                        if (euisByCit.Contains(nomEui) != true)

                        {
                            validFlag = false;
                            ErrMsgUtilLexicon.AddContentErrMsg(3, 8, nom + " - " + euiList, lexRecord);
                        }
                    }
                    else

                    {
                        validFlag = false;
                        ErrMsgUtilLexicon.AddContentErrMsg(3, 7, nom + " - " + euiList, lexRecord);
                    }
                }
            }


            return(validFlag);
        }