public synchronized void processCas(CAS aCAS) throws ResourceProcessException {
    JCas jcas;
    try {
      jcas = aCAS.getJCas();
    } catch (CASException e) {
      throw new ResourceProcessException(e);
    }
    String output = null;
    String lineID = null;
    int so;
    int eo;
    int start, end;
    int i = 0;
    Iterator<Annotation> it = jcas.getAnnotationIndex(type.type).iterator();
    while (it.hasNext()) {
      type annotation = (type) it.next();
      output = annotation.getGeneDoc();
      lineID = annotation.getLineID();
      so = annotation.getStartOffSet();
      eo = annotation.getEndOffSet();
      char cha[] = output.toCharArray();
      start = so;
      end = eo - 1;
      // eliminate the influence of space for offset of the words
      for (i = 0; i <= cha.length - 1; i++) {
        if (cha[i] == ' ') {
          if (so > i) {
            start -= 1;
          }
          if (eo > i) {
            end -= 1;
          }
        }
      }
      // output with format
      try {
        fileWriter.write(lineID + "|" + start + " " + end + "|" + output.substring(so, eo)
                + "\n\r");
        fileWriter.flush();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
  }