本文整理汇总了Java中org.apache.uima.collection.EntityProcessStatus类的典型用法代码示例。如果您正苦于以下问题:Java EntityProcessStatus类的具体用法?Java EntityProcessStatus怎么用?Java EntityProcessStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityProcessStatus类属于org.apache.uima.collection包,在下文中一共展示了EntityProcessStatus类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: entityProcessComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* Called when the processing of a Document is completed. <br>
* The process status can be looked at and corresponding actions taken.
*
* @param aCas CAS corresponding to the completed processing
* @param aStatus EntityProcessStatus that holds the status of all the events
* for aEntity
*/
public void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus) {
if (aStatus.isException()) {
String docURI = getDocumentURI(aCas);
docsWithException.add(docURI);
docsProcessedWithException++;
System.err.println(String.format("During the processing of %s", docURI));
List<Exception> exceptions = aStatus.getExceptions();
for (int i = 0; i < exceptions.size(); i++) {
((Throwable) exceptions.get(i)).printStackTrace();
}
return;
}
entityCount++;
String docText = aCas.getDocumentText();
if (docText != null) {
size += docText.length();
}
if (entityReportingInterval != 0 && entityCount % entityReportingInterval == 0) {
System.out.println(String.format("%s entities have been processed", entityCount));
}
}
开发者ID:textocat,项目名称:textokit-core,代码行数:30,代码来源:ReportingStatusCallbackListener.java
示例2: entityProcessComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* @param aCas the CAS containing the processed entity and the analysis results
* @param aStatus the status of the processing. This object contains a record of any Exception that occurred, as well as timing information.
* @see org.apache.uima.aae.client.UimaAsBaseCallbackListener#entityProcessComplete(org.apache.uima.cas.CAS, org.apache.uima.collection.EntityProcessStatus)
*/
@Override
public void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus) {
try {
super.entityProcessComplete(aCas, aStatus);
// See if we need to validate the connection.
if (conn == null) {
validateConnection();
}
if (hasFilteredAnnotation(aCas) && hasAnnotationsToProcess(aCas))
batch.addAll(getRows(aCas));
// Batch full, process it!
if (batch.size() >= this.batchSize) {
processBatch();
}
} catch (Exception e) {
LOG.error("Error validating the connection or executing the batch", e);
//If exitOnError is set then kill the client to prevent doing damage to the database
if (exitOnError)
System.exit(1);
throw new RuntimeException(e);
}
}
开发者ID:department-of-veterans-affairs,项目名称:Leo,代码行数:31,代码来源:BaseDatabaseListener.java
示例3: entityProcessComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* @param aCas the CAS containing the processed entity and the analysis results
* @param aStatus the status of the processing. This object contains a record of any Exception that occurred, as well as timing information.
* @see org.apache.uima.aae.client.UimaAsBaseCallbackListener#entityProcessComplete(org.apache.uima.cas.CAS, org.apache.uima.collection.EntityProcessStatus)
*/
@Override
public void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus) {
LOG.debug("EntityProcessComplete event");
super.entityProcessComplete(aCas, aStatus);
numReceived++;
if (checkForError(aCas, aStatus) && exitOnError)
return;
try {
this.referenceID = getReferenceLocation(aCas.getJCas());
} catch (CASException e) {
this.referenceID = null;
this.docInfo = null;
LOG.error(e.getMessage(), e);
}// catch
}
开发者ID:department-of-veterans-affairs,项目名称:Leo,代码行数:21,代码来源:BaseListener.java
示例4: collectionProcessComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* @param aStatus the status of the processing. This object contains a record of any Exception that occurred, as well as timing information.
* @see org.apache.uima.aae.client.UimaAsBaseCallbackListener#collectionProcessComplete(org.apache.uima.collection.EntityProcessStatus)
*/
@Override
public void collectionProcessComplete(EntityProcessStatus aStatus) {
super.collectionProcessComplete(aStatus);
//Ensure all CAS have come back before continuing
int count = 0;
while (numSent != numReceived && count < 10) {
LOG.warn("Have not recieved all CAS's from the Service, sleeping for 2 seconds");
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
LOG.error(e.getMessage(), e);
}
count++;
}//while
if (numSent != numReceived)
LOG.warn("Did not recieve all CAS's back from the service.");
LOG.info("Collection Processing Stats: \n" + "Sent CAS Count: "
+ numSent + "\n" + "Received CAS Count: " + numReceived);
}
开发者ID:department-of-veterans-affairs,项目名称:Leo,代码行数:25,代码来源:BaseListener.java
示例5: entityProcessComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* Called with a completely processed CAS.
*
* @param aCas the returned cas.
* @param aStatus the status of the processing. This object contains a record of any Exception that occurred, as well as timing information.
*/
@Override
public void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus) {
super.entityProcessComplete(aCas, aStatus);
if (writer == null)
writer = writerBuilder.buildCSVWriter();
if (hasFilteredAnnotation(aCas) && hasAnnotationsToProcess(aCas)) {
List<String[]> rows = getRows(aCas);
if (rows == null || rows.size() < 1)
return;
writer.writeAll(rows);
}
try {
writer.flush();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:department-of-veterans-affairs,项目名称:Leo,代码行数:25,代码来源:BaseCsvListener.java
示例6: entityProcessComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* Called when the processing of a Document is completed. <br>
* The process status can be looked at and corresponding actions taken.
*
* @param aCas
* CAS corresponding to the completed processing
* @param aStatus
* EntityProcessStatus that holds the status of all the events for aEntity
*/
public void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus) {
if (aStatus.isException()) {
List exceptions = aStatus.getExceptions();
for (int i = 0; i < exceptions.size(); i++) {
((Throwable) exceptions.get(i)).printStackTrace();
}
return;
}
entityCount++;
String docText = aCas.getDocumentText();
if (docText != null) {
size += docText.length();
}
}
开发者ID:oaqa,项目名称:knn4qa,代码行数:24,代码来源:SimpleRunCPE_fixed.java
示例7: collectionProcessComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* Called when the collection processing is completed.
*
* @see org.apache.uima.collection.StatusCallbackListener#collectionProcessComplete()
*/
@Override
public void collectionProcessComplete(EntityProcessStatus aStatus) {
maybeStopAndCroak(aStatus, "Error on collection process complete call to remote service:");
log.info("Completed {} document(s.)", entityCount);
if (size > 0) {
log.info("Document(s) had {} characters.", size);
}
long elapsedTime = System.currentTimeMillis() - mStartTime;
log.info("Time elapsed: {}.", renderMillis(elapsedTime));
}
开发者ID:adimit,项目名称:summarization,代码行数:17,代码来源:UimaDeployer.java
示例8: collectionProcessComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* @see org.apache.uima.aae.client.UimaAsBaseCallbackListener#collectionProcessComplete(org.apache.uima.collection.EntityProcessStatus)
* @param aStatus the status of the processing. This object contains a record of any Exception that occurred, as well as timing information.
*/
@Override
public void collectionProcessComplete(EntityProcessStatus aStatus) {
super.collectionProcessComplete(aStatus);
if (launchAnnotationViewer) {
launchAnnotationViewer();
}
}
开发者ID:department-of-veterans-affairs,项目名称:Leo,代码行数:13,代码来源:SimpleXmiListener.java
示例9: collectionProcessComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* @param aStatus the status of the processing. This object contains a record of any Exception that occurred, as well as timing information.
* @see org.apache.uima.aae.client.UimaAsBaseCallbackListener#collectionProcessComplete(org.apache.uima.collection.EntityProcessStatus)
*/
@Override
public void collectionProcessComplete(EntityProcessStatus aStatus) {
try {
super.collectionProcessComplete(aStatus);
// Run any partial batch.
processBatch();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:department-of-veterans-affairs,项目名称:Leo,代码行数:16,代码来源:BaseDatabaseListener.java
示例10: initializationComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* Called once client initialization is complete.
*
* @param aStatus the status of the processing.
* @see org.apache.uima.aae.client.UimaAsBaseCallbackListener#initializationComplete(org.apache.uima.collection.EntityProcessStatus)
*/
@Override
public void initializationComplete(EntityProcessStatus aStatus) {
if (aStatus != null && aStatus.isException()) {
LOG.error("Exceptions thrown on getMeta call to remote service...");
List<Exception> exceptions = aStatus.getExceptions();
for (Exception exception : exceptions) {
LOG.error(exception.getMessage(), exception);
}// for
}// if aStatus != null && isException
LOG.info("===== Client Initialization Complete =====");
}
开发者ID:department-of-veterans-affairs,项目名称:Leo,代码行数:18,代码来源:BaseListener.java
示例11: checkForError
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* Check for an error in the return status of the processed CAS. Return true
* if there is an error.
*
* @param aCas CAS that was processed
* @param aStatus Status object that contains the exception if one is thrown
* @return True if an error was returned, False otherwise
*/
protected boolean checkForError(CAS aCas, EntityProcessStatus aStatus) {
if (aStatus != null && aStatus.isException()) {
List<Exception> exceptions = aStatus.getExceptions();
String errors = "";
this.lastException = "";
for (Exception exception : exceptions) {
Writer result = new StringWriter();
PrintWriter printWriter = new PrintWriter(result);
exception.printStackTrace(printWriter);
errors += result.toString() + "\n";
errors += exception.toString() + "\n---\n";
}// for
this.lastException = errors;
// Write exception out to file if the output directory is set.
if (logErrors) {
try {
LOG.error("ERROR processing CAS: " + this.getReferenceLocation(aCas.getJCas()) + "\n" + errors);
} catch (CASException e) {
e.printStackTrace();
}
}// if
return true;
}// if aStatus != null && isException
return false;
}
开发者ID:department-of-veterans-affairs,项目名称:Leo,代码行数:38,代码来源:BaseListener.java
示例12: initializationComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* Called once client initialization is complete.
*
* @param aStatus the status of the processing.
* @see UimaAsBaseCallbackListener#initializationComplete(EntityProcessStatus)
*/
@Override
public void initializationComplete(EntityProcessStatus aStatus) {
super.initializationComplete(aStatus);
if (includeHeader)
try {
writeHeaders();
} catch (IOException e) {
LOG.error("Error writing the headers!", e);
}
}
开发者ID:department-of-veterans-affairs,项目名称:Leo,代码行数:17,代码来源:BaseCsvListener.java
示例13: collectionProcessComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* @param aStatus the status of the processing. This object contains a record of any Exception that occurred, as well as timing information.
* @see org.apache.uima.aae.client.UimaAsBaseCallbackListener#collectionProcessComplete(org.apache.uima.collection.EntityProcessStatus)
*/
@Override
public void collectionProcessComplete(EntityProcessStatus aStatus) {
super.collectionProcessComplete(aStatus);
try {
writer.flush();
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:department-of-veterans-affairs,项目名称:Leo,代码行数:15,代码来源:BaseCsvListener.java
示例14: entityProcessComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* @param aCas the CAS containing the processed entity and the analysis results
* @param aStatus the status of the processing. This object contains a record of any Exception that occurred, as well as timing information.
* @see UimaAsBaseCallbackListener#entityProcessComplete(CAS, EntityProcessStatus)
*/
@Override
public void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus) {
super.entityProcessComplete(aCas, aStatus);
String documentText = aCas.getDocumentText();
logger.info(documentText);
}
开发者ID:department-of-veterans-affairs,项目名称:Leo,代码行数:12,代码来源:DoNothingListener.java
示例15: entityProcessComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* Called when the processing of a Document is completed. <br>
* The process status can be looked at and corresponding actions taken.
*
* @param aCas
* CAS corresponding to the completed processing
* @param aStatus
* EntityProcessStatus that holds the status of all the events
* for aEntity
*/
public void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus) {
// if there is an error above the individual document level,
// an entityProcessStatus is created with a null value for entity
if (aCas == null) {
for (int i = 0; i < aStatus.getFailedComponentNames().size(); i++) {
LOG.info("[{}] FailedComponentNames", aStatus
.getFailedComponentNames().get(i));
}
for (int i = 0; i < aStatus.getExceptions().size(); i++) {
LOG.info("[{}] Exceptions", aStatus.getExceptions().get(i));
}
return;
}
try {
entityCount++;
// FIXME int dataSize = 0;
// // get size here
// Type t = aCas.getTypeSystem().getType("uima.cpm.FileLocation");
// Feature f = t.getFeatureByBaseName("DocumentSize");
// FSIterator fsI = aCas.getAnnotationIndex(t).iterator();
// if (fsI.isValid()) {
// dataSize = fsI.get().getIntValue(f);
// }
//
// size += dataSize;
// to handle exceptions occured in any of the components for the
// entity
if (aStatus.isException()) {
for (int q = 0; q < aStatus.getExceptions().size(); q++) {
Exception e = (Exception) aStatus.getExceptions().get(q);
e.printStackTrace();
}
}
} catch (Exception io) {
UIMAFramework.getLogger(this.getClass()).log(Level.WARNING, "", io);
}
}
开发者ID:BlueBrain,项目名称:bluima,代码行数:50,代码来源:StatusCallbackListenerSlf4J.java
示例16: entityProcessComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
public void entityProcessComplete(CAS arg0, EntityProcessStatus arg1) {
entityProcessCount++;
if (entityProcessCount % ENTITY_CNT_FOR_LOG == 0) {
logger.log(Level.INFO, "CPM entity process completed - " + entityProcessCount + " entities");
}
}
开发者ID:tudarmstadt-lt,项目名称:newsleak-frontend,代码行数:7,代码来源:NewsleakStatusCallbackListener.java
示例17: SimpleRunCPE
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的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
示例18: entityProcessComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus) {
}
开发者ID:textocat,项目名称:textokit-core,代码行数:7,代码来源:StatusCallbackListenerAdapter.java
示例19: initializationComplete
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
/**
* Called when the initialization is completed.
*
* @see org.apache.uima.collection.StatusCallbackListener#initializationComplete()
*/
@Override
public void initializationComplete(EntityProcessStatus aStatus) {
maybeStopAndCroak(aStatus, "Error on getMeta call to remote service.");
log.info("UIMA AS Service Initialization Complete");
}
开发者ID:adimit,项目名称:summarization,代码行数:11,代码来源:UimaDeployer.java
示例20: maybeStopAndCroak
import org.apache.uima.collection.EntityProcessStatus; //导入依赖的package包/类
private void maybeStopAndCroak(final EntityProcessStatus aStatus, final String message) {
if (aStatus != null && aStatus.isException()) {
stop();
Summarizer.croak(aStatus.getExceptions(), message);
}
}
开发者ID:adimit,项目名称:summarization,代码行数:7,代码来源:UimaDeployer.java
注:本文中的org.apache.uima.collection.EntityProcessStatus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论