info.ephyra.answerselection.filters
Class NumberOfKeywordsFilter

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

public class NumberOfKeywordsFilter
extends Filter

Filters results by the number of keywords.

The score of each result is incremented by the number of keywords it contains.

A result is dropped if m < Floor(Sqrt(k - 1)) + 1, where k is the number of keywords in the query string and m is the number of keywords that also occur in the result.

This class extends the class Filter.

Version:
2005-09-14
Author:
Nico Schlaefer

Constructor Summary
NumberOfKeywordsFilter()
           
 
Method Summary
 Result apply(Result result)
          Filters a single Result object.
private  int getNumberOfMatches(java.lang.String[] s1, java.lang.String[] s2)
          Counts the number of words in the first array that occur in the second array.
 
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
 

Constructor Detail

NumberOfKeywordsFilter

public NumberOfKeywordsFilter()
Method Detail

getNumberOfMatches

private int getNumberOfMatches(java.lang.String[] s1,
                               java.lang.String[] s2)
Counts the number of words in the first array that occur in the second array. Does not distinguish between lower and upper case.

Parameters:
s1 - string array 1
s2 - string array 2
Returns:
number of words in array 1 that occur in array 2

apply

public Result apply(Result result)
Filters a single Result object.

Overrides:
apply in class Filter
Parameters:
result - result to filter
Returns:
result with manipulated score or null if the result is dropped