Пример #1
0
        private string[] PosTagTokens(string[] tokens)
        {
            if (mPosTagger == null)
            {
                mPosTagger = new OpenNLP.Tools.PosTagger.EnglishMaximumEntropyPosTagger(mModelPath + @"\EnglishPOS.nbin", mModelPath + @"\Parser\tagdict");
            }

            return(mPosTagger.Tag(tokens));
        }
Пример #2
0
        public IEnumerable <Tuple <string, string> > Tag(string input)
        {
            var tokens = Tokenize(input).Distinct().ToArray();
            var tagger = new OpenNLP.Tools.PosTagger.EnglishMaximumEntropyPosTagger("Resources/EnglishPOS.nbin", "Resources/tagdict");

            var tags = tagger.Tag(tokens);

            return(tokens.Zip(tags, (s, s1) => new Tuple <string, string>(s, s1)));
        }
Пример #3
0
        private List <Word> PosTagTokens(string[] tokens)
        {
            if (mPosTagger == null)
            {
                mPosTagger = new OpenNLP.Tools.PosTagger.EnglishMaximumEntropyPosTagger(mModelPath + "EnglishPOS.nbin", mModelPath + @"\Parser\tagdict");
            }

            string[]    Tags     = mPosTagger.Tag(tokens);
            List <Word> lstWords = new List <Word>();

            for (int i = 0; i < tokens.Length; i++)
            {
                Word wd = new Word();
                wd.Key = tokens[i];
                wd.Tag = Tags[i];
                lstWords.Add(wd);
            }

            return(lstWords);
        }
Пример #4
0
 static string[] PosTagging(string[] text)
 {
     return(mPosTagger.Tag(text));
 }