@Override
 public boolean incrementToken() throws IOException {
   if (iterator == null) {
     initializeIterator();
   }
   if (iterator.hasNext()) {
     clearAttributes();
     AnnotationFS next = iterator.next();
     termAttr.append(next.getCoveredText());
     offsetAttr.setOffset(correctOffset(next.getBegin()), correctOffset(next.getEnd()));
     typeAttr.setType(featurePath.getValueAsString(next));
     return true;
   } else {
     return false;
   }
 }
 @Override
 protected void initializeIterator() throws IOException {
   try {
     analyzeInput();
   } catch (AnalysisEngineProcessException | ResourceInitializationException e) {
     throw new IOException(e);
   }
   featurePath = cas.createFeaturePath();
   try {
     featurePath.initialize(typeAttributeFeaturePath);
   } catch (CASException e) {
     featurePath = null;
     throw new IOException(e);
   }
   finalOffset = correctOffset(cas.getDocumentText().length());
   Type tokenType = cas.getTypeSystem().getType(tokenTypeString);
   iterator = cas.getAnnotationIndex(tokenType).iterator();
 }