// /
if (!filteredIterator.hasNext()) {
throw new RuntimeException(
"Surrounding sentence annotation not found!!");
}
Annotation sentenceAnnotation = filteredIterator.next();
Sentence sentence = (Sentence) sentenceAnnotation;
int lineNumber = sentence.getSentenceNumber() + 1;
// FSIterator<Annotation> tokensInSentenceIterator = jcas
// .getAnnotationIndex(baseTokenTypeId).subiterator(sentence);
//
// if (!tokensInSentenceIterator.hasNext()) {
// throw new RuntimeException("First token in sentence not found!!");
// }
// Annotation firstTokenAnnotation = tokensInSentenceIterator.next();
// BaseToken firstToken = (BaseToken) firstTokenAnnotation;
// int firstTokenInSentenceNumber = firstToken.getTokenNumber();
FSIterator<Annotation> beginTokenInSentenceIterator = constraintConstructorFindContainedWithin
.createFilteredIterator(problemBegin, problemEnd, baseTokenType);
// if (!beginTokenInSentenceIterator.hasNext()) {
// throw new RuntimeException("First token in sentence not found!!");
// }
// Annotation beginTokenAnnotation =
// beginTokenInSentenceIterator.next();
// BaseToken beginToken = (BaseToken) beginTokenAnnotation;
// int beginTokenNumber = beginToken.getTokenNumber();
// int beginTokenWordNumber = beginTokenNumber
// - firstTokenInSentenceNumber;
BaseToken beginToken = this
.getNextNonEOLToken(beginTokenInSentenceIterator);
int beginTokenWordNumber = this.sentenceToTokenNumberMap.get(sentence)
.indexOf(beginToken);
beginTokenInSentenceIterator.moveToLast();
if (!beginTokenInSentenceIterator.hasNext()) {
throw new RuntimeException("First token in sentence not found!!");
}
Annotation endTokenAnnotation = beginTokenInSentenceIterator.next();
BaseToken endToken = (BaseToken) endTokenAnnotation;
// int endTokenNumber = endToken.getTokenNumber();
// int endTokenWordNumber = endTokenNumber - firstTokenInSentenceNumber;
int endTokenWordNumber = this.sentenceToTokenNumberMap.get(sentence)
.indexOf(endToken);