从Neuralcoref网站获得不同的结果?

时间:2019-08-21 09:57:38

标签: python nlp spacy

我正在使用Neuralcoref查找共同引用。 trial version of website给出的结果与我使用pip安装的版本不同。版本是:

1. spacy==2.1.3 (as it will not work on spacy > 2.1.4)
2. neuralcoref==4.0

我正在测试的代码是:

import spacy
nlp = spacy.load('en')

# load NeuralCoref and add it to the pipe of SpaCy's model
import neuralcoref
neuralcoref.add_to_pipe(nlp)

# You're done. You can now use NeuralCoref as you usually manipulate a SpaCy document annotations.
doc = nlp(u'I love my father and my mother. They work hard. She is always nice but he is sometimes rude.')
print(doc._.coref_resolved)

它给出输出:

I love my father and my mother. my father and my mother work hard. my mother is always nice but he is sometimes rude.

与此示例类似:

# Input:

London is the capital and most populous city of England and the United Kingdom. Standing on the River Thames in the south east of the island of Great Britain, it has been a major settlement for two millennia. It was founded by the Romans, who named it Londinium

# Output:

London is the capital and most populous city of England and the United Kingdom. Standing on the River Thames in the south east of the island of Great Britain, the River Thames has been a major settlement for two millennia. the River Thames was founded by the Romans, who named the River Thames Londinium

在第一个示例中,问题是:最后没有拿起he作为对父亲的引用。

在第二个示例中,问题是:它正在拿起River Thames来代替London,这是错误的。

但是在in网站上,两个示例都可以正常工作。

Example 1 Example 2

不明白有什么区别吗?

0 个答案:

没有答案