本文整理汇总了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;
}
示例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();
}
}
});
}
示例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;
}