import org.apache.uima.analysis_engine.AnalysisEngine;
import org.apache.uima.analysis_engine.AnalysisEngineDescription;
import org.apache.uima.fit.factory.AnalysisEngineFactory;
import org.apache.uima.fit.factory.JCasFactory;
import org.apache.uima.jcas.JCas;
import org.apache.uima.fit.util.JCasUtil;
import org.apache.uima.jcas.tcas.Annotation;
/* Creating descriptions and engines, using uimaFIT. */
AnalysisEngineDescription desc =
AnalysisEngineFactory.createEngineDescription(MyAnnotatorEngine.class);
AnalysisEngine engine = AnalysisEngineFactory.createEngine(desc);
/* Creating a JCas. */
JCas jcas = JCasFactory.createJCas();
jcas.setDocumentLanguage("en");
jcas.setDocumentText("Here is the document's text we will analyze.");
/* Processing the JCas. */
engine.process(jcas);
/* Getting annotations from the JCas. */
java.util.Collection<Annotation> annos = JCasUtil.select(jcas, MyAnnotation.class)
for (Annotation a : annos) {
// Sample use of annotation.
System.out.println(a.getCoveredText());
}