Exemplo n.º 1
0
 public string Lemmatize(string sWord)
 {
     if (!lsett.bBuildFrontLemmatizer)
     {
         return(ltrRootNodeSafe.Lemmatize(sWord));
     }
     else
     {
         string sWordFront  = LemmaExample.StringReverse(sWord);
         string sLemmaFront = ltrRootNodeFrontSafe.Lemmatize(sWordFront);
         string sWordRear   = LemmaExample.StringReverse(sLemmaFront);
         return(ltrRootNodeSafe.Lemmatize(sWordRear));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Extended lemamtization interface with more options
        /// </summary>
        /// <param name="sWord">word to be lemmatized</param>
        /// <param name="ignoreCase">If true than casing will be ignored. If set to false, than lemmatizer will match the longest rule it knows but requiering same casing of rule and word.</param>
        /// <param name="sMsd">morpho static descriptor of the word to be lemmatized</param>
        /// <returns>Lemmatized word.</returns>
        public string Lemmatize(string sWord, bool ignoreCase, string sMsd)
        {
            string sNewMsd = sMsd;

            if (sMsd != null && lsett.bUseMsdSplitTreeOptimization && lsett.eMsdConsider == LemmatizerSettings.MsdConsideration.Distinct)
            {
                sNewMsd = msdSplitTree.TransformMsd(sNewMsd);
            }

            if (!lsett.bBuildFrontLemmatizer)
            {
                return(ltrRootNodeSafe.Lemmatize(sWord, ignoreCase, sNewMsd));
            }
            else
            {
                string sWordFront  = LemmaExample.StringReverse(sWord);
                string sLemmaFront = ltrRootNodeFrontSafe.Lemmatize(sWordFront, ignoreCase, sNewMsd);
                string sWordRear   = LemmaExample.StringReverse(sLemmaFront);
                return(ltrRootNodeSafe.Lemmatize(sWordRear, ignoreCase, sNewMsd));
            }
        }
Exemplo n.º 3
0
        public string Lemmatize(string word)
        {
            var wordLower = word.ToLower();

            if (this.Exceptions.ContainsKey(wordLower))
            {
                return(this.Exceptions[wordLower]);
            }

            if (!Lsett.bBuildFrontLemmatizer)
            {
                return(LtrRootNodeSafe.Lemmatize(word));
            }
            else
            {
                string sWordFront  = LemmaExample.StringReverse(word);
                string sLemmaFront = LtrRootNodeFrontSafe.Lemmatize(sWordFront);
                string sWordRear   = LemmaExample.StringReverse(sLemmaFront);
                return(LtrRootNodeSafe.Lemmatize(sWordRear));
            }
        }