Package org.apache.lucene.tests.analysis
Class MockTokenFilter
- java.lang.Object
-
- org.apache.lucene.util.AttributeSource
-
- org.apache.lucene.analysis.TokenStream
-
- org.apache.lucene.analysis.TokenFilter
-
- org.apache.lucene.tests.analysis.MockTokenFilter
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Unwrappable<TokenStream>
public final class MockTokenFilter extends TokenFilter
A tokenfilter for testing that removes terms accepted by a DFA.- Union a list of singletons to act like a stopfilter.
- Use the complement to act like a keepwordfilter
- Use a regex like
.{12,}
to act like a lengthfilter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.util.AttributeSource
AttributeSource.State
-
-
Field Summary
Fields Modifier and Type Field Description static CharacterRunAutomaton
EMPTY_STOPSET
Empty set of stopwordsstatic CharacterRunAutomaton
ENGLISH_STOPSET
Set of common english stopwords-
Fields inherited from class org.apache.lucene.analysis.TokenFilter
input
-
Fields inherited from class org.apache.lucene.analysis.TokenStream
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
-
-
Constructor Summary
Constructors Constructor Description MockTokenFilter(TokenStream input, CharacterRunAutomaton filter)
Create a new MockTokenFilter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
end()
boolean
incrementToken()
void
reset()
-
Methods inherited from class org.apache.lucene.analysis.TokenFilter
close, unwrap
-
Methods inherited from class org.apache.lucene.util.AttributeSource
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString
-
-
-
-
Field Detail
-
EMPTY_STOPSET
public static final CharacterRunAutomaton EMPTY_STOPSET
Empty set of stopwords
-
ENGLISH_STOPSET
public static final CharacterRunAutomaton ENGLISH_STOPSET
Set of common english stopwords
-
-
Constructor Detail
-
MockTokenFilter
public MockTokenFilter(TokenStream input, CharacterRunAutomaton filter)
Create a new MockTokenFilter.- Parameters:
input
- TokenStream to filterfilter
- DFA representing the terms that should be removed.
-
-
Method Detail
-
incrementToken
public boolean incrementToken() throws IOException
- Specified by:
incrementToken
in classTokenStream
- Throws:
IOException
-
end
public void end() throws IOException
- Overrides:
end
in classTokenFilter
- Throws:
IOException
-
reset
public void reset() throws IOException
- Overrides:
reset
in classTokenFilter
- Throws:
IOException
-
-