我一直在寻找在 java 程序中使用 Apache UIMA 的示例。是否有关于如何在 Java 程序中使用示例注释器的示例?
问问题
6642 次
2 回答
6
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());
}
}
}
于 2011-12-19T08:59:21.347 回答
3
是的,UIMA SDK 中提供了示例。您需要在此处阅读开发人员指南如何在 Eclipse 中查看源代码。UIMA 教程和开发指南。请参阅第 1.1.3 节和第 3 章。
于 2011-05-19T22:28:21.810 回答