@Override
  public void processCas(CAS aCas) throws ResourceProcessException {
    // TODO Auto-generated method stub
    JCas jcas;
    try {
      jcas = aCas.getJCas();
    } catch (CASException e) {
      throw new ResourceProcessException(e);
    }

    FSIterator<org.apache.uima.jcas.tcas.Annotation> it = jcas.getAnnotationIndex(geneTag.type)
            .iterator();
    System.out.println("Consuming CAS");
    String geneId = null;
    String geneContent = null;
    String myoutput = null;
    int start = -1;
    int end = -1;
    while (it.hasNext()) {
      geneTag geneAnnotation = (geneTag) it.next();
      geneId = geneAnnotation.getId();
      geneContent = geneAnnotation.getContent();
      start = geneAnnotation.getBegin();
      end = geneAnnotation.getEnd();

      myoutput = geneId + "|" + start + " " + end + "|" + geneContent; // Get sentence from my
                                                                       // output file
      if (hash.containsKey(myoutput)) { // Detect whether my output CAS matches the sample
        correct++;
      } else {
        wrong++;
      }

      // Write out file
      try {
        writeIntoFile(geneId, geneContent, start, end);
      } catch (IOException e) {
        throw new ResourceProcessException(e);
      } catch (SAXException e) {
        throw new ResourceProcessException(e);
      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    // Calculate precision, recall and F by provided equations
    double precision = 1.0 * correct / (correct + wrong);
    double recall = 1.0 * correct / numbers;
    System.out.println("Precision: " + precision + "\n" + "Recall: " + recall + "\n" + "F = " + 2.0
            * precision * recall / (precision + recall));
  }