@SuppressWarnings("unchecked")
  //we are feeding in the proper type so casting should not be an issue
  private List<NGram> getNGrams(Annotation textAnnotation, JCas aJCas) {
    int annotationBegin = textAnnotation.getBegin();
    int annotationEnd = textAnnotation.getEnd();
    Iterator<NGram> ngramIter = (Iterator<NGram>) getAnnotationsFromIndex(aJCas, NGram.type);
    // Linked List used because we will be converting to an iterator
    List<NGram> relevantNGrams = new LinkedList<NGram>();
    while (ngramIter.hasNext()) {
      NGram ngram = (NGram)ngramIter.next();
      // check that the token is for this sentence
      if (ngram.getBegin() >= annotationBegin && ngram.getEnd() <= annotationEnd) {
        relevantNGrams.add(ngram);
      }
    }
    return relevantNGrams;
  }