Examples for using Apache UIMA in a java program
I have been searching for examples of using Apache UIMA in a java program. Are there examples on how t开发者_如何学Co use the example Annotators in a Java program ?
If you want to use UIMA directly into Java code, you might want to have a look at uimafit, because it eases the use of UIMA from within Java. Here is a quick example to use the example Annotator (source)
public class RoomNumberAnnotatorPipeline {
public static void main(String[] args) throws UIMAException {
String text = "The meeting was moved from Yorktown 01-144 to Hawthorne 1S-W33.";
TypeSystemDescription tsd = createTypeSystemDescription(
"org.uimafit.examples.tutorial.type.RoomNumber");
JCas jCas = createJCas(tsd);
jCas.setDocumentText(text);
AnalysisEngine analysisEngine = createPrimitive(RoomNumberAnnotator.class, tsd);
analysisEngine.process(jCas);
for (RoomNumber roomNumber : select(jCas, RoomNumber.class)) {
System.out.println(roomNumber.getCoveredText() + "\tbuilding = "
+ roomNumber.getBuilding());
}
}
}
Yes there are examples provided in UIMA SDK. You need to read developers guide here how to view the source in Eclipse.UIMA Tutorial and Dev Guide. Look at section 1.1.3 and Chapter 3.
精彩评论