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); } }
/// <summary> /// Create a new <see cref="JapanesePartOfSpeechStopFilter"/>. /// </summary> /// <param name="version">The Lucene match version.</param> /// <param name="input">The <see cref="TokenStream"/> to consume.</param> /// <param name="stopTags">The part-of-speech tags that should be removed.</param> public JapanesePartOfSpeechStopFilter(LuceneVersion version, TokenStream input, ISet <string> stopTags) : base(version, input) { this.stopTags = stopTags; this.posAtt = AddAttribute <IPartOfSpeechAttribute>(); }