NLP::GATE::Annotation - A class for representing GATE-like annotations
use NLP::GATE::Annotation; my $ann = NLP::GATE::Annotation->new($type,$fromOffset,$toOffset); my $copy = $ann->clone(); $ann->setFromTo($fromOffset,$toOffset); $ann->setType($type); $ann->setFeature($name,$value); $ann->setFeatureType($name,$type); $value = $ann->getFeature($name); $type = $ann->getFeatureType($name); $from = $ann->getFrom(); $to = $ann->getTo();
This is a simple class representing a GATE-like annotation for document text. The annotation knows about the text offsets from start (first character has offset 0) to end (the offset of the byte following the annotation). Zero length annotations should be avoided as gate cannot handle them properly.
All functions that set values return the original annotation object.
This library does not attempt to mirror the Java API or the way how annotations are represented and handled in the original GATE API.
A major difference to the GATE API is that annotations can live completely independent from annotation sets or documents and have their own constructor. An annotation is simply a range that is assiciated with a type and a map of features.
Another difference to the GATE API is that feature maps are NOT seperately modeled.
Create a new annotation.
Create a deep copy of an annotation, creating a new annotation object that has the same values as the old one, but contains no references to data contained in the old one.
Set a new annotation type. Must be a string and a valid type name.
Return the current annotation type.
Set the text range of the annotation.
Add or replace the feature of the given name with the new value.
Add or replace the Java type associated with the feature. If this method is never used, the default for a feature is java.lang.String.
Return the Java type associated with the feature. If the type was never set, "java.lang.String" is returned. If no value is set for the feature, undef is returned.
Return an array of feature names for this annotation. The order of feature names in the array is random and may change between successive calls.
Add or replace all the features with the keys in the hash reference with the corresponding values in the hash reference.
Returns the value of the feature.
Returns the from offset.
Returns the to offset.
Please report any bugs or feature requests to
bug-gate-document at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=NLP::GATE. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
You can also look for information at: