public override TokenStream Create(TokenStream input) { if (pattern != null) { input = new PatternKeywordMarkerFilter(input, pattern); } if (protectedWords != null) { input = new SetKeywordMarkerFilter(input, protectedWords); } return input; }
public void TestCustomAttribute() { TokenStream stream = new KeywordTokenizer(new StringReader("D'Angelo")); stream = new PatternKeywordMarkerFilter(stream, new Regex(".*")); stream = new BeiderMorseFilter(stream, new PhoneticEngine(NameType.GENERIC, RuleType.EXACT, true)); IKeywordAttribute keyAtt = stream.AddAttribute <IKeywordAttribute>(); stream.Reset(); int i = 0; while (stream.IncrementToken()) { assertTrue(keyAtt.IsKeyword); i++; } assertEquals(12, i); stream.End(); stream.Dispose(); }