private AnalysisEngine getAnalysisEngine() throws ResourceInitializationException { if (options != null) { return options[nextAnnotator]; } else { AnalysisEngine ae = AnalysisEngineFactory.createAggregate(optionDescriptions[nextAnnotator]); return ae; } }
/** * Run a sequence of {@link AnalysisEngine analysis engines} over a {@link JCas}. The result of * the analysis can be read from the JCas. * * @param aCas * the CAS to process * @param aDescs * a sequence of analysis engines to run on the jCas * @throws UIMAException * @throws IOException */ public static void runPipeline(final CAS aCas, final AnalysisEngineDescription... aDescs) throws UIMAException, IOException { // Create aggregate AE final AnalysisEngineDescription aaeDesc = createAggregateDescription(aDescs); // Instantiate final AnalysisEngine aae = createAggregate(aaeDesc); try { // Process aae.process(aCas); // Signal end of processing aae.collectionProcessComplete(); } finally { // Destroy aae.destroy(); } }
final AnalysisEngine aae = createAggregate(aaeDesc);
public AnalysisEngine[] loadOptions(AnalysisEngineDescription[] aeds) { List<AnalysisEngine> aes = new ArrayList<AnalysisEngine>(); for (AnalysisEngineDescription aeDesc : aeds) { try { aes.add(AnalysisEngineFactory.createAggregate(aeDesc)); } catch (ResourceInitializationException e) { e.printStackTrace(); } } return aes.toArray(new AnalysisEngine[0]); }
@Override public AnalysisEngine buildPipeline(AnyObject config, String pipeline, int stageId, FixedFlow funnel, boolean outputNewCASes) throws Exception { loadTypePriorities(config); Iterable<AnyObject> iterable = config.getIterable(pipeline); FlowControllerDescription fcd = FlowControllerFactory .createFlowControllerDescription(FixedFlowController797182.class); AnalysisEngineDescription aee = buildPipeline(stageId, iterable, fcd); if (funnel != null) { FixedFlow fc = (FixedFlow) aee.getAnalysisEngineMetaData().getFlowConstraints(); funnel.setFixedFlow(fc.getFixedFlow()); aee.getAnalysisEngineMetaData().setFlowConstraints(funnel); } aee.getAnalysisEngineMetaData().getOperationalProperties().setOutputsNewCASes(outputNewCASes); aee.getAnalysisEngineMetaData().setName(pipeline); return AnalysisEngineFactory.createAggregate(aee); }