The UIMA framework has in the *examples* sample code which does this. See: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/ExampleApplication.java?view=markup
and http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/RunAE.java?revision=933273&view=markup <http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/RunAE.java?revision=933273&view=markup> -Marshall On 6/16/2010 10:32 AM, Andrea Turbati 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 >>> >>> >> > >
