/** * Resets the AE (AnalysisEngine), releasing all resources held by the * current AE. * * @param ae UIMA Analysis Engine */ public static void resetAE(AnalysisEngine ae) { if (ae != null) { ae.destroy(); ae = null; } } }
/** * Returns a new JCas () appropriate for the given Analysis Engine. This * method ensures that only one instance of a JCas is created. A Jcas is a * Java Cover Classes based Object-oriented CAS (Common Analysis System) * API. * * <p> * Important: It is highly recommended that you reuse CAS objects rather * than creating new CAS objects prior to each analysis. This is because CAS * objects may be expensive to create and may consume a significant amount * of memory. * </p> * * @param ae * AnalysisEngine used to create an appropriate JCas object. * @return a JCas object appropriate for the given AnalysisEngine. * @throws ResourceInitializationException * if a CAS could not be created because this AnalysisEngine's * CAS metadata (type system, type priorities, or FS indexes) * are invalid. */ public static JCas getJCas(AnalysisEngine ae) throws ResourceInitializationException { JCas jcas = ae.newJCas(); return jcas; }
protected void decorate(JCas jcas) throws AnalysisEngineProcessException { if (decorators != null) { for (AnalysisEngine appender : decorators) { appender.process(jcas); } } }
throw new AnalysisEngineProcessException( new Exception("No name type or valid name type mapping configured!"));
public void batchProcessComplete() throws AnalysisEngineProcessException { try { getStub().callBatchProcessComplete(); } catch (ResourceServiceException e) { throw new AnalysisEngineProcessException(e); } }
public void collectionProcessComplete() throws AnalysisEngineProcessException { try { getStub().callCollectionProcessComplete(); } catch (ResourceServiceException e) { throw new AnalysisEngineProcessException(e); } }
public JCas next() throws AnalysisEngineProcessException { try { return mCasIterator.next().getJCas(); } catch (CASException e) { throw new AnalysisEngineProcessException(e); } }
/** * Notify a set of {@link AnalysisEngine analysis engines} that the collection process is complete. */ public static void collectionProcessComplete(final AnalysisEngine... engines) throws AnalysisEngineProcessException { for (AnalysisEngine e : engines) { e.collectionProcessComplete(); } }
@Override public void reconfigure() throws ResourceConfigurationException { // don't call super.reconfigure - that will be done by the call below, but // with the correct context. ae.reconfigure(); }
@Override public void batchProcessComplete(ProcessTrace trace) throws ResourceProcessException, IOException { this.ae.batchProcessComplete(trace); }
/** * Gets the ext res and bindings. * * @return the ext res and bindings */ public ResourceManagerConfiguration getExtResAndBindings() { return aeDescription.getResourceManagerConfiguration(); }
@Override public void typeSystemInit(TypeSystem typeSystem) throws ResourceInitializationException { this.ae.typeSystemInit(typeSystem); }
/** * Initializes the type system. */ public void typeSystemInit(TypeSystem typeSystem) throws AnalysisEngineProcessException { // sentence type // String sentenceTypeName = // AnnotatorUtil.getRequiredStringParameter(mContext, // UimaUtil.SENTENCE_TYPE_PARAMETER); // mSentenceType = AnnotatorUtil.getType(typeSystem, sentenceTypeName); // name type mNameType = AnnotatorUtil.getRequiredTypeParameter(context, typeSystem, NameFinder.NAME_TYPE_PARAMETER); mStructureFeature = AnnotatorUtil.getRequiredFeatureParameter(context, mNameType, "opennlp.uima.normalizer.StructureFeature"); if (!SUPPORTED_TYPES.contains(mStructureFeature.getRange().getName())) { throw new AnalysisEngineProcessException( ExceptionMessages.MESSAGE_CATALOG, "range_type_unsupported", new Object[] {mStructureFeature.getRange().getName()}); } }
protected void decorate(JCas jcas) throws AnalysisEngineProcessException { if (decorators != null) { for (AnalysisEngine appender : decorators) { appender.process(jcas); } } }
/** * Destroy ae. */ public void destroyAe() { this.cas = null; if (this.ae != null) { this.ae.destroy(); this.ae = null; } }
@Override public void collectionProcessComplete(ProcessTrace trace) throws ResourceProcessException, IOException { this.ae.collectionProcessComplete(trace); }
ae.process(jcas);
/** * Resets the AE (AnalysisEngine), releasing all resources held by the * current AE. * * @param ae UIMA Analysis Engine */ public static void resetAE(AnalysisEngine ae) { if (ae != null) { ae.destroy(); ae = null; } } }
@Override public void collectionProcessComplete() throws AnalysisEngineProcessException { this.ae.collectionProcessComplete(); }
/** * Resets the AE (AnalysisEngine), releasing all resources held by the * current AE. * * @param ae UIMA Analysis Engine */ public static void resetAE(AnalysisEngine ae) { if (ae != null) { ae.destroy(); ae = null; } } }