Exemple #1
0
 public CatEntry(string cat)
 {
     if (cat.Equals("verb"))
     {
         verbEntry_ = new VerbEntry();
     }
     else if (cat.Equals("noun"))
     {
         nounEntry_ = new NounEntry();
     }
     else if (cat.Equals("adj"))
     {
         adjEntry_ = new AdjEntry();
     }
     else if (cat.Equals("adv"))
     {
         advEntry_ = new AdvEntry();
     }
     else if (cat.Equals("aux"))
     {
         auxEntry_ = new AuxEntry();
     }
     else if (cat.Equals("modal"))
     {
         modalEntry_ = new ModalEntry();
     }
     else if (cat.Equals("pron"))
     {
         pronEntry_ = new PronEntry();
     }
     else if (cat.Equals("det"))
     {
         detEntry_ = new DetEntry();
     }
 }
Exemple #2
0
        /**
         * extract noun information from NIH NounEntry record, and add to a
         * simplenlg WordElement For now just extract whether count/non-count and
         * whether proper or not
         *
         * @param wordElement
         * @param nounEntry
         */
        private void addNounInfo(WordElement wordElement, NounEntry nounEntry)
        {
            bool proper = nounEntry.IsProper();
            // bool nonCountVariant = false;
            // bool regVariant = false;

            // add the inflectional variants
            List <string> variants = nounEntry.GetVariants();

            if (variants.Count > 0)
            {
                IList <Inflection> wordVariants = new List <Inflection>();

                foreach (string v in variants)
                {
                    int    index = v.IndexOf("|", StringComparison.Ordinal);
                    string code;

                    if (index > -1)
                    {
                        code = v.Substring(0, index).ToLower().Trim();
                    }
                    else
                    {
                        code = v.ToLower().Trim();
                    }

                    Inflection?infl = Inflection.REGULAR.getInflCode(code);

                    if (infl != null)
                    {
                        wordVariants.Add((Inflection)infl);
                        wordElement.addInflectionalVariant((Inflection)infl);
                    }
                }

                // if the variants include "reg", this is the default, otherwise just a random pick
                Inflection defaultVariant = wordVariants.Contains(Inflection.REGULAR) || wordVariants.Count == 0 ? Inflection.REGULAR : wordVariants[0];
                wordElement.setFeature(LexicalFeature.DEFAULT_INFL, defaultVariant);
                wordElement.setDefaultInflectionalVariant(defaultVariant);
            }

            // for (String variant : variants) {
            // if (variant.startsWith("uncount")
            // || variant.startsWith("groupuncount"))
            // nonCountVariant = true;
            //
            // if (variant.startsWith("reg"))
            // regVariant = true;
            // // ignore other variant info
            // }

            // lots of words have both "reg" and "unCount", indicating they
            // can be used in either way. Regard such words as normal,
            // only flag as nonCount if unambiguous
            // wordElement.setFeature(LexicalFeature.NON_COUNT, nonCountVariant && !regVariant);
            wordElement.setFeature(LexicalFeature.PROPER, proper);
            // ignore (for now) other info in record
        }
Exemple #3
0
        public CatEntryGJdV(LexRecord lexRecord)

        {
            string cat = lexRecord.GetCategory();

            if (cat.Equals("verb"))

            {
                verbEntry_ = new VerbEntry(lexRecord);
            }
            else if (cat.Equals("noun"))

            {
                nounEntry_ = new NounEntry(lexRecord);
            }
            else if (cat.Equals("adj"))

            {
                adjEntry_ = new AdjEntry(lexRecord);
            }
            else if (cat.Equals("adv"))

            {
                advEntry_ = new AdvEntry(lexRecord);
            }
            else if (cat.Equals("aux"))

            {
                auxEntry_ = new AuxEntry(lexRecord);
            }
            else if (cat.Equals("modal"))

            {
                modalEntry_ = new ModalEntry(lexRecord);
            }
            else if (cat.Equals("pron"))

            {
                pronEntry_ = new PronEntry(lexRecord);
            }
            else if (cat.Equals("det"))

            {
                detEntry_ = new DetEntry(lexRecord);
            }
        }