Beispiel #1
0
        public static bool CheckGlreg(LexRecord lexRecord, string inBase, int contentType)

        {
            bool   validFlag = true;
            string cat       = lexRecord.GetCategory();

            if (cat.Equals(LexRecordUtil.GetCategory(7)))

            {
                List <string> variants = lexRecord.GetCatEntry().GetNounEntry().GetVariants();

                bool hasGlreg = false;
                for (int i = 0; i < variants.Count; i++)

                {
                    string variant = (string)variants[i];
                    if ((variant.Equals("glreg")) || (variant.Equals("group(glreg)")))


                    {
                        hasGlreg = true;
                        break;
                    }
                }

                if (hasGlreg == true)

                {
                    validFlag = false;
                    for (int j = 0; j < glregEnds_.Count; j++)

                    {
                        string ending = (string)glregEnds_[j];
                        if (inBase.EndsWith(ending, StringComparison.Ordinal) == true)

                        {
                            validFlag = true;
                            break;
                        }
                    }
                }

                if (!validFlag)

                {
                    ErrMsgUtilLexRecord.AddContentErrMsg(contentType, 4, inBase, lexRecord);
                }
            }

            return(validFlag);
        }
Beispiel #2
0
        private static bool IsLegalCat(string nom, string cat)
        {
            bool validFlag = true;

            int    index1 = nom.IndexOf("|", StringComparison.Ordinal);
            int    index2 = nom.IndexOf("|", index1 + 1, StringComparison.Ordinal);
            int    index3 = nom.IndexOf("|", index2 + 1, StringComparison.Ordinal);
            string nomCat = null;

            if (index1 == -1)

            {
                validFlag = false;
            }
            else if (index2 == -1)

            {
                nomCat = nom.Substring(index1 + 1);
            }
            else if (index3 == -1)

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

            {
                validFlag = false;
            }

            string noun = LexRecordUtil.GetCategory(7);
            string adj  = LexRecordUtil.GetCategory(0);
            string verb = LexRecordUtil.GetCategory(10);

            if (!ReferenceEquals(nomCat, null))

            {
                if (cat.Equals(noun))

                {
                    if ((!nomCat.Equals(adj)) && (!nomCat.Equals(verb)))


                    {
                        validFlag = false;
                    }
                }
                else if (cat.Equals(adj) == true)

                {
                    if (!nomCat.Equals(noun))

                    {
                        validFlag = false;
                    }
                }
                else if (cat.Equals(verb) == true)

                {
                    if (!nomCat.Equals(noun))

                    {
                        validFlag = false;
                    }
                }
            }

            return(validFlag);
        }
Beispiel #3
0
        public static bool CheckRegd(LexRecord lexRecord, string inBase, int contentType)

        {
            bool          validFlag = true;
            string        cat       = lexRecord.GetCategory();
            List <string> variants  = new List <string>();

            if (cat.Equals(LexRecordUtil.GetCategory(10)))

            {
                variants = lexRecord.GetCatEntry().GetVerbEntry().GetVariants();
            }
            else if (cat.Equals(LexRecordUtil.GetCategory(0)))

            {
                variants = lexRecord.GetCatEntry().GetAdjEntry().GetVariants();
            }

            if (variants.Count > 0)

            {
                bool hasRegd = false;

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

                {
                    string variant = (string)variants[i];
                    if (variant.Equals("regd") == true)

                    {
                        hasRegd = true;
                        break;
                    }
                }

                if (hasRegd == true)

                {
                    char   lastChar     = InflVarsAndAgreements.GetLastChar(inBase);
                    char   last2Char    = InflVarsAndAgreements.GetLast2Char(inBase);
                    string lastCharStr  = (new char?(lastChar)).ToString();
                    string last2CharStr = (new char?(last2Char)).ToString();


                    if ((!InflVarsAndAgreements.consonants_.Contains(lastCharStr)) ||
                        (!InflVarsAndAgreements.vowels_.Contains(last2CharStr)))


                    {
                        validFlag = false;
                    }
                }

                if (!validFlag)

                {
                    ErrMsgUtilLexRecord.AddContentErrMsg(contentType, 5, inBase, lexRecord);
                }
            }

            return(validFlag);
        }