IKnowHowBitcoinWorks
IKnowHowBitcoinWorks

Reputation: 349

How to get spaCy to use universal dependencies

Spacy's site said they use universal dependencies scheme in their annotations specifications page. But when I parse "I love you", '''you''' was made a "dobj" of "love". There's no "dobj" in the universal dependency relations doc. So I have two questions :

  1. How to get spacy to use the universal dependency relations?
  2. How to get the doc for the relations spacy uses?

enter image description here

Upvotes: 2

Views: 1964

Answers (3)

hosford42
hosford42

Reputation: 412

It turns out, dobj is one of the universal dependency relations. It's just been changed in the latest revision.

From the official UDR website:

It is a revised version of the relations originally described in Universal Stanford Dependencies: A cross-linguistic typology (de Marneffe et al. 2014).

In the paper cited above, you can see multiple references to dobj, despite its absence from the table on the UDR website.

Upvotes: 0

aab
aab

Reputation: 11474

Spacy's provided models don't use UD dependencies for English or German. From the docs, where you can find tables for the dependency labels (https://spacy.io/api/annotation#dependency-parsing):

The individual labels are language-specific and depend on the training corpus.

For most other models / languages, UD dependencies are used.

Upvotes: 3

Anwarvic
Anwarvic

Reputation: 12992

How to get spacy to use the universal dependency relations?

According to the spaCy official documentation, all spaCy models are trained using the Universal Dependency Corpora which is language-specific. According to English, you can see the full list of labels from this link where you can find dojb listed as direct object.

How to get the doc for the relations spacy uses?

I don't know what you mean by doc. If you mean documentation, I already provided the official documentation when answering the first question. Also, you can use spacy.explain() to get faster results like so:

>>> import spacy
>>>
>>> spacy.explain('dobj')
direct object
>>>
>>> spcay.explain('nsubj')
nominal subject

Hope this answers your question!

Upvotes: 1

Related Questions