Java Reference
In-Depth Information
To verify the effect of the annotate method, we will use the following code sequence.
The keyset method returns a set of all of the annotation keys currently held by the An-
notation object. These keys are displayed before and after the annotate method is
applied:
System.out.println("Before annotate method executed ");
Set<Class<?>> annotationSet = annotation.keySet();
for(Class c : annotationSet) {
System.out.println("\tClass: " + c.getName());
}
pipeline.annotate(annotation);
System.out.println("After annotate method executed ");
annotationSet = annotation.keySet();
for(Class c : annotationSet) {
System.out.println("\tClass: " + c.getName());
}
The following output shows that the creation of the Annotation object resulted in the
TextAnnotation extension being added to the annotation. After the annotate
method is executed, several additional annotations have been applied:
Before annotate method executed
Class:
edu.stanford.nlp.ling.CoreAnnotations.TextAnnotation
Search WWH ::




Custom Search