public final class PatternKeywordMarkerFilter extends KeywordMarkerFilter
KeywordAttribute
. Each token
that matches the provided pattern is marked as a keyword by setting
KeywordAttribute.setKeyword(boolean)
to true
.AttributeSource.State
Modifier and Type | Field and Description |
---|---|
private java.util.regex.Matcher |
matcher |
private CharTermAttribute |
termAtt |
input
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
Constructor and Description |
---|
PatternKeywordMarkerFilter(TokenStream in,
java.util.regex.Pattern pattern)
Create a new
PatternKeywordMarkerFilter , that marks the current
token as a keyword if the tokens term buffer matches the provided
Pattern via the KeywordAttribute . |
Modifier and Type | Method and Description |
---|---|
protected boolean |
isKeyword() |
incrementToken
close, end, reset
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString
private final CharTermAttribute termAtt
private final java.util.regex.Matcher matcher
public PatternKeywordMarkerFilter(TokenStream in, java.util.regex.Pattern pattern)
PatternKeywordMarkerFilter
, that marks the current
token as a keyword if the tokens term buffer matches the provided
Pattern
via the KeywordAttribute
.in
- TokenStream to filterpattern
- the pattern to apply to the incoming term bufferprotected boolean isKeyword()
isKeyword
in class KeywordMarkerFilter