Hi all,
I'm a newbie and I'm trying to build an aggregate AE from two (very
simple) AE.
On this guide
http://uima.apache.org/downloads/releaseDocs/2.3.0-incubating/docs/pdf/tutorials_and_users_guides.pdf
on page 49 (55) there is an example of an aggregate AE Descriptor, so
I've copied and this is my AAE descriptor:
<?xml version="1.0" encoding="UTF-8"?>
<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
<primitive>false</primitive>
<delegateAnalysisEngineSpecifiers>
<delegateAnalysisEngine key="SimpleName">
<import location="./SimpleName/SimpleName_pear.xml"/>
</delegateAnalysisEngine>
<delegateAnalysisEngine key="EmailRecognizer">
<import location="./EmailRecognizer/EmailRecognizer_pear.xml" />
</delegateAnalysisEngine>
</delegateAnalysisEngineSpecifiers>
<analysisEngineMetaData>
<name>Aggregate AE - Room Number and DateTime Annotators</name>
<description>Detects Room Numbers, Dates, and Times</description>
<flowConstraints>
<fixedFlow>
<node>SimpleName</node>
<node>EmailRecognizer</node>
</fixedFlow>
</flowConstraints>
</analysisEngineMetaData>
</analysisEngineDescription>
And this is the java code I'm using:
...
pearDir = new File(aggregateAEPath).toURI();
browser = new PackageBrowser(new File(pearDir.getPath()));
in = new XMLInputSource(aggregateAEFilePath);
specifier =
UIMAFramework.getXMLParser().parseResourceSpecifier(in);
resManager = UIMAFramework.newDefaultResourceManager();
resManager.setExtensionClassPath(aeSimpleNamePath+"/bin",true); // TODO
check if this is necessary
resManager.setExtensionClassPath(aeEmailPath+"/bin",true);
// TODO check if this is necessary
ae = UIMAFramework.produceAnalysisEngine(specifier,
resManager, null);
ae.setConfigParameterValue("Encoding", "UTF-8");
annotCas = ae.newJCas();
annotCas.setDocumentText(textToBeAnnotatate);
annotCas.setDocumentLanguage("it");
ae.process(annotCas);
FSIndex indexAnnotations = annotCas.getAnnotationIndex();
Iterator<Annotation> annoIt = indexAnnotations.iterator();
while(annoIt.hasNext()){
Annotation annotation = annoIt.next();
String text = annotation.getCoveredText();
int begin = annotation.getBegin();
int end = annotation.getEnd();
String type = annotation.getType().getName();
System.out.println("text: "+text+"\tbegin:
"+begin+"\tend:"+end+"\ttype:"+type);
}
...
The problem is that the last System.out.println prints just all the
input text and no annoation, while if I use a very similar code with the
two simple AE I get all the annotation.
What am I doing wrong?
Thanks,
Andrea
--
-------------------------------------------------
Dott. Andrea Turbati
AI Research Group PhD student,
Dept. of Computer Science, Systems and Production
University of Roma, Tor Vergata
Via del Politecnico 1 00133 ROMA (ITALY)
tel: +39 06 7259 7332 (lab)
e_mail: turbati@info.uniroma2.it
home page: http://art.uniroma2.it/turbati/
--------------------------------------------------
|