Dependency parsers are tools that allow us to analyze sentences, with particular focus on their grammatical structure.

As evidenced by their name, dependency parsers allow us to parse the sentences and find the dependencies.

When analyzing and parsing the sentences, dependency parsers are looking for the so-called “head” words. In analyzing dependencies, they show how those head words depend on other words and in particular, how other words “change” or “modify” the head words.

To illustrate this let us use the open source library spacy. Spacy is versatile in many NLP tasks and it also includes an excellent dependency parser (you may also check out the other state of the art tool in this field – Stanford CoreNLP).

If we apply spacy dependency parsing on the sentence “They are driving fast”, we get the following nice diagram:

 

 

The outgoing arrows indicate that the word “fast” modifies the word driving with the nature of their relation described by special tags, in this case advmod.

Some of other modifiers are:

  • acl: clausal modifier of noun (adjectival clause)
  • advcl: adverbial clause modifier
  • amod: adjectival modifier
  • appos: appositional modifier

Note that the given sentence can have different possible parse trees. Syntactic disambiguation is selection of correct parse tree from different parse possibilities.

You can generate the above diagram with the following code:

import spacy
from spacy import displacy

nlp = spacy.load("en_core_web_sm")
doc = nlp("They are driving fast.")
displacy.serve(doc, style="dep")

There are also excellent online tools for dependency parsing, e.g. the same sentence can be analyzed with this tool:

https://explosion.ai/demos/displacy?text=They%20are%20driving%20fast&model=en_core_web_sm&cpu=1&cph=1

obtaining a nice, publication-ready diagram:

 

Usage of dependency parsing

Dependency parsing is an important tool in many areas of NLP:

  • grammar checking
  • information extraction
  • aspect based sentiment analysis
  • named entity recognition
  • question answering
  • document summarization

In our company we have built several complex, multi-rule dependency parsers for two areas from the list. If you have a project with dependency parsing requirements or need more information in this field, we also offer consulting and/or custom made solutions in this area.

Get in Touch

Do you need consultation or have a project in mind? We would love to hear from you!

Get in Touch