Hello all, I'm using UIMA and UIMAfit for some months now, and I'm trying to go deeper into its functionalities. These days, I'm trying to use the Language Flow Controller, but it is not really successful, and I have some questions.
So my first question is : when multiple AnalysisEngines are aggregated together, are their capabilities "merged" and added to the capabilities of the AggregateAnalysisEngine ? My second question is related to the code. Here is a sample of what I wrote : * ResourceSpecifierFactory rsFactory = UIMAFramework.getResourceSpecifierFactory();* * Capability lgg1 = rsFactory.createCapability();* * lgg1.setLanguagesSupported(new String[]{"en", "de"});* * Capability lgg2 = rsFactory.createCapability();* * lgg2.setLanguagesSupported(new String[]{"en"});* * Capability lgg3 = rsFactory.createCapability();* * lgg3.setLanguagesSupported(new String[]{"de"});* // The first annotator detects the language of the Document, add the info to the JCas, and then the Flow Controller should "route" the Document to the Annotators dedicated to the Document Language. * AnalysisEngineDescription aed1 = AnalysisEngineFactory.createEngineDescription(Annotator1.class);* * aed1.getAnalysisEngineMetaData().setName("Annotator1");* * aed1.getAnalysisEngineMetaData().setCapabilities(new Capability[]{ lgg1 });* * AnalysisEngineDescription aed2 = AnalysisEngineFactory.createEngineDescription(Annotator2.class);* * aed2.getAnalysisEngineMetaData().setName("Annotator2");* * aed2.getAnalysisEngineMetaData().setCapabilities(new Capability[]{ lgg1 });* * AnalysisEngineDescription aed3 = AnalysisEngineFactory.createEngineDescription(Annotator3.class);* * aed3.getAnalysisEngineMetaData().setName("Annotator3");* * aed3.getAnalysisEngineMetaData().setCapabilities(new Capability[]{ lgg2 });* * AnalysisEngineDescription aed4 = AnalysisEngineFactory.createEngineDescription(Annotator4_de.class);* * aed4.getAnalysisEngineMetaData().setName("Annotator4_de");* * aed4.getAnalysisEngineMetaData().setCapabilities(new Capability[]{ lgg3 });* * AnalysisEngineDescription aed5 = AnalysisEngineFactory.createEngineDescription(Annotator5.class);* * aed5.getAnalysisEngineMetaData().setName("Annotator5");* * aed5.getAnalysisEngineMetaData().setCapabilities(new Capability[]{ lgg2 });* * AnalysisEngineDescription aed6 = AnalysisEngineFactory.createEngineDescription(Annotator6_de.class);* * aed6.getAnalysisEngineMetaData().setName("Annotator5");* * aed6.getAnalysisEngineMetaData().setCapabilities(new Capability[]{ lgg3 });* //Defining FlowControllerDescription * List<String> annot = Arrays.asList("Annotator1", "Annotator2", "Annotator3", "Annotator4_de", "Annotator5", "Annotator6_de");* * FlowControllerDescription fcd = FlowControllerFactory.createFlowControllerDescription(CapabilityLanguageFlowController.class);* * fcd.getFlowControllerMetaData().setCapabilities(new Capability[]{ lgg1 });* * AggregateBuilder builder = new AggregateBuilder();* * builder.setFlowControllerDescription(fcd);* * builder.add(aed1);* * builder.add(aed2);* * builder.add(aed3);* * builder.add(aed4);* * builder.add(aed5);* * builder.add(aed6);* * AnalysisEngineDescription aed = builder.createAggregateDescription();* //Set Flow Constraints * CapabilityLanguageFlow clf = UIMAFramework.getResourceSpecifierFactory().createCapabilityLanguageFlow();* * clf.setCapabilityLanguageFlow(new String[]{"Annotator1", "Annotator2", "Annotator3", "Annotator4_de", "Annotator5", "Annotator6_de"});* * aed.getAnalysisEngineMetaData().setFlowConstraints(clf);* *try {* * aed = getPreprocessingPipeline();* * SimplePipeline.runPipeline( jcas, aed );* * } catch (MalformedURLException e) {* * // TODO Auto-generated catch block* * e.printStackTrace();* * }* In each Annotator, I also set the Language Capability parameter : *@LanguageCapability({"en", "de"})* *public class Annotator1 extends JCasAnnotator_ImplBase { ... }* Unfortunately, the code doesn't work, namely, the JCas is not processed by the pipeline, and I get any error. Am I missing something ? Does anyone have an example of how to use the Language Flow Controller in the right way ? Thank you for your answers ! Regards, Charlotte