Class SingleLabelFilterBase
java.lang.Object
org.carrot2.attrs.AttrComposite
org.carrot2.text.preprocessing.filter.SingleLabelFilterBase
- All Implemented Interfaces:
AcceptingVisitor
,LabelFilter
- Direct Known Subclasses:
GenitiveLabelFilter
,MinLengthLabelFilter
,NumericLabelFilter
,QueryLabelFilter
,StopLabelFilter
,StopWordLabelFilter
public abstract class SingleLabelFilterBase extends AttrComposite implements LabelFilter
A base for
LabelFilter
implementations that handle each label independently.-
Field Summary
-
Constructor Summary
Constructors Constructor Description SingleLabelFilterBase()
-
Method Summary
Modifier and Type Method Description abstract boolean
acceptPhrase(PreprocessingContext context, int phraseIndex)
Should returntrue
if the phrase located atphraseIndex
is to be accepted,false
otherwise.abstract boolean
acceptWord(PreprocessingContext context, int wordIndex)
Should returntrue
if the word located atwordIndex
is to be accepted,false
otherwise.void
filter(PreprocessingContext context, boolean[] acceptedStems, boolean[] acceptedPhrases)
Called to perform label filtering.
-
Constructor Details
-
SingleLabelFilterBase
public SingleLabelFilterBase()
-
-
Method Details
-
filter
public void filter(PreprocessingContext context, boolean[] acceptedStems, boolean[] acceptedPhrases)Description copied from interface:LabelFilter
Called to perform label filtering.- Specified by:
filter
in interfaceLabelFilter
- Parameters:
context
- contains words and phrases to be filteredacceptedStems
- the filter should set tofalse
those elements that correspond to the stems to be filtered outacceptedPhrases
- the filter should set tofalse
those elements that correspond to the phrases to be filtered out
-
acceptWord
Should returntrue
if the word located atwordIndex
is to be accepted,false
otherwise.- Parameters:
context
- provides access to all information about the wordwordIndex
- index of the word for which decision is to be made
-
acceptPhrase
Should returntrue
if the phrase located atphraseIndex
is to be accepted,false
otherwise.- Parameters:
context
- provides access to all information about the phrasephraseIndex
- index of the phrase for which decision is to be made
-