info.ephyra.questionanalysis.atype.classifier
Class RuleBasedQuestionClassifier

java.lang.Object
  extended by info.ephyra.questionanalysis.atype.QuestionClassifier
      extended by info.ephyra.questionanalysis.atype.classifier.RuleBasedQuestionClassifier

public class RuleBasedQuestionClassifier
extends QuestionClassifier

A rule-based classifier for the answer type of a question.

Version:
2008-02-10
Author:
Justin Betteridge

Field Summary
private  java.lang.String defaultLabel
           
private static org.apache.log4j.Logger log
           
private  java.util.List<Rule> rules
           
 
Fields inherited from class info.ephyra.questionanalysis.atype.QuestionClassifier
extractor, isInitialized, languagePair
 
Constructor Summary
RuleBasedQuestionClassifier()
           
 
Method Summary
 java.util.List<AnswerType> classify(edu.cmu.minorthird.classify.Instance instance)
          Classifies a question, represented by an Instance, in terms of its expected answer type.
 java.lang.String getDefaultLabel()
           
static java.lang.String getFeatureValue(edu.cmu.minorthird.classify.Instance instance, java.lang.String featName)
          Retrieves the value of the given feature from the given Instance.
 void initialize()
          Initializes the FeatureExtractor.
private  void loadRulesFile(java.lang.String fileName)
           
 void setDefaultLabel(java.lang.String defaultLabel)
           
 
Methods inherited from class info.ephyra.questionanalysis.atype.QuestionClassifier
classifySet, evaluate, getAnswerTypes, getAnswerTypes, getAnswerTypes, getLanguagePair, isInitialized, setInitialized, setLanguagePair
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.log4j.Logger log

rules

private java.util.List<Rule> rules

defaultLabel

private java.lang.String defaultLabel
Constructor Detail

RuleBasedQuestionClassifier

public RuleBasedQuestionClassifier()
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Description copied from class: QuestionClassifier
Initializes the FeatureExtractor.

Overrides:
initialize in class QuestionClassifier
Throws:
java.lang.Exception - if one of the required input properties is not defined

classify

public java.util.List<AnswerType> classify(edu.cmu.minorthird.classify.Instance instance)
Description copied from class: QuestionClassifier
Classifies a question, represented by an Instance, in terms of its expected answer type. Multiple AnswerTypes may be returned, ranked by their associated score, or probability of being ccrrect. The source object associated with the Instance that is returned by Instance.getSource() must be the original question, in String form.

Specified by:
classify in class QuestionClassifier
Parameters:
instance - the Instance to be classified.
Returns:
a list of AnswerTypes, ranked by their associated score, or probability of being ccrrect.

getFeatureValue

public static java.lang.String getFeatureValue(edu.cmu.minorthird.classify.Instance instance,
                                               java.lang.String featName)
Retrieves the value of the given feature from the given Instance.

Parameters:
instance - the Instance to consider
featName - the name of the feature

loadRulesFile

private void loadRulesFile(java.lang.String fileName)

getDefaultLabel

public java.lang.String getDefaultLabel()
Returns:
the defaultLabel

setDefaultLabel

public void setDefaultLabel(java.lang.String defaultLabel)
Parameters:
defaultLabel - the defaultLabel to set