public CasIterator processAndOutputNewCASes(CAS aCAS) throws AnalysisEngineProcessException { // https://issues.apache.org/jira/browse/UIMA-5191 final long startTime = System.currentTimeMillis(); final AnalysisEngine ae = getAeFromPool(); final CasIterator it_inner = ae.processAndOutputNewCASes(aCAS); final AnalysisEnginePool localMPool = mPool; CasIterator it_outer = new CasIterator() { @Override public boolean hasNext() throws AnalysisEngineProcessException { boolean r = it_inner.hasNext(); if (!r) { localMPool.releaseAnalysisEngine(ae); getMBean().reportAnalysisTime(System.currentTimeMillis() - startTime); } return r; } @Override public CAS next() throws AnalysisEngineProcessException { return it_inner.next(); } @Override public void release() { it_inner.release(); } }; return it_outer; }
@Override public JCasIterator processAndOutputNewCASes(JCas aJCas) throws AnalysisEngineProcessException { // https://issues.apache.org/jira/browse/UIMA-5191 final long startTime = System.currentTimeMillis(); final AnalysisEngine ae = getAeFromPool(); final JCasIterator it_inner = ae.processAndOutputNewCASes(aJCas); final AnalysisEnginePool localMPool = mPool; JCasIterator it_outer = new JCasIterator() { @Override public boolean hasNext() throws AnalysisEngineProcessException { boolean r = it_inner.hasNext(); if (!r) { localMPool.releaseAnalysisEngine(ae); getMBean().reportAnalysisTime(System.currentTimeMillis() - startTime); } return r; } @Override public JCas next() throws AnalysisEngineProcessException { return it_inner.next(); } @Override public void release() { it_inner.release(); } }; return it_outer; }
@Override public CasIterator processAndOutputNewCASes(CAS aCAS) throws AnalysisEngineProcessException { UIMAFramework.getLogger(this.getClass()).logrb(Level.FINE, this.getClass().getName(), "processAndOutputNewCASes", LOG_RESOURCE_BUNDLE, "UIMA_analysis_engine_process_begin__FINE", new Object[] { this.ae.getAnalysisEngineMetaData().getName() }); CasIterator result = this.ae.processAndOutputNewCASes(aCAS); UIMAFramework.getLogger(this.getClass()).logrb(Level.FINE, this.getClass().getName(), "processAndOutputNewCASes", LOG_RESOURCE_BUNDLE, "UIMA_analysis_engine_process_end__FINE", new Object[] { this.ae.getAnalysisEngineMetaData().getName() }); return result; }
/** * Run a sequence of {@link AnalysisEngine analysis engines} over a {@link CAS}. This method * does not {@link AnalysisEngine#destroy() destroy} the engines or send them other events like * {@link AnalysisEngine#collectionProcessComplete()}. This is left to the caller. * * @param cas * the CAS to process * @param engines * a sequence of analysis engines to run on the jCas * @throws UIMAException * @throws IOException */ public static void runPipeline(final CAS cas, final AnalysisEngine... engines) throws UIMAException, IOException { if (engines.length == 0) { return; } CasIterator casIter = engines[0].processAndOutputNewCASes(cas); AnalysisEngine[] enginesRemains = Arrays.copyOfRange(engines, 1, engines.length); while (casIter.hasNext()) { CAS nextCas = casIter.next(); runPipeline(nextCas, enginesRemains); nextCas.release(); } }
/** * Run a sequence of {@link AnalysisEngine analysis engines} over a {@link JCas}. This method * does not {@link AnalysisEngine#destroy() destroy} the engines or send them other events like * {@link AnalysisEngine#collectionProcessComplete()}. This is left to the caller. * * @param jcas * the jCas to process * @param engines * a sequence of analysis engines to run on the jCas * @throws UIMAException * @throws IOException */ public static void runPipeline(final JCas jcas, final AnalysisEngine... engines) throws UIMAException, IOException { if (engines.length == 0) { return; } JCasIterator jcasIter = engines[0].processAndOutputNewCASes(jcas); AnalysisEngine[] enginesRemains = Arrays.copyOfRange(engines, 1, engines.length); while (jcasIter.hasNext()) { JCas nextJcas = jcasIter.next(); runPipeline(nextJcas, enginesRemains); nextJcas.release(); } }
void runPipeline(final CAS cas, final AnalysisEngine engine, CasProcessedCallback callback) throws UIMAException, IOException { CasIterator it = engine.processAndOutputNewCASes(cas); while (it.hasNext()) { CAS output = it.next(); callback.entityProcessComplete(output); output.release(); } callback.collectionProcessComplete(); } }
casIter = nextAe.processAndOutputNewCASes(cas); if (casIter.hasNext()) { outputCas = casIter.next(); casIter = nextAe.processAndOutputNewCASes(cas); if (casIter.hasNext()) { outputCas = casIter.next();
CasIterator casIterator = ae.processAndOutputNewCASes(aCAS); if ( stackDumpTimer != null ) { stackDumpTimer.cancel();