You almost certainly still want to work by using a LexicalizedParser
. From that you can get a ParserQuery
object (just as the parse(List<? extends HasWord> lst)
method of LexicalizedParser
does) and then operate with it:
ParserQuery pq = myParser.parserQuery();
if (pq.parse(tokenLabels)) {
System.out.println("Viterbi probability is " + pq.getPCFGScore());
}