本文整理汇总了Java中org.apache.uima.collection.StatusCallbackListener类的典型用法代码示例。如果您正苦于以下问题:Java StatusCallbackListener类的具体用法?Java StatusCallbackListener怎么用?Java StatusCallbackListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StatusCallbackListener类属于org.apache.uima.collection包,在下文中一共展示了StatusCallbackListener类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createCpe
import org.apache.uima.collection.StatusCallbackListener; //导入依赖的package包/类
public CollectionProcessingEngine createCpe(StatusCallbackListener aListener)
throws ResourceInitializationException, CpeDescriptorException {
ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
// max errors
if (maxErrors != 0) {
for (CpeCasProcessor cpeCasProcessor : cpeDesc
.getCpeCasProcessors().getAllCpeCasProcessors()) {
if (maxErrors == -1) // infinite nr errors ok
cpeCasProcessor.setActionOnMaxError("continue");
else if (maxErrors > 0)
cpeCasProcessor.setMaxErrorCount(maxErrors);
}
}
// thread cnt
if (maxProcessingUnitThreatCount == 0) {
cpeDesc.getCpeCasProcessors().setPoolSize(3);
} else {
cpeDesc.getCpeCasProcessors().setPoolSize(
maxProcessingUnitThreatCount + 2);
cpeDesc.setProcessingUnitThreadCount(maxProcessingUnitThreatCount);
}
CollectionProcessingEngine cpe = UIMAFramework
.produceCollectionProcessingEngine(cpeDesc, resMgr, null);
cpe.addStatusCallbackListener(aListener);
return cpe;
}
开发者ID:BlueBrain,项目名称:bluima,代码行数:30,代码来源:CpeBuilder.java
示例2: SimpleRunCPE
import org.apache.uima.collection.StatusCallbackListener; //导入依赖的package包/类
public SimpleRunCPE(CpeDescription cpeDesc) throws ResourceInitializationException {
LOGGER.info("Instantiating CPE");
collectionProcessingEngine = UIMAFramework.produceCollectionProcessingEngine(cpeDesc);
collectionProcessingEngine.addStatusCallbackListener(new StatusCallbackListener() {
@Override
public void initializationComplete() {
LOGGER.info("CPM Initialization Complete");
}
@Override
public void batchProcessComplete() {
LOGGER.info("Completed " + entityCount + " documents");
if (size > 0) {
LOGGER.info("; " + size + " characters");
}
}
@Override
public void collectionProcessComplete() {
LOGGER.info("Completed " + entityCount + " documents");
if (size > 0) {
LOGGER.info("; " + size + " characters");
}
LOGGER.info(
"PERFORMANCE REPORT \n" + collectionProcessingEngine.getPerformanceReport().toString());
completionSemaphore.release();
}
@Override
public void paused() {
LOGGER.info("Paused");
}
@Override
public void resumed() {
LOGGER.info("Resumed");
}
@Override
public void aborted() {
LOGGER.error("CPE processing was aborted");
completionSemaphore.release();
}
@Override
public void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus) {
List<Exception> exceptions = aStatus.getExceptions();
LOGGER.debug(aStatus.getStatusMessage());
for (Exception exception : exceptions) {
LOGGER.error("Exception processing a CAS: ", exception);
}
if (exceptions.size() > 0) {
throw new RuntimeException("Processing exception");
}
entityCount++;
String docText = aCas.getDocumentText();
if (docText != null) {
size += docText.length();
}
}
});
}
开发者ID:nlpie,项目名称:biomedicus,代码行数:67,代码来源:SimpleRunCPE.java
示例3: setStatusCallbackListener
import org.apache.uima.collection.StatusCallbackListener; //导入依赖的package包/类
/**
* Sets a callback listener for the notifications the UIMA Collection
* Processing Management (CPM) emits while it is running.
*
* @param statusCallbackListener
*/
public void setStatusCallbackListener(StatusCallbackListener statusCallbackListener) {
this.statusCallbackListener = statusCallbackListener;
}
开发者ID:ag-csw,项目名称:ExpertFinder,代码行数:10,代码来源:MediaWikiCPERunner.java
注:本文中的org.apache.uima.collection.StatusCallbackListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论