[英]java program to get parse score of a sentence using stanford parser
I am able to get the output of Tags and words for the sentence like "My name is Rahul." 我能够获得像“我的名字是拉胡尔”这样的句子的标签和单词的输出。 as
如
My/PRP$, name/NN, is/VBZ, Rahul/NNP, ./.]
我/ PRP $,名称/ NN,是/ VBZ,Rahul / NNP,。/。]
with the program: 与该计划:
LexicalizedParser lp = LexicalizedParser.loadModel(
"edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz"
);
lp.setOptionFlags(new String[]{"-maxLength", "80", "-retainTmpSubcategories"});
String sent = "My name is Rahul";
Tree parse = (Tree) lp.apply(sent);
List taggedWords = parse.taggedYield();
System.out.println(taggedWords);
But, I also need to get the parse score of the sentence. 但是,我还需要获得句子的解析分数。 Is there any kind of modification that I can do to my program to get the parse score?
我可以对我的程序进行任何修改以获得解析分数吗?
Thanks. 谢谢。
Tree
类有一个分数方法,你可以调用它来获得句子的分数。
double score = parse.score();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.