4 Apr 13:57
Re: Accessing upstream annotations in downstream C++ AE
In Java there are two interfaces to the CAS: the JCas interface and the
"generic" CAS interface. Some Java example code using the generic interface
are in $UIMA_HOME/examples/src/org/apache/uima/examples/cas/.
UIMACPP implements the generic interface, which requires manual resolution
of Type and Feature definitions before accessing them. This resolution is
normally done in the annotator's typeSystemInit() method.
From typeSystemInit of the C++ version of the meeting annotator,
$UIMACPP_HOME/examples/tutorial/src/MeetingAnnotator.cpp:
//input types
roomNumberT =
crTypeSystem.getType("org.apache.uima.tutorial.RoomNumber");
dateT = crTypeSystem.getType("org.apache.uima.tutorial.DateAnnot");
timeT = crTypeSystem.getType("org.apache.uima.tutorial.TimeAnnot");
The Type object would then be used for things like
ANIndex roomNumberIndex = tcas.getAnnotationIndex(roomNumberT);
Custom features are handled in a similar way. For more information about the
generic API, see
http://incubator.apache.org/uima/downloads/releaseDocs/2.2.1-incubating/docs/html/references/references.html#ugr.ref.cas.cas_apis_create_modify_feature_structures
Hope this helps,
Eddie
PS Like Java, the method cas.getView( "MyView") will throw an exception if
the specified view does not exist in cas.
(Continue reading)
RSS Feed