0

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

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

例如,谁能给我一些可以直接在 main func 中运行的代码?非常感谢!

4

1 回答 1

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,您可以调用 Factory 方法,从(第三方提供的)XML 文件创建 CollectionReader(读取输入)、AnalysisEngine(处理输入)和 Consumer 对象(写入/执行其他操作)。使用这些方法来构建您的管道和 SimplePipeline 类来运行它。要提取您需要的数据,您可以在 Consumer 对象中操作 CAS 对象(包含您的数据),可能使用回调。您也可以在分析引擎对象中执行此操作。我推荐使用 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...-

于 2014-09-04T09:50:43.780 回答