info.ephyra.answerselection.filters
Class DuplicateFilter

java.lang.Object
  extended by info.ephyra.answerselection.filters.Filter
      extended by info.ephyra.answerselection.filters.DuplicateFilter

public class DuplicateFilter
extends Filter

The DuplicateFilter drops duplicate results. Results are considered equal if StringUtils.equalsCommonNorm() is true for the answer strings. In this case the result with the higher score is kept and its score is incremented by the score of the other result.

This class extends the class Filter.

Version:
2006-06-28
Author:
Nico Schlaefer

Field Summary
private  java.lang.String[] forbidden
          Results with an answer string equal to one of these forbidden strings are dropped.
 
Constructor Summary
DuplicateFilter()
           
 
Method Summary
 void addForbiddenAnswers(java.lang.String[] forbidden)
          Adds forbidden answer strings.
 Result[] apply(Result[] results)
          Filters duplicate results and increments the scores of the remaining results by the scores of the dropped results.
 
Methods inherited from class info.ephyra.answerselection.filters.Filter
apply
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

forbidden

private java.lang.String[] forbidden
Results with an answer string equal to one of these forbidden strings are dropped.

Constructor Detail

DuplicateFilter

public DuplicateFilter()
Method Detail

addForbiddenAnswers

public void addForbiddenAnswers(java.lang.String[] forbidden)
Adds forbidden answer strings.

Parameters:
forbidden - forbidden answers

apply

public Result[] apply(Result[] results)
Filters duplicate results and increments the scores of the remaining results by the scores of the dropped results.

Overrides:
apply in class Filter
Parameters:
results - array of Result objects
Returns:
array of Result objects without duplicates