info.ephyra.questionanalysis.atype.classifier
Class Rule
java.lang.Object
info.ephyra.questionanalysis.atype.classifier.Rule
public class Rule
- extends java.lang.Object
A rule used for rule-based classification of answer type.
- Version:
- 2008-02-10
- Author:
- Justin Betteridge
|
Constructor Summary |
Rule(org.w3c.dom.Element ruleElement)
Instantiates a Rule object from an XML Element. |
|
Method Summary |
java.util.List<RuleElement> |
getElements()
|
static void |
main(java.lang.String[] args)
Tests Rule creation, compilation and matching. |
AnswerType |
matches(edu.cmu.minorthird.classify.Instance instance)
Tells whether a given Instance matches this Rule by returning
the appropriate answer type if it does match, and null
if it does not. |
void |
setAtype(java.lang.String atype)
|
void |
setElements(java.util.List<RuleElement> elements)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
atype
private java.lang.String atype
confidence
private double confidence
elements
private java.util.List<RuleElement> elements
Rule
public Rule(org.w3c.dom.Element ruleElement)
- Instantiates a Rule object from an XML Element.
- Parameters:
ruleElement - the Element to construct a Rule from
matches
public AnswerType matches(edu.cmu.minorthird.classify.Instance instance)
- Tells whether a given Instance matches this Rule by returning
the appropriate answer type if it does match, and
null
if it does not.
- Parameters:
instance - the Instance to consider
- Returns:
- the answer type and subtype formed by matching this Rule to the
given Instance, or
null if this Rule does not match the Instance.
- Throws:
java.lang.IllegalStateException - if this Rule has not been compiled yet
setAtype
public void setAtype(java.lang.String atype)
- Parameters:
atype - the atype to set
getElements
public java.util.List<RuleElement> getElements()
- Returns:
- the elements
setElements
public void setElements(java.util.List<RuleElement> elements)
- Parameters:
elements - the elements to set
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
main
public static void main(java.lang.String[] args)
- Tests Rule creation, compilation and matching.
- Parameters:
args -