Skip to content

Ambiguous dependency parsing for negation #2277

@mbrine555

Description

@mbrine555

When using the dependency parser, it seems like there can be a lot of ambiguity when trying to assign negation, unlike with something like Stanford's parser.

For example:

import spacy
nlp = spacy.load("en_core_web_sm")
sentence = u"The camera is not pretty, but it is functional."
doc = nlp(sentence)

for token in doc:
    print(token.dep_ + "(" + token.head.text + ", " + token.text + ")")

returns

det(camera, The)
nsubj(is, camera)
ROOT(is, is)
neg(is, not)
acomp(is, pretty)
punct(is, ,)
cc(is, but)
nsubj(is, it)
conj(is, is)
acomp(is, functional)
punct(is, .)

This output seems to imply that the negation could refer to either acomp, which is not the case. A Stanford output for the same sentence looks something like:

det(camera-2, The-1)
nsubj(pretty-5, camera-2)
cop(pretty-5, is-3)
neg(pretty-5, not-4)
root(ROOT-0, pretty-5)
cc(pretty-5, but-7)
nsubj(functional-10, it-8)
cop(functional-10, is-9)
conj(pretty-5, functional-10)

Is there any way to clear up this ambiguity currently?

Your Environment

  • Python Version Used: 2.7.14
  • spaCy Version Used: 2.0.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions