info.ephyra.querygeneration
Class QuestionReformulator

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

public class QuestionReformulator
extends java.lang.Object

A QuestionReformulator can be applied to a question to obtain reformulations of the question that are likely to occur in text passages that answer the question.

A question is expected to be of the format described by the pattern field. If the question does not match this pattern, no reformulations are created.

Version:
2005-11-09
Author:
Nico Schlaefer

Field Summary
private  java.util.regex.Pattern pattern
          The pattern that identifies questions that can be processed by this reformulator.
private  java.util.ArrayList<QuestionReformulation> reforms
          QuestionReformulation objects that are applied to questions that match the pattern.
 
Constructor Summary
QuestionReformulator(java.lang.String filename)
          Creates a new QuestionReformulator from a file.
 
Method Summary
 Query[] apply(java.lang.String verbMod)
          Creates reformulations of a question if it is of the format described by the pattern field and wraps them in Query objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pattern

private java.util.regex.Pattern pattern
The pattern that identifies questions that can be processed by this reformulator.


reforms

private java.util.ArrayList<QuestionReformulation> reforms
QuestionReformulation objects that are applied to questions that match the pattern.

Constructor Detail

QuestionReformulator

public QuestionReformulator(java.lang.String filename)
                     throws java.io.IOException

Creates a new QuestionReformulator from a file.

The file must have the following format:

QuestionPattern:
[regular expression]

QuestionReformulations:
[expr 1]
[score 1]
...
[expr n]
[score n]

expr is an expression describing a reformulation of the question. See the documentation of the class QuestionReformulation for further details on the format of such an expression. score is the score assigned to the reformulation and should be the higher the more specialized a reformulation is.

Parameters:
filename - name of the file containing the reformulation rules
Throws:
java.io.IOException - if the reformulation rules could not be read successfully
Method Detail

apply

public Query[] apply(java.lang.String verbMod)
Creates reformulations of a question if it is of the format described by the pattern field and wraps them in Query objects.

Parameters:
verbMod - question string with modified verbs
Returns:
Querynull