2014-04-01 34 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...-