info.ephyra.answerselection.filters
Class AdaptiveNumberOfKeywordsFilter

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

public class AdaptiveNumberOfKeywordsFilter
extends Filter

An adaptive version of the NumberOfKeywordsFilter that also takes occurrences of keywords in preceding text snippets into account.

This class extends the class Filter.

Version:
2008-02-10
Author:
Guido Sautter

Constructor Summary
AdaptiveNumberOfKeywordsFilter()
           
 
Method Summary
 Result[] apply(Result[] results)
          Score result snippets according to the number of keywords (target terms) they contain.
private  int getNumberOfMatches(java.lang.String[] keywords, java.lang.String[] resWords)
          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

AdaptiveNumberOfKeywordsFilter

public AdaptiveNumberOfKeywordsFilter()
Method Detail

getNumberOfMatches

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

Parameters:
keywords - string array 1
resWords - string array 2
Returns:
number of words in array 1 that occur in array 2

apply

public Result[] apply(Result[] results)
Score result snippets according to the number of keywords (target terms) they contain. Within two snippets from the same document, transfer score from a snippet to the subsequent one if the former contains many of the keywords. The idea is that a subsequent snippet might use a pronoun for the target (thus not contain the target itself), but provide useful information anyway.

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