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.
  • Constructor Details

  • 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 interface LabelFilter
      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