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

Dependency parser missing dependencies / incorrectly parsing #57

Closed
NSchrading opened this issue Apr 21, 2015 · 6 comments
Closed

Dependency parser missing dependencies / incorrectly parsing #57

NSchrading opened this issue Apr 21, 2015 · 6 comments

Comments

@NSchrading
Copy link

The parser used to correctly parse several example sentences that I have, but it is now incorrectly parsing them. I'm not sure when it stopped working, since I hadn't checked its output in a while. I am on python 3.4, spacy v0.83, fully updated data with "python -m spacy.en.download all"

Examples of errors:
This one is from your blog (https://honnibal.wordpress.com/2013/12/18/a-simple-fast-algorithm-for-natural-language-dependency-parsing/)

def printDeps(toks):
    for tok in toks:
        print(tok.orth_, tok.dep_, tok.pos_, [t.orth_ for t in tok.lefts], [t.orth_ for t in tok.rights])

toks = nlp("They ate the pizza with anchovies.")
printDeps(toks)
They SUB PRON [] []
ate  VERB ['They'] ['pizza', 'with', '.']      <------- error "with" is connected to "ate"
the NMOD DET [] []
pizza OBJ NOUN ['the'] []
with VMOD ADP [] ['anchovies']            <------- error "with" is categorized as verb modifier
anchovies PMOD NOUN [] []
. P PUNCT [] []
toks = nlp("i don't have other assistance")
printDeps(toks)
i SUB NOUN [] []
do  VERB ['i'] ["n't", 'have']    <---- Error "do"'s dep_ = "" and dep = 0
n't VMOD ADV [] []
have VC VERB [] ['assistance']
other NMOD ADJ [] []
assistance OBJ NOUN ['other'] []
toks = nlp("I have no other financial assistance available and he certainly won't provide support.")
printDeps(toks)
# add a comma and it works
toks = nlp("I have no other financial assistance available, and he certainly won't provide support.")
printDeps(toks)
I SUB PRON [] []
have VMOD VERB ['I'] ['available']    <------- Error, should have ['assistance'] in right deps
no NMOD DET [] []
other NMOD ADJ [] []
financial NMOD ADJ [] []
assistance SUB NOUN ['no', 'other', 'financial'] []   <----- Error, labeled as SUB not OBJ
available VMOD ADJ ['assistance'] []   <---- Error, labeled as VMOD rather than NMOD
and VMOD CONJ [] []
he SUB PRON [] []
certainly VMOD ADV [] []
wo  VERB ['have', 'and', 'he', 'certainly'] ["n't", 'provide', '.']  <---- Error, missing dep_
n't VMOD ADV [] []
provide VC VERB [] ['support']
support OBJ NOUN [] []
. P PUNCT [] []

I SUB PRON [] []
have VMOD VERB ['I'] ['assistance']
no NMOD DET [] []
other NMOD ADJ [] []
financial NMOD ADJ [] []
assistance OBJ NOUN ['no', 'other', 'financial'] ['available']
available NMOD ADJ [] []
, P PUNCT [] []
and VMOD CONJ [] []
he SUB PRON [] []
certainly VMOD ADV [] []
wo  VERB ['have', ',', 'and', 'he', 'certainly'] ["n't", 'provide', '.']   <--- Error, missing dep_
n't VMOD ADV [] []
provide VC VERB [] ['support']
support OBJ NOUN [] []
. P PUNCT [] []


@elyase
Copy link
Contributor

elyase commented Apr 22, 2015

Thanks for noticing that, I was getting crazy thinking I made something wrong. These are the results for 0.70:

>>> toks = nlp("They ate the pizza with anchovies.")
>>> printDeps(toks)
They SUB PRON [] []
ate ROOT VERB ['They'] ['.', 'with', 'pizza']
the NMOD DET [] []
pizza OBJ NOUN ['the'] []
with VMOD ADP [] ['anchovies']
anchovies PMOD NOUN [] []
. P PUNCT [] []

>>> toks = nlp("i don't have other assistance")
>>> printDeps(toks)
i SUB PRON [] []
do ROOT VERB ['i'] ['have', "n't"]
n't VMOD ADV [] []
have VC VERB [] ['assistance']
other NMOD ADJ [] []
assistance OBJ NOUN ['other'] []

>>> toks = nlp("I have no other financial assistance available and he certainly won't provide support.")
>>> printDeps(toks)
I SUB PRON [] []
have VMOD VERB ['I'] ['assistance']
no NMOD DET [] []
other NMOD ADJ [] []
financial NMOD ADJ [] []
assistance OBJ NOUN ['no', 'other', 'financial'] ['available']
available NMOD ADJ [] []
and VMOD CONJ [] []
he SUB PRON [] []
certainly VMOD ADV [] []
wo ROOT VERB ['have', 'and', 'he', 'certainly'] ['.', 'provide', "n't"]
n't VMOD ADV [] []
provide VC VERB [] ['support']
support OBJ NOUN [] []
. P PUNCT [] []

# with a comma

>>> toks = nlp("I have no other financial assistance available, and he certainly won't provide support.")
>>>  printDeps(toks)

I SUB PRON [] []
have VMOD VERB ['I'] ['assistance']
no NMOD DET [] []
other NMOD ADJ [] []
financial NMOD ADJ [] []
assistance OBJ NOUN ['no', 'other', 'financial'] ['available']
available NMOD ADJ [] []
, P PUNCT [] []
and VMOD CONJ [] []
he SUB PRON [] []
certainly VMOD ADV [] []
wo ROOT VERB ['have', ',', 'and', 'he', 'certainly'] ['.', 'provide', "n't"]
n't VMOD ADV [] []
provide VC VERB [] ['support']
support OBJ NOUN [] []
. P PUNCT [] []

@elyase
Copy link
Contributor

elyase commented Apr 22, 2015

Comparing with version 0.70 it looks like when dependencies are missing in 0.83, they are ROOT in 0.70.

@honnibal
Copy link
Member

Okay, I've got the root label bug sorted out.

I've also investigated a potential loss of parse quality. I've fixed some bugs that were long present, and parse quality is actually up slightly over previous metrics. However, the specific eat/pizza/anchovies case is a difficult PP attachment example, and the model may get any individual case such as this incorrect.

Do you have evidence of aggregate performance degradation for your use, outside of the ROOT-label bug?

@elyase
Copy link
Contributor

elyase commented May 2, 2015

I don't. It seems that most of the problems I was experiencing were related to the ROOT bug.

@honnibal
Copy link
Member

Fix for the ROOT bug rolled out in v0.84. Please remember to re-download the data, as bug fixes to the feature calculation mean that the old model will be out-of-sync with the new feature calculation code. Please re-open this issue if the problem does not seem to be resolved.

@lock
Copy link

lock bot commented May 9, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants