|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.ofai.gate.jape.Constraint
public class Constraint
An individual annotation/attributes/values/operator expression. It doesn't extend PatternElement, even though it has to "match", because a set of Constraint must be applied together in order to avoid doing separate selectAnnotations calls for each one.
Field Summary |
---|
Fields inherited from interface at.ofai.gate.jape.JapeConstants |
---|
APPELT_STYLE, BRILL_STYLE, DEFAULT_PRIORITY, EQUAL, FIRST_STYLE, GREATER, GREATER_OR_EQUAL, INDENT_PADDING, KLEENE_PLUS, KLEENE_QUERY, KLEENE_STAR, LESSER, LESSER_OR_EQUAL, MULTI_SPAN_BINDING, NO_BINDING, NO_KLEENE_OP, NOT_EQUAL, NOT_REGEXP, ONCE_STYLE, REGEXP, SINGLE_SPAN_BINDING |
Fields inherited from interface gate.creole.ANNIEConstants |
---|
ANNOTATION_COREF_FEATURE_NAME, DATE_ANNOTATION_TYPE, DATE_POSTED_ANNOTATION_TYPE, DOCUMENT_COREF_FEATURE_NAME, JOB_ID_ANNOTATION_TYPE, LOCATION_ANNOTATION_TYPE, LOOKUP_ANNOTATION_TYPE, LOOKUP_CLASS_FEATURE_NAME, LOOKUP_INSTANCE_FEATURE_NAME, LOOKUP_LANGUAGE_FEATURE_NAME, LOOKUP_MAJOR_TYPE_FEATURE_NAME, LOOKUP_MINOR_TYPE_FEATURE_NAME, LOOKUP_ONTOLOGY_FEATURE_NAME, MONEY_ANNOTATION_TYPE, ORGANIZATION_ANNOTATION_TYPE, PERSON_ANNOTATION_TYPE, PERSON_GENDER_FEATURE_NAME, PR_NAMES, SENTENCE_ANNOTATION_TYPE, SPACE_TOKEN_ANNOTATION_TYPE, TOKEN_ANNOTATION_TYPE, TOKEN_CATEGORY_FEATURE_NAME, TOKEN_KIND_FEATURE_NAME, TOKEN_LENGTH_FEATURE_NAME, TOKEN_ORTH_FEATURE_NAME, TOKEN_STRING_FEATURE_NAME |
Constructor Summary | |
---|---|
Constraint(java.lang.String annotType)
Construction from annot type string |
Method Summary | |
---|---|
void |
addAttribute(JdmAttribute attr)
Add an attribute. |
void |
changeSign()
Change the sign of the negation flag. |
java.lang.Object |
clone()
Need cloning for processing of macro references. |
void |
finish()
Finish: replace dynamic data structures with Java arrays; called after parsing. |
java.lang.String |
getAnnotType()
Get the type of annnotation we're looking for. |
JdmAttribute[] |
getAttributeArray()
Get the attributes that must be present on the matched annotation. |
java.util.LinkedList |
getAttributeSeq()
Get the list of attributes that must match the annotation features. |
boolean |
isNegated()
Access to negation flag. |
void |
negate()
Set negation. |
java.lang.String |
shortDesc()
|
boolean |
subsumes(gate.Document doc,
gate.Annotation annot)
Test if an annotation complies with all features and comparison operators of this constraint's attributes. |
boolean |
subsumesOne(gate.Document doc,
gate.Annotation annot)
Test if an annotation complies with at least one feature and comparison operators of this constraint's attributes. |
protected boolean |
subsumesOneOrAll(gate.Document doc,
gate.Annotation annot,
boolean anded)
Test if an annotation complies with the features and comparison operators of this constraint's attributes. |
java.lang.String |
toString()
Create a string representation of the object. |
java.lang.String |
toString(java.lang.String pad)
Create a string representation of the object. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Constraint(java.lang.String annotType)
Method Detail |
---|
public void negate()
public boolean isNegated()
public void changeSign()
public java.lang.String getAnnotType()
public java.util.LinkedList getAttributeSeq()
public JdmAttribute[] getAttributeArray()
public void addAttribute(JdmAttribute attr)
public java.lang.Object clone()
PatternElement.clone()
clone
in class java.lang.Object
public void finish()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String pad)
public java.lang.String shortDesc()
public boolean subsumesOne(gate.Document doc, gate.Annotation annot)
annot
- an annotation
true
if the annotation tests successfully with the
values and operators of at least one attribute of this constraint and
false
if not.public boolean subsumes(gate.Document doc, gate.Annotation annot)
annot
- an annotation
true
if the annotation tests successfully with the
values and operators from every attribute of this constraint and
false
if not.protected boolean subsumesOneOrAll(gate.Document doc, gate.Annotation annot, boolean anded)
anded=true
, or a big
OR if anded=false
.
If the constraint is one of the two special cases "@DOCBEGIN" or "@DOCEND" we just check whether the annotation is of the same name (we rely on the document containing an annotation of type "@DOCBEGIN" at offset 0 and "@DOCEND" at the last offset)
annot
- an annotationanded
- true
: all features must match.
false
: at least one feature must match.
true
if the annotation tests successfully with the
values and operators from the attribute of this constraint and
false
if not.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |