在Java程序中使用Apache UIMA的例子 [英] Examples for using Apache UIMA in a java program

查看:1025
本文介绍了在Java程序中使用Apache UIMA的例子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找在Java程序中使用Apache UIMA的例子。是否有关于如何在Java程序中使用的例子注释者的例子吗?

I have been searching for examples of using Apache UIMA in a java program. Are there examples on how to use the example Annotators in a Java program ?

推荐答案

如果你想使用UIMA直接转换成Java code,你可能想看看的 uimafit ,因为它简化了从Java内部使用UIMA的。下面是一个简单的例子使用的例子注解者(<一个href=\"https://$c$c.google.com/p/uimafit/source/browse/trunk/uimaFIT-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotatorPipeline.java\">source)

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());
                }
        }
}

这篇关于在Java程序中使用Apache UIMA的例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆