public static SpanFeatureAnnotation annotate(AnnotatedSentence sentence,
      FeatureVectorGenerator<StringContext> featureGenerator) {
    int numTerminals = sentence.size();
    Tensor[] featureVectors = new Tensor[numTerminals * (numTerminals + 1) / 2];
    for (int i = 0; i < numTerminals; i++) {
      for (int j = i; j < numTerminals; j++) {
        int spanIndex = getSpanIndex(i, j, numTerminals);
        featureVectors[spanIndex] = featureGenerator.apply(
            new StringContext(i, j, sentence));
      }
    }
    return new SpanFeatureAnnotation(featureVectors, numTerminals);
  }
public static SpanFeatureAnnotation annotate ( AnnotatedSentence sentence , FeatureVectorGenerator < StringContext > featureGenerator ) { int numTerminals = sentence . size ( ) ; Tensor [ ] featureVectors = new Tensor [ numTerminals * ( numTerminals + 1 ) / 2 ] ; for ( int i = 0 ; i < numTerminals ; i ++ ) { for ( int j = i ; j < numTerminals ; j ++ ) { int spanIndex = getSpanIndex ( i , j , numTerminals ) ; featureVectors [ spanIndex ] = featureGenerator . apply ( new StringContext ( i , j , sentence ) ) ; } } return new SpanFeatureAnnotation ( featureVectors , numTerminals ) ; }
Annotates the spans of {@code sentence} with feature vectors
created by applying {@code featureGenerator}.

@param sentence
@param featureGenerator
@return