}
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();
}
if (op.doPCFG) {
if (!pparser.parse(sentenceB)) {
return parseSucceeded;
}
if (op.testOptions.verbose) {
pwOut.println("PParser output");
// getBestPCFGParse(false).pennPrint(pwOut); // with scores on nodes
treePrint.printTree(getBestPCFGParse(false), pwOut); // without scores on nodes
}
}
if (Thread.interrupted()) {
throw new RuntimeInterruptedException();
}
if (op.doDep && ! op.testOptions.useFastFactored) {
if ( ! dparser.parse(sentenceB)) {
return parseSucceeded;
}
// cdm nov 2006: should move these printing bits to the main printing section,
// so don't calculate the best parse twice!
if (op.testOptions.verbose) {
pwOut.println("DParser output");
treePrint.printTree(dparser.getBestParse(), pwOut);
}
}
if (Thread.interrupted()) {
throw new RuntimeInterruptedException();
}