gov.sandia.cognition.text.term.filter
Class StringEvaluatorSingleTermFilter

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.text.term.filter.AbstractSingleTermFilter
          extended by gov.sandia.cognition.text.term.filter.StringEvaluatorSingleTermFilter
All Implemented Interfaces:
SingleTermFilter, TermFilter, CloneableSerializable, Serializable, Cloneable

public class StringEvaluatorSingleTermFilter
extends AbstractSingleTermFilter

Adapts an evaluator from string to string to be a term filter on individual terms.

Since:
3.0
Author:
Justin Basilico
See Also:
Serialized Form

Field Summary
protected  Evaluator<String,String> evaluator
          The evaluator to adapt.
 
Constructor Summary
StringEvaluatorSingleTermFilter()
          Creates a new StringEvaluatorSingleTermFilter with a null evaluator.
StringEvaluatorSingleTermFilter(Evaluator<String,String> evaluator)
          Creates a new StringEvaluatorSingleTermFilter with a given evaluator.
 
Method Summary
 TermOccurrence filterTerm(TermOccurrence occurrence)
          Takes a single term occurrence and filters that occurrence into a new occurrence or returns null, indicating that the filter rejects that term.
 Evaluator<String,String> getEvaluator()
          Gets the evaluator being used as a filter.
 void setEvaluator(Evaluator<String,String> evaluator)
          Sets the evaluator being used as a filter.
 
Methods inherited from class gov.sandia.cognition.text.term.filter.AbstractSingleTermFilter
filterTerms
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Field Detail

evaluator

protected Evaluator<String,String> evaluator
The evaluator to adapt.

Constructor Detail

StringEvaluatorSingleTermFilter

public StringEvaluatorSingleTermFilter()
Creates a new StringEvaluatorSingleTermFilter with a null evaluator.


StringEvaluatorSingleTermFilter

public StringEvaluatorSingleTermFilter(Evaluator<String,String> evaluator)
Creates a new StringEvaluatorSingleTermFilter with a given evaluator.

Parameters:
evaluator - The evaluator to use.
Method Detail

filterTerm

public TermOccurrence filterTerm(TermOccurrence occurrence)
Description copied from interface: SingleTermFilter
Takes a single term occurrence and filters that occurrence into a new occurrence or returns null, indicating that the filter rejects that term.

Parameters:
occurrence - The term occurrence to filter.
Returns:
A term occurrence (may be a new instance or the same as the given one) of the term to replace the given one or null to indicate that the filter has rejected the given term.

getEvaluator

public Evaluator<String,String> getEvaluator()
Gets the evaluator being used as a filter.

Returns:
The evaluator.

setEvaluator

public void setEvaluator(Evaluator<String,String> evaluator)
Sets the evaluator being used as a filter.

Parameters:
evaluator - The evaluator.