在Java程序中使用Apache UIMA的示例

Aru*_*n R 6 java apache uima

我一直在寻找在Java程序中使用Apache UIMA的示例.是否有关于如何在Java程序中使用示例Annotators的示例?

Ren*_*aud 6

如果要将UIMA直接用于Java代码,可能需要查看uimafit,因为它可以简化Java中的UIMA使用.以下是使用示例Annotator(源代码)的快速示例

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());
                }
        }
}
Run Code Online (Sandbox Code Playgroud)


小智 3

是的,UIMA SDK 中提供了示例。您需要阅读此处的开发人员指南,了解如何在 Eclipse 中查看源代码。UIMA 教程和开发指南。请参阅第 1.1.3 节和第 3 章。