java - String IN, String OUT? -


i'm new cleartk , uima. far couldn't find examples on how create pipeline no files involved.

i'm trying process small text stored in java string variable using cleartk , uima, , xml string (outcome of cleartk timeml annotators).

i able provide string input (see code excerpt), code far elegant (needed execute set , empty uri cas.) also, output being saved file, want string (it not make sense have output saved file , read file memory).

import org.apache.uima.analysis_component.jcasannotator_implbase; import org.apache.uima.analysis_engine.analysisengineprocessexception; import org.apache.uima.fit.factory.analysisenginefactory; import org.apache.uima.fit.pipeline.simplepipeline; import org.apache.uima.jcas.jcas; import org.cleartk.corpus.timeml.tempeval2007writer; import org.cleartk.opennlp.tools.postaggerannotator; import org.cleartk.snowball.defaultsnowballstemmer; import org.cleartk.timeml.event.*; import org.cleartk.timeml.time.timetypeannotator; import org.cleartk.timeml.tlink.temporallinkeventtodocumentcreationtimeannotator; import org.cleartk.timeml.tlink.temporallinkeventtosamesentencetimeannotator; import org.cleartk.timeml.tlink.temporallinkeventtosubordinatedeventannotator; import org.cleartk.timeml.type.documentcreationtime; import org.cleartk.token.tokenizer.tokenannotator; import org.cleartk.util.cr.filescollectionreader;  ...  string documenttext = "first make sure using eggs several days old..."; jcas sourcecas = createjcas();  sourcecas.setdocumenttext(documenttext); viewuriutil.seturi(sourcecas, new uri(""));  simplepipeline.runpipeline(         sourcecas,         org.cleartk.opennlp.tools.sentenceannotator.getdescription(),         tokenannotator.getdescription(),         postaggerannotator.getdescription(),         defaultsnowballstemmer.getdescription("english"),         org.cleartk.opennlp.tools.parserannotator.getdescription(),         org.cleartk.timeml.time.timeannotator.factory.getannotatordescription(),         timetypeannotator.factory.getannotatordescription(),         eventannotator.factory.getannotatordescription(),         eventtenseannotator.factory.getannotatordescription(),         eventaspectannotator.factory.getannotatordescription(),         eventclassannotator.factory.getannotatordescription(),         eventpolarityannotator.factory.getannotatordescription(),         eventmodalityannotator.factory.getannotatordescription(),         analysisenginefactory.createenginedescription(addemptydct.class),         temporallinkeventtodocumentcreationtimeannotator.factory.getannotatordescription(),         temporallinkeventtosamesentencetimeannotator.factory.getannotatordescription(),         temporallinkeventtosubordinatedeventannotator.factory.getannotatordescription(),         tempeval2007writer.getdescription("file:///tmp/out.tml")); 

what recommended way have pipeline take string input , produce string execution result?

run engines simplepipeline did, , retrieve annotations interested in sourcecas this:

collection<myannotation> myannotation = jcasutil.select(sourcecas, myannotation.class); string myproperty = myannotation.getmyproperty(); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -