Here is the code:
======================
*package* ca.nrc.t2rels.freetext.annotator;
*import* org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
*import* org.apache.uima.analysis_engine.AnalysisEngine;
*import* org.apache.uima.analysis_engine.AnalysisEngineDescription;
*import* org.apache.uima.analysis_engine.AnalysisEngineProcessException;
*import* org.apache.uima.fit.descriptor.ConfigurationParameter;
*import* org.apache.uima.fit.factory.AnalysisEngineFactory;
*import* org.apache.uima.fit.factory.JCasFactory;
*import* org.apache.uima.fit.pipeline.SimplePipeline;
*import* org.apache.uima.jcas.JCas;
*public* *class* DummyAnnotator *extends* JCasAnnotator_ImplBase {
// This is copied verbatim from the doc (Section 2.2):
//
// https://uima.apache.org/d/uimafit-current/tools.uimafit.book.html
//
*public* *static* *final* String *PARAM_STRING* = "stringParam";
@ConfigurationParameter(name=*PARAM_STRING*)
*private* String stringParam;
@Override
*public* *void* process(JCas aJCas) *throws* AnalysisEngineProcessException
{
System.*out*.println("-- DummyAnnotator.process: stringParam="+stringParam);
*if* (stringParam == *null*) {
System.*out*.println(" ** HOW COME THIS PARAMETER IS null???");
}
}
*public* *static* *void* main(String[] args) *throws* Exception {
System.*out*.println("Running a DummyAnnotator");
JCas cas = JCasFactory.*createJCas*();
cas.setDocumentText("Hello world");
cas.setDocumentLanguage("en");
AnalysisEngineDescription descr = AnalysisEngineFactory.
*createEngineDescription*(
DummyAnnotator.*class*,
DummyAnnotator.*PARAM_STRING*, "some string"
);
AnalysisEngine engine = AnalysisEngineFactory.*createEngine*(descr);
SimplePipeline.*runPipeline*(cas, *new* AnalysisEngine[] { engine });
System.*out*.println("\nDONE: Running a DummyAnnotator");
}
}
=====================
On Fri, Nov 15, 2019 at 11:43 AM Richard Eckart de Castilho <[email protected]>
wrote:
> On 15. Nov 2019, at 17:41, Alain Désilets <[email protected]>
> wrote:
> >
> > Oops, sorry. Here is the file.
>
> I think the mailing list might be discarding your attachments. Maybe you
> can paste it directly into the mail or put it into a gist / pastebin?
>
> -- Richard