sentenceB.add((HasWord) newLabel);
} else {
throw new AssertionError("This should have been a HasWord");
}
} else if (word instanceof HasTag) {
TaggedWord tw = new TaggedWord(word.word(), ((HasTag) word).tag());
sentenceB.add(tw);
} else {
sentenceB.add(new Word(word.word()));
}
}
for (HasWord word : sentenceB) {
word.setWord(op.wordFunction.apply(word.word()));
}
} else {
sentenceB = new ArrayList<HasWord>(sentence);
}
if (op.testOptions.addMissingFinalPunctuation) {
addedPunct = addSentenceFinalPunctIfNeeded(sentenceB, length);
}
if (length > op.testOptions.maxLength) {
parseSkipped = true;
throw new UnsupportedOperationException("Sentence too long: length " + length);
}
TreePrint treePrint = getTreePrint();
PrintWriter pwOut = op.tlpParams.pw();
//Insert the boundary symbol
if(sentence.get(0) instanceof CoreLabel) {
CoreLabel boundary = new CoreLabel();
boundary.setWord(Lexicon.BOUNDARY);
boundary.setValue(Lexicon.BOUNDARY);
boundary.setTag(Lexicon.BOUNDARY_TAG);
boundary.setIndex(sentence.size()+1);//1-based indexing used in the parser
sentenceB.add(boundary);
} else {
sentenceB.add(new TaggedWord(Lexicon.BOUNDARY, Lexicon.BOUNDARY_TAG));
}
if (Thread.interrupted()) {
throw new RuntimeInterruptedException();
}