Class Annotation
- Object
-
- Annotation
-
- All Implemented Interfaces:
Serializable
public class Annotation extends Object implements Serializable
AnAnnotation
represents additional data associated with words in thesentences
, e.g. data generated by NER, POS taggers, etc. AnAnnotation
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
Annotation
s, see methodequals
for details.
-
-
Constructor Summary
Constructors Constructor Description Annotation(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object _other)
Compares thisAnnotation
to the specified object.String
getName()
Returns the name of this annotation.int
getSentenceIndex()
Returns the index in theList<
passed intoSentenceI
>InputProcessor.process
to which this annotation belongs (the first sentence has index 0).Map<String,Object>
getVariables()
Returns an immutable map of the variables associated with this annotation.Set<Integer>
getWordIndices()
Returns an immutable set of indices into theList<
contained in aWordData
>SentenceI
.int
hashCode()
String
toString()
-
-
-
Constructor Detail
-
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.process
to 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; ifnull
an 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
public Annotation(String _sName, int _iSentenceIndex, Set<Integer> _zWordIndices)
Creates a new annotation as ifAnnotation(_sName, _iSentenceIndex, _zWordIndices, null)
was called.
-
-
Method Detail
-
getName
public final String getName()
Returns the name of this annotation.
-
getSentenceIndex
public final int getSentenceIndex()
Returns the index in theList<
passed intoSentenceI
>InputProcessor.process
to which this annotation belongs (the first sentence has index 0).
-
getWordIndices
public final Set<Integer> getWordIndices()
Returns an immutable set of indices into theList<
contained in aWordData
>SentenceI
. The first word has index 0.
-
getVariables
public final Map<String,Object> getVariables()
Returns an immutable map of the variables associated with this annotation.
-
equals
public final boolean equals(Object _other)
Compares thisAnnotation
to the specified object. The result istrue
if and only if the argument is notnull
and is anAnnotation
with equal name, sentence index, and word indices. The annotation variables are not taken into account.
-
-