info.ephyra.querygeneration
Class QuestionReformulation

java.lang.Object
  extended by info.ephyra.querygeneration.QuestionReformulation

public class QuestionReformulation
extends java.lang.Object

A data structure consisting of an expression describing a query reformulation and a score that is used by the answer selection module to rank results that follow from that reformulation.

Before the get() method of this class can be called, a Matcher needs to be created that applies the corresponding question pattern to the question and its matches() method needs to be called. This Matcher must be passed to the get() method.

Version:
2005-09-19
Author:
Nico Schlaefer

Field Summary
private  java.lang.String expr
          Expression that describes the reformulation.
private  float score
          Score used by the answer selection module to rank results.
 
Constructor Summary
QuestionReformulation(java.lang.String expr, float score)
          Creates a QuestionReformulation object and sets the expression and the score.
 
Method Summary
private  java.lang.String[] combineStrings(java.lang.String s1, java.lang.String s2)
          Combines two strings by inserting the second string in between each two tokens of the first string.
private  java.lang.String[] evalCombinedGroups(java.lang.String queryString, java.util.regex.Matcher matcher)
          Replaces combined group identifiers of the format [group_no1]<[group_no2] by the combinations of the corresponding groups generated by the combineStrings() method.
private  java.lang.String evalGroups(java.lang.String queryString, java.util.regex.Matcher matcher)
          Replaces group identifiers of the format [group_no] by the corresponding group captured by a Matcher that applied the question pattern to the question string.
 java.lang.String[] get(java.util.regex.Matcher matcher)
          Returns one or more reformulations of the original question.
 float getScore()
          Returns the score of the reformulation, used by the answer selection module to rank results that follow from this reformulation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

expr

private java.lang.String expr

Expression that describes the reformulation.

The expression can contain:


score

private float score
Score used by the answer selection module to rank results. A more specific reformulation should be assigned a higher score.

Constructor Detail

QuestionReformulation

public QuestionReformulation(java.lang.String expr,
                             float score)
Creates a QuestionReformulation object and sets the expression and the score.

Parameters:
expr - expression describing the reformulation
score - score of the reformulation
Method Detail

evalGroups

private java.lang.String evalGroups(java.lang.String queryString,
                                    java.util.regex.Matcher matcher)
Replaces group identifiers of the format [group_no] by the corresponding group captured by a Matcher that applied the question pattern to the question string.

Parameters:
queryString - query string containing group identifiers
matcher - the Matcher that group IDs refer to
Returns:
query string without group identifiers

evalCombinedGroups

private java.lang.String[] evalCombinedGroups(java.lang.String queryString,
                                              java.util.regex.Matcher matcher)
Replaces combined group identifiers of the format [group_no1]<[group_no2] by the combinations of the corresponding groups generated by the combineStrings() method.

Parameters:
queryString - query string containing combined group identifiers
matcher - the Matcher that groupd IDs refer to
Returns:
query string without combined group identifiers

combineStrings

private java.lang.String[] combineStrings(java.lang.String s1,
                                          java.lang.String s2)
Combines two strings by inserting the second string in between each two tokens of the first string. If the first string consist of n tokens, then this method returns an array of n-1 strings.

Parameters:
s1 - first string
s2 - second string
Returns:
combination of the two strings

get

public java.lang.String[] get(java.util.regex.Matcher matcher)
Returns one or more reformulations of the original question. Requires a Matcher that applied the corresponding question pattern to the question string. The method matches() must have been executed since group identifiers that occur in the expression used by the reformulator refer to groups that have been captured.

Parameters:
matcher - the Matcher that group IDs refer to
Returns:
reformulations of the original question

getScore

public float getScore()
Returns the score of the reformulation, used by the answer selection module to rank results that follow from this reformulation.

Returns:
score of the reformulation