Ejemplo n.º 1
0
        public virtual void Update(LexRecord lexObj, string token)

        {
            int    index    = token.IndexOf("\t", StringComparison.Ordinal);
            string negative = token.Substring(index + 1);

            lexObj.GetCatEntry().GetAdvEntry().SetNegative(negative);
        }
Ejemplo n.º 2
0
        /**
         * check if this record has a standard (regular) inflection
         *
         * @param record
         * @param simplenlg
         *            syntactic category
         * @return true if standard (regular) inflection
         */
        private bool standardInflections(LexRecord record, LexicalCategory category)
        {
            List <string> variants = null;

            switch (category.GetLexicalCategory())
            {
            case LexicalCategory.LexicalCategoryEnum.NOUN:
                variants = record.GetCatEntry().GetNounEntry().GetVariants();
                break;

            case LexicalCategory.LexicalCategoryEnum.ADJECTIVE:
                variants = record.GetCatEntry().GetAdjEntry().GetVariants();
                break;

            case LexicalCategory.LexicalCategoryEnum.ADVERB:
                variants = record.GetCatEntry().GetAdvEntry().GetVariants();
                break;

            case LexicalCategory.LexicalCategoryEnum.MODAL:
                variants = record.GetCatEntry().GetModalEntry().GetVariant();
                break;

            case LexicalCategory.LexicalCategoryEnum.VERB:
                if (record.GetCatEntry().GetVerbEntry() != null)     // aux verbs (eg  be) won't  have verb entries
                {
                    variants = record.GetCatEntry().GetVerbEntry().GetVariants();
                }
                break;
            }

            return(variants != null && variants.Contains("reg"));
        }
Ejemplo n.º 3
0
        /**
         * check if this record has a standard (regular) inflection
         *
         * @param record
         * @param simplenlg
         *            syntactic category
         * @return true if standard (regular) inflection
         */

        private bool standardInflections(LexRecord record, LexicalCategory category)
        {
            List <string> variants = null;

            switch (((LexicalCategory)category).lexType)
            {
            case LexicalCategoryEnum.NOUN:
                variants = record.GetCatEntry().GetNounEntry().GetVariants();
                break;

            case LexicalCategoryEnum.ADJECTIVE:
                variants = record.GetCatEntry().GetAdjEntry().GetVariants();
                break;

            case LexicalCategoryEnum.ADVERB:
                variants = record.GetCatEntry().GetAdvEntry().GetVariants();
                break;

            case LexicalCategoryEnum.MODAL:
                variants = record.GetCatEntry().GetModalEntry().GetVariant();
                break;

            case LexicalCategoryEnum.VERB:
                if (record.GetCatEntry().GetVerbEntry() != null)     // aux verbs (eg
                // be) won't
                // have verb
                // entries
                {
                    variants = record.GetCatEntry().GetVerbEntry().GetVariants();
                }
                break;
            }

            return(notEmpty(variants) && variants.contains("reg"));
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        private static bool CheckVerbComplNum(LexRecord lexObj)

        {
            bool      flag      = false;
            VerbEntry verbEntry = lexObj.GetCatEntry().GetVerbEntry();

            if ((verbEntry.GetIntran().Count > 0) || (verbEntry.GetTran().Count > 0) ||
                (verbEntry.GetDitran().Count > 0) || (verbEntry.GetLink().Count > 0) ||
                (verbEntry.GetCplxtran().Count > 0))


            {
                flag = true;
            }

            return(flag);
        }
Ejemplo n.º 6
0
        public virtual void Update(LexRecord lexObj, string token)

        {
            lexObj.GetCatEntry().GetNounEntry().SetProper(token.Equals("\tproper"));
        }
Ejemplo n.º 7
0
        public virtual void Update(LexRecord lexObj, string token)

        {
            lexObj.GetCatEntry().GetVerbEntry().AddVariant(token);
        }
        public virtual void Update(LexRecord lexObj, string token)

        {
            lexObj.GetCatEntry().GetNounEntry().SetTradeMark(token.Equals("\ttrademark"));
        }
Ejemplo n.º 9
0
        public virtual void Update(LexRecord lexObj, string token)

        {
            lexObj.GetCatEntry().GetAdjEntry().SetStative(token.Equals("\tstative"));
        }
Ejemplo n.º 10
0
        public virtual void Update(LexRecord lexObj, string token)

        {
            lexObj.GetCatEntry().GetVerbEntry().AddIntran(token.Trim());
        }
Ejemplo n.º 11
0
        public virtual void Update(LexRecord lexObj, string token)

        {
            lexObj.GetCatEntry().GetNounEntry().AddCompl(token);
        }
Ejemplo n.º 12
0
        /**
         * make a WordElement from a lexical record. Currently just specifies basic
         * params and inflections Should do more in the future!
         *
         * @param record
         * @return
         */
        private WordElement makeWord(LexRecord record) // LexRecord
        {
            // get basic data
            String          baseForm = record.GetBase();
            LexicalCategory category = record.GetSimpleNLGCategory(record);
            String          id       = record.GetEui();

            // create word class
            WordElement wordElement = new WordElement(baseForm, category, id);

            // now add type information
            switch (category.GetLexicalCategory())
            {
            case LexicalCategory.LexicalCategoryEnum.ADJECTIVE:
                addAdjectiveInfo(wordElement, record.GetCatEntry().GetAdjEntry());
                break;

            case LexicalCategory.LexicalCategoryEnum.ADVERB:
                addAdverbInfo(wordElement, record.GetCatEntry().GetAdvEntry());
                break;

            case LexicalCategory.LexicalCategoryEnum.NOUN:
                addNounInfo(wordElement, record.GetCatEntry().GetNounEntry());
                break;

            case LexicalCategory.LexicalCategoryEnum.VERB:
                addVerbInfo(wordElement, record.GetCatEntry().GetVerbEntry());
                break;
                // ignore closed class words
            }

            Inflection?defaultInfl = wordElement.getDefaultInflectionalVariant();

            // now add inflected forms
            // if (keepStandardInflections || !standardInflections(record,
            // category)) {
            foreach (InflVar inflection in record.GetInflVarsAndAgreements().GetInflValues())
            {
                String simplenlgInflection = getSimplenlgInflection(inflection
                                                                    .GetInflection());

                if (simplenlgInflection != null)
                {
                    String     inflectedForm = inflection.GetVar();
                    Inflection?inflType      = Inflection.REGULAR.getInflCode(inflection.GetType());

                    // store all inflectional variants, except for regular ones
                    // unless explicitly set
                    if (inflType != null &&
                        !(Inflection.REGULAR == inflType && !keepStandardInflections))
                    {
                        wordElement.addInflectionalVariant((Inflection)inflType,
                                                           simplenlgInflection, inflectedForm);
                    }

                    // if the infl variant is the default, also set this feature on
                    // the word
                    if (defaultInfl == null ||
                        (defaultInfl.Equals(inflType) && !(Inflection.REGULAR.Equals(inflType) && !keepStandardInflections)))
                    {
                        wordElement.setFeature(simplenlgInflection, inflectedForm);
                    }

                    // wordElement
                    // .setFeature(simplenlgInflection, inflection.GetVar());
                }
            }
            // }

            // add acronym info
            addAcronymInfo(wordElement, record);

            // now add spelling variants
            addSpellingVariants(wordElement, record);

            return(wordElement);
        }
Ejemplo n.º 13
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);
        }
        public virtual void Update(LexRecord lexObj, string token)

        {
            lexObj.GetCatEntry().GetAdvEntry().AddModification(token);
        }
        public virtual void Update(LexRecord lexObj, string token)

        {
            lexObj.GetCatEntry().GetDetEntry().SetInterrogative(token.Equals("\tinterrogative"));
        }
        public virtual void Update(LexRecord lexObj, string token)

        {
            lexObj.GetCatEntry().GetAdjEntry().AddNominalization(token);
        }
Ejemplo n.º 17
0
        public virtual void Update(LexRecord lexObj, string token)

        {
            lexObj.GetCatEntry().GetPronEntry().SetGender(token);
        }
Ejemplo n.º 18
0
        public virtual void Update(LexRecord lexObj, string token)

        {
            lexObj.GetCatEntry().GetDetEntry().SetVariants(token);
        }
Ejemplo n.º 19
0
        public virtual void Update(LexRecord lexObj, string token)

        {
            lexObj.GetCatEntry().GetPronEntry().AddType(token);
        }