 <p>Alternatively, you could also use <a href="https://uima.apache.org/d/ruta-current/tools.ruta.book.html" rel="nofollow">Apache Ruta</a>, either with the workbench (recommended to get started) or with java code.</p> <p>For the latter, I created an example project at <a href="https://github.com/renaud/annotate_ruta_example" rel="nofollow">https://github.com/renaud/annotate_ruta_example</a>. The main parts are:</p> <p>a list of names in <code>src/main/resources/ruta/resources/names.txt</code> (a plain text file)</p> <pre><code>Mark John Rabbit Owl Curry ATH-MX50 CC234 </code></pre> <p>a Ruta script in <code>src/main/resources/ruta/scripts/Example.ruta</code></p> <pre><code>PACKAGE example.annotate; // optional package def WORDLIST MyNames = 'names.txt'; // declare dictionary location DECLARE Name; // declare an annotation Document{-&gt; MARKFAST(Name, MyNames)}; // annotate document </code></pre> <p>and some java boilerplate code to launch the annotator:</p> <pre><code>JCas jCas = JCasFactory.createJCas(); // the sample text to annotate jCas.setDocumentText("Mark wants to buy CC234."); // configure the engine with scripts and resources AnalysisEngine rutaEngine = AnalysisEngineFactory.createEngine( RutaEngine.class, // RutaEngine.PARAM_RESOURCE_PATHS, "src/main/resources/ruta/resources",// RutaEngine.PARAM_SCRIPT_PATHS, "src/main/resources/ruta/scripts", RutaEngine.PARAM_MAIN_SCRIPT, "Example"); // run the script. instead of a jCas, you could also provide a UIMA collection reader to process many documents SimplePipeline.runPipeline(jCas, rutaEngine); // a simple select to print the matched Names for (Name name : JCasUtil.select(jCas, Name.class)) { System.out.println(name.getCoveredText()); } </code></pre> <p>there is also some UIMA type (annotation) definitions, check <code>src/main/resources/desc/type/ExampleTypes.xml</code>, <code>src/main/resources/META-INF/org.apache.uima.fit/types.txt</code> and <code>src/main/java/example/annotate</code>.</p> <h3>how to test it</h3> <pre><code>git clone https://github.com/renaud/annotate_ruta_example.git cd annotate_ruta_example mvn clean install mvn exec:java -Dexec.mainClass="example.Annotate" </code></pre>