public class Annotation extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_ANNOTATION_DEPTH
in converting an Annotation to a String, the maximum level of nesting of
Annotations which will be printed.
|
| Constructor and Description |
|---|
Annotation(String tp,
Span sp,
FeatureSet att) |
| Modifier and Type | Method and Description |
|---|---|
void |
assignId()
if the Annotation does not already have an 'id' feature, assigns an 'id'
feature whose value is the unique (to the Document) identifier obtained
by
Document.getNextAnnotationId(). |
FeatureSet |
attributes() |
int |
end()
returns the end of the span associated with the annotation.
|
Object |
get(String feature)
Returns the value of attribute feature of the annotation.
|
int |
getId()
returns the value of the 'id' feature (converted from an Integer or
String to an int).
|
void |
prepareToMakeString(int nestingLimit)
add 'id' feature to all Annotations referenced by this Annotation.
|
void |
put(String feature,
Object value)
Sets the value of attribute feature of the annotation to value.
|
void |
remove(String feature) |
static void |
sort(Vector annotations)
sorts a Vector of Annotations based on the end of the span of each
Annotation, highest end value first.
|
static void |
sortByStartPosition(List<Annotation> annotations)
sorts a list of annotation order by its start position.
|
Span |
span()
returns the span (of text) associated with the annotation.
|
int |
start()
returns the start of the span associated with the annotation.
|
String |
toSGMLString() |
String |
toSGMLString(int nestingLimit,
boolean useIds,
boolean quoteValues)
returns a String representation of the Annotation, without information
about the span of the annotation.
|
String |
toString()
returns a String representation of the Annotation, including the type,
span, and attributes, enclosed in '<' and '>'.
|
String |
type() |
public static final int MAX_ANNOTATION_DEPTH
public Annotation(String tp, Span sp, FeatureSet att)
public String type()
public Span span()
public int start()
public int end()
public FeatureSet attributes()
public void put(String feature, Object value)
public void remove(String feature)
public void assignId()
Document.getNextAnnotationId().public int getId()
public void prepareToMakeString(int nestingLimit)
public String toString()
public String toSGMLString()
public String toSGMLString(int nestingLimit, boolean useIds, boolean quoteValues)
nestingLimit - limit of depth of nested Annotations (Annotations which are
referenced as values of features of this Annotation) which
will be represented in the String.useIds - if true, references to Annotations which are nested more
deeply than 'nestingLimit' are rendered as '#nnn', where 'nnn'
is the 'id' feature of the referenced Annotation; if false,
these references are rendered as "..."quoteValues - if true, values of features are enclosed in double quotes, as
required by XML.public static void sort(Vector annotations)
public static void sortByStartPosition(List<Annotation> annotations)
annotations - Copyright © 2016 New York University. All rights reserved.