2014-04-01 31 views
0

我想调用uima-text-segmenter https://code.google.com/p/uima-text-segmenter/source/browse/trunk/INSTALL?r=22的API来运行一个例子。 但我不`吨知道如何调用API ... 自述说,如何运行uima-text-segmenter的例子?

With the DocumentAnalyzer, run the following descriptor 
`desc/textSegmenter/wst-snowball-C99-JTextTilingAAE.xml` by taking the 
uima-examples data as input. 

任何人都可以给我一些代码,可以直接在主例如FUNC运行? 非常感谢!

回答

1

龙答:

链接描述你将如何从Eclipse UIMA环境中设置应用程序。这种设置通常针对的主题专家很少或没有编码经验。它允许它们以一种声明的方式使用UIMA(相对较快):所有数据结构和分析引擎(UIMA中的计算模块)都是在xml中声明的(在它上面有一个GUI),之后框架负责处理休息。在这种情况下,您通常会使用Eclipse内部的运行配置(或包含的UIMA管道运行器应用程序)运行UIMA管道。幸运的是,UIMA允许你从代码完全一样,但我会建议使用UIMAFit(http://uima.apache.org/d/uimafit-current/tools.uimafit.book.html#d5e137)来代替UIMA,因为它捆绑了许多有用的东西和编码快捷方式。

简短的回答:

使用UIMAFit,你可以调用创建CollectionReader(读取输入),AnalysisEngine(过程输入)和消费对象的工厂方法(写入/做其他的东西)从(第三方提供)XML文件。使用这些方法来构建管道和SimplePipeline类来运行它。为了提取您需要的数据,您可以在消费者对象中操作CAS对象(包含您的数据),并可能使用回调。您也可以在Analysis Engine对象中执行此操作。我建议使用DKPro的FeaturePathFactory(https://code.google.com/p/dkpro-core-asl/source/browse/de.tudarmstadt.ukp.dkpro.core-asl/trunk/de.tudarmstadt.ukp.dkpro.core.api.featurepath-asl/src/main/java/de/tudarmstadt/ukp/dkpro/core/api/featurepath/FeaturePathFactory.java?spec=svn1811&r=1811)快速访问您之后的功能。

代码示例:

http://uima.apache.org/d/uimafit-current/tools.uimafit.book.html#d5e137包含实例,但它们都在相反的方向走(类对象在工厂方法中使用,而不是XML文件 - 从这些类生成XML)。查看UIMAFit API以找到您需要的方法,例如XML中的AnalysisEngineDescription:http://uima.apache.org/d/uimafit-current/api/org/apache/uima/fit/factory/AnalysisEngineFactory.html#createEngineDescriptionFromPath-java.lang.String-java.lang.Object...-