The unit test you pulled this code out of is testing that the sofa mappings are working correctly for aggregates created by AggregateBuilder and is not actually a typical use case. I do not think your problem is related to adding feature structures to the CAS per se.


On 6/17/2010 1:43 AM, Andrea Turbati wrote:
Thank you for the answer.
I've looked at your example and I see that you don't use the class Annotation but you prefer to create different view from inside the Annotator and then in the main program you look for these view.
In your simple annotator you do:

JCas parentheticalView= ViewCreatorAnnotator.createViewSafely(jCas, ViewNames.PARENTHESES_VIEW);
 ...
 parentheticalView.setDocumentText(parentheticalText);


My simple AE, which I've not written myself, in the process method does:

aCAS.getIndexRepository().addFS(fs);

so it adds a Feature Structure  in the index repository of the JCas
This may be the reason why in my case each single AE works on its own and I'm able to print all the single annotation, but when I use the AAE I obtain no annotation.

But, being a newbie in writing UIMA code I not totally sure of what I've just written, so if someone can please explain me what I am doing wrong.

Thnaks,

Andrea



Il 16/06/2010 16:52, [email protected] ha scritto:
You might take a look at the uimaFIT (http://uimafit.googlecode.com)
AggregateBuilder class:
http://code.google.com/p/uimafit/source/browse/trunk/uimaFIT/src/main/java/org/uimafit/factory/AggregateBuilder.java
  See the unit test for an example:
http://code.google.com/p/uimafit/source/browse/trunk/uimaFIT/src/test/java/org/uimafit/factory/AggregateBuilderTest.java
  Hope this helps!
  Philip

On June 16, 2010 at 2:32 PM Andrea Turbati<[email protected]> wrote:

Thanks for the anwer.
At the moment I've unzipped the pear so, and the AAE descriptor points
to the two directory. Maybe I've written a bad java code, but it's
copied from another project where I used one of the two unzipped simple
AE and it works fine.
What is the right way to call an AAE from a java sofware?

Thanks

Andrea


Il 16/06/2010 14:22, Marshall Schor ha scritto:
Does it work if you don't use PEARs?

-Marshall

On 6/15/2010 4:25 AM, Andrea Turbati wrote:

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: [email protected]

home page: http://art.uniroma2.it/turbati/

--------------------------------------------------





No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.829 / Virus Database: 271.1.1/2942 - Release Date: 06/16/10 
12:35:00

Reply via email to