Class SingleLabelFilterBase
- java.lang.Object
-
- org.carrot2.attrs.AttrComposite
-
- org.carrot2.text.preprocessing.filter.ContextLabelFilter
-
- org.carrot2.text.preprocessing.filter.SingleLabelFilterBase
-
- All Implemented Interfaces:
AcceptingVisitor
- Direct Known Subclasses:
GenitiveLabelFilter
,MinLengthLabelFilter
,NumericLabelFilter
,QueryLabelFilter
,StopLabelFilter
,StopWordLabelFilter
public abstract class SingleLabelFilterBase extends ContextLabelFilter
A base forContextLabelFilter
implementations that handle each label independently.
-
-
Field Summary
-
Fields inherited from class org.carrot2.text.preprocessing.filter.ContextLabelFilter
enabled
-
Fields inherited from class org.carrot2.attrs.AttrComposite
attributes
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods 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.-
Methods inherited from class org.carrot2.text.preprocessing.filter.ContextLabelFilter
isEnabled
-
Methods inherited from class org.carrot2.attrs.AttrComposite
accept
-
-
-
-
Method Detail
-
filter
public void filter(PreprocessingContext context, boolean[] acceptedStems, boolean[] acceptedPhrases)
Description copied from class:ContextLabelFilter
Called to perform label filtering.- Specified by:
filter
in classContextLabelFilter
- 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
public abstract boolean acceptWord(PreprocessingContext context, int wordIndex)
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
public abstract boolean acceptPhrase(PreprocessingContext context, int phraseIndex)
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
-
-