Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Subjects in Long Sentence Does Not Work #181

Closed
sachinkbarnwal opened this issue Jul 11, 2019 · 2 comments
Closed

Multiple Subjects in Long Sentence Does Not Work #181

sachinkbarnwal opened this issue Jul 11, 2019 · 2 comments

Comments

@sachinkbarnwal
Copy link

Mac OS: 10.14.5
Spacy: 2.1
NeuralCoreRef Version 4.0

Code Snippet:

import spacy
import neuralcoref
nlp =  spacy.load('en_core_web_lg') # create blank Language class
print("Created blank en_core_web_lg")
coref = neuralcoref.NeuralCoref(nlp.vocab, conv_dict={'Admin': ['man']})
nlp.add_pipe(coref, name='neuralcoref')
nlp.get_pipe('neuralcoref').set_conv_dict({'Admin': ['man']})
doc=nlp("Doctor updated teachers. He modifies locations. Order is also modified by him. Admin creates report. He also updates report. The Customer steals money. He stole items as well.")
resolved = doc._.coref_resolved
print(doc._.has_coref)
print(doc._.coref_clusters)
print(resolved)
print(doc._.coref_clusters[0].mentions)

Output

[Doctor: [Doctor, He, him, He, He]]
Doctor updated teachers. Doctor modifies locations. Order is also modified by Doctor. Admin creates report. Doctor also updates report. The Customer steals money. Doctor stole items as well.
[Doctor, He, him, He, He]

Expected Output:

Doctor updated teachers. Doctor modifies locations. Order is also modified by Doctor. Admin creates report. Admin also updates report. The Customer steals money. The Customer stole items as well.
Please suggest

@tnmcneil
Copy link

I am having the same problem - For me it can differentiate between male and female gendered pronouns but if I introduce a second male it resolves it to the first reference.

ex with the same code and using doc._.coref_resolved on the following text:

Frodo is a small English golden retriever who loves to eat juicy red apples. 
He thinks they are delicious. 
His friend's name is Mary, she works in San Mateo. 
Jeremy is going to the market. He wants a sandwich.

I get the resolved output:

Frodo is a small English golden retriever who loves to eat juicy red apples. 
Frodo thinks they are delicious. 
Frodo friend's name is Mary, Mary works in San Mateo. 
Frodo is going to the market. Frodo wants a sandwich.

so not only does it resolve all male pronouns to Frodo, it actually resolves the new entity Jeremy to be Frodo as well.
Let me know if you have found some solution! I am thinking of pruning the coref relations on a higher coref score but I don't love that idea.

@svlandeg
Copy link
Collaborator

Thanks for the report! Merging with Issue #215.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants