Class Annotation
Object
Annotation
- All Implemented Interfaces:
Serializable
An
Annotation represents additional data associated with words in the sentences,
e.g. data generated by NER, POS taggers, etc. An Annotation has a name and is associated with a sentence
via the sentence's index in the list of sentences. It also holds a set of indices of the sentences words
to which it is associated. It also stores a map of arbitrary variables.
An equality operation is defined for Annotations, see method equals for details.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAnnotation(String _sName, int _iSentenceIndex, Set<Integer> _zWordIndices) Creates a new annotation as ifAnnotation(_sName, _iSentenceIndex, _zWordIndices, null)was called.Annotation(String _sName, int _iSentenceIndex, Set<Integer> _zWordIndices, Map<String, Object> _mVariables) Creates a new annotation with the given data. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanCompares thisAnnotationto the specified object.final StringgetName()Returns the name of this annotation.final intReturns the index in theList<passed intoSentenceI>InputProcessor.processto which this annotation belongs (the first sentence has index 0).Returns an immutable map of the variables associated with this annotation.Returns an immutable set of indices into theList<contained in aWordData>SentenceI.final inthashCode()toString()
-
Constructor Details
-
Annotation
public Annotation(String _sName, int _iSentenceIndex, Set<Integer> _zWordIndices, Map<String, Object> _mVariables) Creates a new annotation with the given data. The given word indices set and variables map are stored as unmodifiable copies.- Parameters:
_sName- the name of the annotation_iSentenceIndex- the index in theList<passed intoSentenceI>InputProcessor.processto which this annotation belongs (the first sentence has index 0)_zWordIndices- the indices in theSentenceI'sList<to which this annotation belongs; the set may be empty (the first word has index 0)WordData>_mVariables- an arbitrary collection of key/value pairs; ifnullan empty map is used- Throws:
NullPointerException- if the name is null or the word indices map is nullIllegalArgumentException- if the name is empty, the sentence index is negative, the word indices map contains a negative index, or the variables map contains a null key
-
Annotation
Creates a new annotation as ifAnnotation(_sName, _iSentenceIndex, _zWordIndices, null)was called.
-
-
Method Details
-
getName
Returns the name of this annotation. -
getSentenceIndex
public final int getSentenceIndex()Returns the index in theList<passed intoSentenceI>InputProcessor.processto which this annotation belongs (the first sentence has index 0). -
getWordIndices
Returns an immutable set of indices into theList<contained in aWordData>SentenceI. The first word has index 0. -
getVariables
Returns an immutable map of the variables associated with this annotation. -
equals
Compares thisAnnotationto the specified object. The result istrueif and only if the argument is notnulland is anAnnotationwith equal name, sentence index, and word indices. The annotation variables are not taken into account. -
hashCode
public final int hashCode() -
toString
-