uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Eckart de Castilho <richard.eck...@gmail.com>
Subject Re: AnalysisEngine.processAndOutputNewCASes(...) in case of JCasMultiplier returns 0 JCases
Date Thu, 05 Sep 2013 17:59:11 GMT
Hi Artem,

did you try asking the AggregateBuilder for a description,
calling getOperationalProperties().setOutputsNewCASes(true)
on the description and then creating the engine?

I have an apparently working piece of code looking along these lines

// The part starting with a splitter and ending with a merger has to be in its own
// aggregate. The flow controller of the aggregate has to drop the intermediate CASes.
FlowControllerDescription fcd = createFlowControllerDescription(FixedFlowController.class,
  FixedFlowController.PARAM_ACTION_AFTER_CAS_MULTIPLIER, "drop");
AnalysisEngineDescription embedded = createEngineDescription(fcd, splitter, tokenizer, merger);

// The final merged CAS, however, needs to be returned from the aggregate
embedded.getAnalysisEngineMetaData().getOperationalProperties().setOutputsNewCASes(true);

// Need to wrap into another aggregate because runPipeline has no immediate support for
// flow control
AnalysisEngineDescription pipelineDesc = createEngineDescription(sentenceDetector, embedded,
consumer);

SimplePipeline.runPipeline(createReaderDescription(…), pipelineDesc);

Cheers,

-- Richard

On 30.08.2013, at 23:32, Artem Vovk <vovk.artem@gmail.com> wrote:

> Hi,
> 
> I wanted to write a test for MyJCasMultiplier, to check how many JCases are created.
Here is my code:
> 
> AnalysisEngineDescription segmenter =   createEngineDescription(BreakIteratorSegmenter.class);
> 
> AnalysisEngineDescription multiplier = createEngineDescription(MyJCasMultiplier.class);
> 	
> AggregateBuilder ab = new AggregateBuilder();
> ab.add(segmenter);
> ab.add(multiplier);
> 
> AnalysisEngine engine = ab.createAggregate();
> engine.getAnalysisEngineMetaData().getOperationalProperties().setOutputsNewCASes(true);
> 
> JCas jCas = engine.newJCas();
> jCas.setDocumentText(testString);
> JCasIterator it = engine.processAndOutputNewCASes(jCas);
> 
> The problem is that engine.processAndOutputNewCASes(jCas) returns always 0 JCases, but
I know it should be more :) Did I miss something here or it is a framework issue?
> 
> Best,
> Artem


Mime
View raw message