问题
The website corenlp.run which is supposed to be CoreNLP's demo site, shows pretty different results from when I run the CoreNLP pipeline on my local machine.
The website actually shows the correct result, while the local machine version does not. I was wondering if anyone close to the CoreNLP project can explain the differences?
Case in point - this is what happens when I use this as an input "Give me a restaurant on Soquel Drive that serves good french food" (this is from the RestQuery dataset)
On CoreNLP (local machine, with Stanford's default model), I get this result:
root(ROOT-0, Give-1)
iobj(Give-1, me-2)
det(restaurant-4, a-3)
dobj(Give-1, restaurant-4)
case(Drive-7, on-5)
compound(Drive-7, Soquel-6)
nmod:on(Give-1, Drive-7) <--- WRONG HEAD
nsubj(serves-9, that-8)
acl:relcl(Drive-7, serves-9) <--- WRONG HEAD
amod(food-12, good-10)
amod(food-12, french-11)
dobj(serves-9, food-12)
While on corenlp.run, I get this result:
root(ROOT-0, Give-1)
iobj(Give-1, me-2)
det(restaurant-4, a-3)
dobj(Give-1, restaurant-4)
case(Drive-7, on-5)
compound(Drive-7, Soquel-6)
nmod:on(restaurant-4, Drive-7) <--- CORRECT HEAD
nsubj(serves-9, that-8)
acl:relcl(restaurant-4, serves-9) <--- CORRECT HEAD
amod(food-12, good-10)
amod(food-12, french-11)
dobj(serves-9, food-12)
You will note that there are two wrong heads in the local machine version. I have no idea why - especially if this is a model issue (I'm currently trying to debug the output of each annotator to see what the process returns)
These are the annotators I used: "tokenize,ssplit,pos,lemma,ner,parse,openie". The models are straight out of CoreNLP version 3.6.0
So can anyone help me understand why my results differ from the demo site's results?
回答1:
CoreNLP comes with multiple parsers to obtain constituency and dependency trees. The default parser is the PCFG constituency parser which outputs constituency trees that are then converted to dependency trees.
corenlp.run, on the other hand, uses the neural net dependency parser which directly outputs dependency trees that can be different from the output of the default pipeline.
In order to get the same output on your local machine, use the following annotators:
tokenize,ssplit,pos,lemma,ner,depparse,openie
(lemma
, ner
, and openie
are all optional in case you only need a dependency parse.)
来源:https://stackoverflow.com/questions/34539527/why-does-corenlp-run-yield-different-results-when-i-run-corenlp-locally