uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "philip@ogren.info" <phi...@ogren.info>
Subject Re: newbie aggregate AE
Date Wed, 16 Jun 2010 14:52:35 GMT
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 <turbati@info.uniroma2.it> 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: turbati@info.uniroma2.it
>
> home page: http://art.uniroma2.it/turbati/
>
> --------------------------------------------------
>
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message