title: How start with UIMA and simple NLP tasks?
body: <p>I've recently found out about UIMA (<a href="http://uima.apache.org/" rel="nofollow">http://uima.apache.org/</a>). It looks promising for simple NLP tasks, such as tokenizing, sentence splitting, part-of-speech tagging etc.</p>
  
  <p>I've managed to get my hands on an already configured minimal java sample that is using OpenNLP components for its pipeline.</p>
  
  <p>The code looks like this:</p>
  
  <pre><code>public void ApplyPipeline() throws IOException, InvalidXMLException,
          ResourceInitializationException, AnalysisEngineProcessException {
  
      XMLInputSource in = new XMLInputSource(
              "opennlp/OpenNlpTextAnalyzer.xml");
      ResourceSpecifier specifier = UIMAFramework.getXMLParser()
              .parseResourceSpecifier(in);
  
      AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(specifier);
  
      JCas jcas = ae.newJCas();
      jcas.setDocumentText("This is my text.");
  
      ae.process(jcas);
      this.doSomethingWithResults(jcas);
  
      jcas.reset();
      ae.destroy();
  }
  
  private void doSomethingWithResults(JCas jcas) {
      AnnotationIndex&lt;Annotation&gt; idx = jcas.getAnnotationIndex();
      FSIterator&lt;Annotation&gt; it = idx.iterator();
  
      while (it.hasNext()) {
          System.out.println(it.next().toString());
      }
  
  }
  </code></pre>
  
  <p>Excerpt from OpenNlpTextAnalyzer.xml:</p>
  
  <pre><code>&lt;delegateAnalysisEngine key="SentenceDetector"&gt;
      &lt;import location="SentenceDetector.xml" /&gt;
  &lt;/delegateAnalysisEngine&gt;
  &lt;delegateAnalysisEngine key="Tokenizer"&gt;
      &lt;import location="Tokenizer.xml" /&gt;
  &lt;/delegateAnalysisEngine&gt;
  </code></pre>
  
  <p>The java code produces output like this:</p>
  
  <pre><code>Token
     sofa: _InitialView
     begin: 426
     end: 435
     pos: "NNP"
  </code></pre>
  
  <p>I'm trying to get the same information from each Annotation object that the toString() method uses. I've already looked into UIMA's source code to understand where the values are coming from. My attempts to retrieve them sort of works, but they aren't smart in any way.</p>
  
  <p>I'm struggling to find easy examples that, extract information out of the JCas objects.</p>
  
  <p>I'm looking for a way to get for instance all Annotations produces by my PosTagger or by the SentenceSplitter for further usage. </p>
  
  <p>I guess</p>
  
  <pre><code>List&lt;Feature&gt; feats = it.next().getType().getFeatures();
  </code></pre>
  
  <p>is a start to get values, but due to UIMA owns classes for primitive types, even the source code  of the  toString method in the annotation class reads like a slap in the face.</p>
  
  <p>Where do I find java code that uses basic UIMA stuff and where are good tutorials (except javadoc from the framework itself)?</p>