@Override
  public void process(JCas arg0) throws AnalysisEngineProcessException {
    String text = arg0.getDocumentText();
    TokenizerFactory<Word> factory = PTBTokenizerFactory.newTokenizerFactory();
    
    // iterate all the questions and retrieve the tokens
    FSIndex<?> qIndex = arg0.getAnnotationIndex(Question.type);
    Iterator<?> qIter = qIndex.iterator();
    while (qIter.hasNext()) {
      Question question = (Question) qIter.next();
      Tokenizer<Word> tokenizer = factory.getTokenizer(new StringReader(text.substring(
              question.getBegin(), question.getEnd() - 2)));
      while (tokenizer.hasNext()) {
        Token annotation = new Token(arg0);
        Word temp = tokenizer.next();
        annotation.setBegin(temp.beginPosition() + question.getBegin());
        annotation.setEnd(temp.endPosition() + question.getBegin());
        annotation.setCasProcessorId(this.getClass().getName());
        annotation.setConfidence(1);
        annotation.addToIndexes();
      }
    }

    // iterate all the answers and retrieve the tokens
    FSIndex<?> aIndex = arg0.getAnnotationIndex(Answer.type);
    Iterator<?> aIter = aIndex.iterator();
    while (aIter.hasNext()) {
      Answer answer = (Answer) aIter.next();
      Tokenizer<Word> tokenizer = factory.getTokenizer(new StringReader(text.substring(
              answer.getBegin(), answer.getEnd() - 2)));
      while (tokenizer.hasNext()) {
        Token annotation = new Token(arg0);
        Word temp = tokenizer.next();
        annotation.setBegin(temp.beginPosition() + answer.getBegin());
        annotation.setEnd(temp.endPosition() + answer.getBegin());
        annotation.setCasProcessorId(this.getClass().getName());
        annotation.setConfidence(1);
        annotation.addToIndexes();
      }
    }
  }