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);
        }
        public static bool Check(LexRecord lexRecord, HashSet <string> notBaseFormSet)

        {
            bool          validFlag = true;
            List <string> abbList   = lexRecord.GetAbbreviations();
            string        abbCat    = lexRecord.GetCategory();

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

            {
                string abb = (string)abbList[i];

                int    index1 = abb.IndexOf("|", StringComparison.Ordinal);
                string abbCit = "";
                string abbEui = "";
                if (index1 > 0)

                {
                    abbCit = abb.Substring(0, index1);
                    abbEui = abb.Substring(index1 + 1);
                }
                else

                {
                    abbCit = abb;
                }

                string citCat = abbCit + "|" + abbCat;

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

                if (euisByCitCat == null)

                {
                    if (abbEui.Length > 0)

                    {
                        abbList[i] = abbCit;

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

                    {
                        validFlag = false;

                        if (!notBaseFormSet.Contains(citCat))

                        {
                            ErrMsgUtilLexicon.AddContentErrMsg(4, 4, abb + " - New", lexRecord);
                        }
                    }
                }
                else if (euisByCitCat.Count == 1)

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

                    {
                        if (euisByCitCat.Contains(abbEui) != true)

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

                    {
                        string newAbb = abb + "|" + newEui;
                        abbList[i] = newAbb;

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

                {
                    List <string> euiList = new List <string>(euisByCitCat);
                    if (abbEui.Length > 0)

                    {
                        if (euisByCitCat.Contains(abbEui) != true)

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

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


            return(validFlag);
        }