info.ephyra.questionanalysis.atype
Class AnswerType

java.lang.Object
  extended by info.ephyra.questionanalysis.atype.AnswerType
All Implemented Interfaces:
java.io.Serializable

public class AnswerType
extends java.lang.Object
implements java.io.Serializable

A basic class which contains hierarchical answer type information.

Version:
2008-02-10
Author:
Justin Betteridge
See Also:
Serialized Form

Field Summary
protected  double confidence
           
protected  int level
          the level in an answer type hierarchy, 1 being the top level answer type, 2 being the first subtype level, etc
private static long serialVersionUID
           
protected  java.util.List<AnswerType> subtypes
           
protected  java.lang.String type
           
 
Constructor Summary
AnswerType(int level, double confidence, java.lang.String type)
          Constructs an Answer Type object.
AnswerType(int level, double confidence, java.lang.String type, java.util.List<AnswerType> subtypes)
          Constructs an Answer Type object with pre-defined list of subtypes.
 
Method Summary
static AnswerType constructFromString(java.lang.String answerTypeStr)
          Construct answer type from a String that looks like NUMEX.MONEY This string cannot have multiple types at any level (e.g NUMEX|PERSON not allowed) Any number of "."
 boolean equals(java.lang.Object obj)
           
 double getConfidence()
           
 java.lang.String getFullType(int classLevels)
           
 int getLevel()
           
 java.util.List<AnswerType> getSubtypes()
           
 java.lang.String getType()
           
 int hashCode()
           
 boolean isTopLevel()
           
 void setConfidence(double confidence)
           
 void setLevel(int level)
          Sets the Answer Type level
 void setSubtypes(java.util.List<AnswerType> subtypes)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

level

protected int level
the level in an answer type hierarchy, 1 being the top level answer type, 2 being the first subtype level, etc


confidence

protected double confidence

type

protected java.lang.String type

subtypes

protected java.util.List<AnswerType> subtypes
Constructor Detail

AnswerType

public AnswerType(int level,
                  double confidence,
                  java.lang.String type)
Constructs an Answer Type object. Note that no default constructor is provided

Parameters:
level - A int indicating the level of this answer type in answer type hierarchy
confidence - A double indicating the confidence score
type - A String indicating the type

AnswerType

public AnswerType(int level,
                  double confidence,
                  java.lang.String type,
                  java.util.List<AnswerType> subtypes)
Constructs an Answer Type object with pre-defined list of subtypes.

Parameters:
level - A int indicating the level of this answer type in answer type hierarchy
confidence - A double indicating the confidence score
type - A String indicating the type
subtypes - A List containing subtype information about the current answer type
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getLevel

public int getLevel()
Returns:
the level of this answer type in answer type hierarchy

isTopLevel

public boolean isTopLevel()
Returns:
boolean indicating if the current answer type is top-level

setLevel

public void setLevel(int level)
Sets the Answer Type level

Parameters:
level - the answer type level

getType

public java.lang.String getType()

getConfidence

public double getConfidence()

getSubtypes

public java.util.List<AnswerType> getSubtypes()

setConfidence

public void setConfidence(double confidence)

setSubtypes

public void setSubtypes(java.util.List<AnswerType> subtypes)

getFullType

public java.lang.String getFullType(int classLevels)

constructFromString

public static AnswerType constructFromString(java.lang.String answerTypeStr)
Construct answer type from a String that looks like NUMEX.MONEY

This string cannot have multiple types at any level (e.g NUMEX|PERSON not allowed) Any number of "."-separated subtypes can be present. Subtypes called DEFAULT are ignored.

Parameters:
answerTypeStr - the String from which to construct an AnswerType