public final class SimplePatternTokenizer extends Tokenizer
RegExp or (expert usage) a pre-built determinized Automaton, to locate tokens.
The regexp syntax is more limited than PatternTokenizer, but the tokenization is quite a bit faster. The provided
regex should match valid token characters (not token separator characters, like String.split). The matching is greedy:
the longest match at a given start point will be the next token. Empty string tokens are never produced.AttributeSource.StateDEFAULT_TOKEN_ATTRIBUTE_FACTORY| Constructor and Description |
|---|
SimplePatternTokenizer(AttributeFactory factory,
Automaton dfa)
Runs a pre-built automaton.
|
SimplePatternTokenizer(AttributeFactory factory,
String regexp,
int maxDeterminizedStates)
See
RegExp for the accepted syntax. |
SimplePatternTokenizer(Automaton dfa)
Runs a pre-built automaton.
|
SimplePatternTokenizer(String regexp)
See
RegExp for the accepted syntax. |
| Modifier and Type | Method and Description |
|---|---|
void |
end() |
boolean |
incrementToken() |
void |
reset() |
close, correctOffset, setReaderaddAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toStringpublic SimplePatternTokenizer(String regexp)
RegExp for the accepted syntax.public SimplePatternTokenizer(Automaton dfa)
public SimplePatternTokenizer(AttributeFactory factory, String regexp, int maxDeterminizedStates)
RegExp for the accepted syntax.public SimplePatternTokenizer(AttributeFactory factory, Automaton dfa)
public boolean incrementToken()
throws IOException
incrementToken in class TokenStreamIOExceptionpublic void end()
throws IOException
end in class TokenStreamIOExceptionpublic void reset()
throws IOException
reset in class TokenizerIOExceptionCopyright © 2000-2020 Apache Software Foundation. All Rights Reserved.