info.ephyra.questionanalysis.atype.classifier
Class RuleElement
java.lang.Object
info.ephyra.questionanalysis.atype.classifier.RuleElement
public class RuleElement
- extends java.lang.Object
An element in a rule used for rule-based classification of answer type. Each
RuleElement corresponds to a feature with a set of values with which to match a
given Instance.
- Version:
- 2008-02-10
- Author:
- Justin Betteridge
|
Field Summary |
private java.lang.String |
feature
|
private java.util.Set<java.lang.String> |
values
|
|
Constructor Summary |
RuleElement(org.w3c.dom.Element ruleElementElement)
Instantiates a RuleElement from an XML Element. |
|
Method Summary |
java.lang.String |
getFeature()
|
java.util.Set<java.lang.String> |
getValues()
|
static void |
main(java.lang.String[] args)
Tests RuleElement creation, compilation and matching. |
java.lang.String |
matches(edu.cmu.minorthird.classify.Instance instance)
Tells whether a given Instance has a feature that matches this RuleElement. |
void |
setFeature(java.lang.String feature)
|
void |
setValues(java.util.Set<java.lang.String> values)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
feature
private java.lang.String feature
values
private java.util.Set<java.lang.String> values
RuleElement
public RuleElement(org.w3c.dom.Element ruleElementElement)
- Instantiates a RuleElement from an XML Element.
- Parameters:
ruleElementElement - the Element to construct a Rule from
matches
public java.lang.String matches(edu.cmu.minorthird.classify.Instance instance)
- Tells whether a given Instance has a feature that matches this RuleElement.
by returning the matching value upon a successful match or
null
if this RuleElement does not match the Instance. When one of
this RuleElement's values contains the substring "->", the portion of the
value before the "->" is used for matching against the input Instance, while
the portion of the value after the "->" is used as the matching value;
- Parameters:
instance - the Instance to consider
- Returns:
- whether a given Instance has a feature that matches this RuleElement
- Throws:
java.lang.IllegalStateException - if this RuleElement has not been compiled yet
getFeature
public java.lang.String getFeature()
- Returns:
- the feature
setFeature
public void setFeature(java.lang.String feature)
- Parameters:
feature - the feature to set
getValues
public java.util.Set<java.lang.String> getValues()
- Returns:
- the values
setValues
public void setValues(java.util.Set<java.lang.String> values)
- Parameters:
values - the values to set
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- Tests RuleElement creation, compilation and matching.
- Parameters:
args -
- Throws:
java.lang.Exception