public final class StopFilter extends TokenFilter
input
Constructor and Description |
---|
StopFilter(TokenStream in,
Set stopWords)
Constructs a filter which removes words from the input
TokenStream that are named in the Set.
|
StopFilter(TokenStream input,
Set stopWords,
boolean ignoreCase)
Construct a token stream filtering the given input.
|
StopFilter(TokenStream input,
String[] stopWords)
Construct a token stream filtering the given input.
|
StopFilter(TokenStream in,
String[] stopWords,
boolean ignoreCase)
Constructs a filter which removes words from the input
TokenStream that are named in the array of words.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getEnablePositionIncrements() |
static boolean |
getEnablePositionIncrementsDefault() |
static Set |
makeStopSet(String[] stopWords)
Builds a Set from an array of stop words,
appropriate for passing into the StopFilter constructor.
|
static Set |
makeStopSet(String[] stopWords,
boolean ignoreCase) |
Token |
next(Token reusableToken)
Returns the next input Token whose term() is not a stop word.
|
void |
setEnablePositionIncrements(boolean enable)
Set to
true to make this StopFilter enable position increments to result tokens. |
static void |
setEnablePositionIncrementsDefault(boolean defaultValue)
Set the default position increments behavior of every StopFilter created from now on.
|
close, reset
next
public StopFilter(TokenStream input, String[] stopWords)
public StopFilter(TokenStream in, String[] stopWords, boolean ignoreCase)
public StopFilter(TokenStream input, Set stopWords, boolean ignoreCase)
stopWords
is an instance of CharArraySet
(true if
makeStopSet()
was used to construct the set) it will be directly used
and ignoreCase
will be ignored since CharArraySet
directly controls case sensitivity.
If stopWords
is not an instance of CharArraySet
,
a new CharArraySet will be constructed and ignoreCase
will be
used to specify the case sensitivity of that set.input
- stopWords
- The set of Stop Words.ignoreCase
- -Ignore case when stopping.public StopFilter(TokenStream in, Set stopWords)
makeStopSet(java.lang.String[])
public static final Set makeStopSet(String[] stopWords)
passing false to ignoreCase
public static final Set makeStopSet(String[] stopWords, boolean ignoreCase)
stopWords
- ignoreCase
- If true, all words are lower cased first.public final Token next(Token reusableToken) throws IOException
next
in class TokenStream
reusableToken
- a Token that may or may not be used to
return; this parameter should never be null (the callee
is not required to check for null before using it, but it is a
good idea to assert that it is not null.)IOException
public static boolean getEnablePositionIncrementsDefault()
public static void setEnablePositionIncrementsDefault(boolean defaultValue)
Note: behavior of a single StopFilter instance can be modified
with setEnablePositionIncrements(boolean)
.
This static method allows control over behavior of classes using StopFilters internally,
for example StandardAnalyzer
.
Default : false.
public boolean getEnablePositionIncrements()
public void setEnablePositionIncrements(boolean enable)
true
to make this StopFilter enable position increments to result tokens.
When set, when a token is stopped (omitted), the position increment of the following token is incremented.
Default: see setEnablePositionIncrementsDefault(boolean)
.
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.