예제 #1
0
        private void assertPartsOfSpeech(String input, params String[] partsOfSpeech)
        {
            TokenStream ts = analyzer.GetTokenStream("ignored", input);

            try
            {
                IPartOfSpeechAttribute partOfSpeechAtt = ts.AddAttribute <IPartOfSpeechAttribute>();
                ts.Reset();
                foreach (String partOfSpeech in partsOfSpeech)
                {
                    assertTrue(ts.IncrementToken());
                    assertEquals(partOfSpeech, partOfSpeechAtt.GetPartOfSpeech());
                }
                assertFalse(ts.IncrementToken());
                ts.End();
            }
            finally
            {
                IOUtils.DisposeWhileHandlingException(ts);
            }
        }
예제 #2
0
        protected override bool Accept()
        {
            string pos = posAtt.GetPartOfSpeech();

            return(pos is null || !stopTags.Contains(pos));
        }