Beispiel #1
0
        public virtual string[] GetLemmas(string word, string tag)
        {
            string partOfSpeech;

            if (tag.StartsWith("N") || tag.StartsWith("n"))
            {
                partOfSpeech = "noun";
            }
            else if (tag.StartsWith("N") || tag.StartsWith("v"))
            {
                partOfSpeech = "verb";
            }
            else if (tag.StartsWith("J") || tag.StartsWith("a"))
            {
                partOfSpeech = "adjective";
            }
            else if (tag.StartsWith("R") || tag.StartsWith("r"))
            {
                partOfSpeech = "adverb";
            }
            else
            {
                partOfSpeech = "noun";
            }

            return(mEngine.GetBaseForms(word, partOfSpeech, mDefaultOperations));
        }
Beispiel #2
0
        public virtual string[] getLemmas(string word, string tag)
        {
            //try
            //{
            string pos;

            if (tag.StartsWith("N") || tag.StartsWith("n"))
            {
                pos = "noun";
            }
            else if (tag.StartsWith("N") || tag.StartsWith("v"))
            {
                pos = "verb";
            }
            else if (tag.StartsWith("J") || tag.StartsWith("a"))
            {
                pos = "adjective";
            }
            else if (tag.StartsWith("R") || tag.StartsWith("r"))
            {
                pos = "adverb";
            }
            else
            {
                pos = "noun";
            }
            //    System.Collections.IList lemmas = morphy.lookupAllBaseForms(pos, word);
            //    return ((string[]) SupportClass.ICollectionSupport.ToArray(lemmas, new string[lemmas.Count]));
            //}
            //catch (JWNLException e)
            //{
            //    e.printStackTrace();
            //    return null;
            //}
            return(mEngine.GetBaseForms(word, pos, morphologicalProcess));
        }