info.ephyra.questionanalysis
Class AnswerTypeTester

java.lang.Object
  extended by info.ephyra.questionanalysis.AnswerTypeTester

public class AnswerTypeTester
extends java.lang.Object

A simple pattern-based approach for determining the expected answer types of a question.

The answer types and the patterns that identify questions asking for the respective types are defined in a resource file.

The patterns for different answer types can be overlapping, thus a question can be assigned more than one type.

Version:
2006-06-10
Author:
Nico Schlaefer

Field Summary
private static java.util.ArrayList<java.lang.String> answerTypes
          Answer types that are supported by the tester.
private static java.util.ArrayList<java.util.regex.Pattern> patterns
          Patterns identifying questions asking for these types.
 
Constructor Summary
AnswerTypeTester()
           
 
Method Summary
static java.lang.String[] getAnswerTypes(java.lang.String qn, java.lang.String stemmed)
          Determines the expected answer types for a question.
static boolean loadAnswerTypes(java.lang.String filename)
          Loads the supported answer types and the corresponding patterns from a resource file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

answerTypes

private static java.util.ArrayList<java.lang.String> answerTypes
Answer types that are supported by the tester.


patterns

private static java.util.ArrayList<java.util.regex.Pattern> patterns
Patterns identifying questions asking for these types.

Constructor Detail

AnswerTypeTester

public AnswerTypeTester()
Method Detail

loadAnswerTypes

public static boolean loadAnswerTypes(java.lang.String filename)
Loads the supported answer types and the corresponding patterns from a resource file.

Parameters:
filename - resource file
Returns:
true, iff the answer types and patterns were loaded successfully

getAnswerTypes

public static java.lang.String[] getAnswerTypes(java.lang.String qn,
                                                java.lang.String stemmed)
Determines the expected answer types for a question.

Parameters:
qn - normalized question string
stemmed - stemmed question string
Returns:
expected answer types