org.carrot2.text.preprocessing.filter
Class SingleLabelFilterBase

java.lang.Object
  extended by org.carrot2.text.preprocessing.filter.SingleLabelFilterBase
All Implemented Interfaces:
ILabelFilter
Direct Known Subclasses:
GenitiveLabelFilter, MinLengthLabelFilter, NumericLabelFilter, QueryLabelFilter, StopLabelFilter, StopWordLabelFilter

public abstract class SingleLabelFilterBase
extends Object
implements ILabelFilter

A base for ILabelFilter implementations that handle each label independently.


Constructor Summary
SingleLabelFilterBase()
           
 
Method Summary
abstract  boolean acceptPhrase(PreprocessingContext context, int phraseIndex)
          Should return true if the phrase located at phraseIndex is to be accepted, false otherwise.
abstract  boolean acceptWord(PreprocessingContext context, int wordIndex)
          Should return true if the word located at wordIndex is to be accepted, false otherwise.
 void filter(PreprocessingContext context, boolean[] acceptedStems, boolean[] acceptedPhrases)
          Called to perform label filtering.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.carrot2.text.preprocessing.filter.ILabelFilter
isEnabled
 

Constructor Detail

SingleLabelFilterBase

public SingleLabelFilterBase()
Method Detail

filter

public void filter(PreprocessingContext context,
                   boolean[] acceptedStems,
                   boolean[] acceptedPhrases)
Description copied from interface: ILabelFilter
Called to perform label filtering.

Specified by:
filter in interface ILabelFilter
Parameters:
context - contains words and phrases to be filtered
acceptedStems - the filter should set to false those elements that correspond to the stems to be filtered out
acceptedPhrases - the filter should set to false those elements that correspond to the phrases to be filtered out

acceptWord

public abstract boolean acceptWord(PreprocessingContext context,
                                   int wordIndex)
Should return true if the word located at wordIndex is to be accepted, false otherwise.

Parameters:
context - provides access to all information about the word
wordIndex - index of the word for which decision is to be made

acceptPhrase

public abstract boolean acceptPhrase(PreprocessingContext context,
                                     int phraseIndex)
Should return true if the phrase located at phraseIndex is to be accepted, false otherwise.

Parameters:
context - provides access to all information about the phrase
phraseIndex - index of the phrase for which decision is to be made


Copyright (c) Dawid Weiss, Stanislaw Osinski