Explore Courses
Liverpool Business SchoolLiverpool Business SchoolMBA by Liverpool Business School
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA (Master of Business Administration)
  • 15 Months
Popular
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Business Administration (MBA)
  • 12 Months
New
Birla Institute of Management Technology Birla Institute of Management Technology Post Graduate Diploma in Management (BIMTECH)
  • 24 Months
Liverpool John Moores UniversityLiverpool John Moores UniversityMS in Data Science
  • 18 Months
Popular
IIIT BangaloreIIIT BangalorePost Graduate Programme in Data Science & AI (Executive)
  • 12 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
upGradupGradData Science Bootcamp with AI
  • 6 Months
New
University of MarylandIIIT BangalorePost Graduate Certificate in Data Science & AI (Executive)
  • 8-8.5 Months
upGradupGradData Science Bootcamp with AI
  • 6 months
Popular
upGrad KnowledgeHutupGrad KnowledgeHutData Engineer Bootcamp
  • Self-Paced
upGradupGradCertificate Course in Business Analytics & Consulting in association with PwC India
  • 06 Months
OP Jindal Global UniversityOP Jindal Global UniversityMaster of Design in User Experience Design
  • 12 Months
Popular
WoolfWoolfMaster of Science in Computer Science
  • 18 Months
New
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Rushford, GenevaRushford Business SchoolDBA Doctorate in Technology (Computer Science)
  • 36 Months
IIIT BangaloreIIIT BangaloreCloud Computing and DevOps Program (Executive)
  • 8 Months
New
upGrad KnowledgeHutupGrad KnowledgeHutAWS Solutions Architect Certification
  • 32 Hours
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Popular
upGradupGradUI/UX Bootcamp
  • 3 Months
upGradupGradCloud Computing Bootcamp
  • 7.5 Months
Golden Gate University Golden Gate University Doctor of Business Administration in Digital Leadership
  • 36 Months
New
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Golden Gate University Golden Gate University Doctor of Business Administration (DBA)
  • 36 Months
Bestseller
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDoctorate of Business Administration (DBA)
  • 36 Months
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (DBA)
  • 36 Months
KnowledgeHut upGradKnowledgeHut upGradSAFe® 6.0 Certified ScrumMaster (SSM) Training
  • Self-Paced
KnowledgeHut upGradKnowledgeHut upGradPMP® certification
  • Self-Paced
IIM KozhikodeIIM KozhikodeProfessional Certification in HR Management and Analytics
  • 6 Months
Bestseller
Duke CEDuke CEPost Graduate Certificate in Product Management
  • 4-8 Months
Bestseller
upGrad KnowledgeHutupGrad KnowledgeHutLeading SAFe® 6.0 Certification
  • 16 Hours
Popular
upGrad KnowledgeHutupGrad KnowledgeHutCertified ScrumMaster®(CSM) Training
  • 16 Hours
Bestseller
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 4 Months
upGrad KnowledgeHutupGrad KnowledgeHutSAFe® 6.0 POPM Certification
  • 16 Hours
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Science in Artificial Intelligence and Data Science
  • 12 Months
Bestseller
Liverpool John Moores University Liverpool John Moores University MS in Machine Learning & AI
  • 18 Months
Popular
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
IIIT BangaloreIIIT BangaloreExecutive Post Graduate Programme in Machine Learning & AI
  • 13 Months
Bestseller
IIITBIIITBExecutive Program in Generative AI for Leaders
  • 4 Months
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
IIIT BangaloreIIIT BangalorePost Graduate Certificate in Machine Learning & Deep Learning (Executive)
  • 8 Months
Bestseller
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Liverpool Business SchoolLiverpool Business SchoolMBA with Marketing Concentration
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA with Marketing Concentration
  • 15 Months
Popular
MICAMICAAdvanced Certificate in Digital Marketing and Communication
  • 6 Months
Bestseller
MICAMICAAdvanced Certificate in Brand Communication Management
  • 5 Months
Popular
upGradupGradDigital Marketing Accelerator Program
  • 05 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Corporate & Financial Law
  • 12 Months
Bestseller
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in AI and Emerging Technologies (Blended Learning Program)
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Intellectual Property & Technology Law
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Dispute Resolution
  • 12 Months
upGradupGradContract Law Certificate Program
  • Self paced
New
ESGCI, ParisESGCI, ParisDoctorate of Business Administration (DBA) from ESGCI, Paris
  • 36 Months
Golden Gate University Golden Gate University Doctor of Business Administration From Golden Gate University, San Francisco
  • 36 Months
Rushford Business SchoolRushford Business SchoolDoctor of Business Administration from Rushford Business School, Switzerland)
  • 36 Months
Edgewood CollegeEdgewood CollegeDoctorate of Business Administration from Edgewood College
  • 24 Months
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with Concentration in Generative AI
  • 36 Months
Golden Gate University Golden Gate University DBA in Digital Leadership from Golden Gate University, San Francisco
  • 36 Months
Liverpool Business SchoolLiverpool Business SchoolMBA by Liverpool Business School
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA (Master of Business Administration)
  • 15 Months
Popular
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Business Administration (MBA)
  • 12 Months
New
Deakin Business School and Institute of Management Technology, GhaziabadDeakin Business School and IMT, GhaziabadMBA (Master of Business Administration)
  • 12 Months
Liverpool John Moores UniversityLiverpool John Moores UniversityMS in Data Science
  • 18 Months
Bestseller
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Science in Artificial Intelligence and Data Science
  • 12 Months
Bestseller
IIIT BangaloreIIIT BangalorePost Graduate Programme in Data Science (Executive)
  • 12 Months
Bestseller
O.P.Jindal Global UniversityO.P.Jindal Global UniversityO.P.Jindal Global University
  • 12 Months
WoolfWoolfMaster of Science in Computer Science
  • 18 Months
New
Liverpool John Moores University Liverpool John Moores University MS in Machine Learning & AI
  • 18 Months
Popular
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (AI/ML)
  • 36 Months
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDBA Specialisation in AI & ML
  • 36 Months
Golden Gate University Golden Gate University Doctor of Business Administration (DBA)
  • 36 Months
Bestseller
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDoctorate of Business Administration (DBA)
  • 36 Months
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (DBA)
  • 36 Months
Liverpool Business SchoolLiverpool Business SchoolMBA with Marketing Concentration
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA with Marketing Concentration
  • 15 Months
Popular
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Corporate & Financial Law
  • 12 Months
Bestseller
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Intellectual Property & Technology Law
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Dispute Resolution
  • 12 Months
IIITBIIITBExecutive Program in Generative AI for Leaders
  • 4 Months
New
IIIT BangaloreIIIT BangaloreExecutive Post Graduate Programme in Machine Learning & AI
  • 13 Months
Bestseller
upGradupGradData Science Bootcamp with AI
  • 6 Months
New
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
KnowledgeHut upGradKnowledgeHut upGradSAFe® 6.0 Certified ScrumMaster (SSM) Training
  • Self-Paced
upGrad KnowledgeHutupGrad KnowledgeHutCertified ScrumMaster®(CSM) Training
  • 16 Hours
upGrad KnowledgeHutupGrad KnowledgeHutLeading SAFe® 6.0 Certification
  • 16 Hours
KnowledgeHut upGradKnowledgeHut upGradPMP® certification
  • Self-Paced
upGrad KnowledgeHutupGrad KnowledgeHutAWS Solutions Architect Certification
  • 32 Hours
upGrad KnowledgeHutupGrad KnowledgeHutAzure Administrator Certification (AZ-104)
  • 24 Hours
KnowledgeHut upGradKnowledgeHut upGradAWS Cloud Practioner Essentials Certification
  • 1 Week
KnowledgeHut upGradKnowledgeHut upGradAzure Data Engineering Training (DP-203)
  • 1 Week
MICAMICAAdvanced Certificate in Digital Marketing and Communication
  • 6 Months
Bestseller
MICAMICAAdvanced Certificate in Brand Communication Management
  • 5 Months
Popular
IIM KozhikodeIIM KozhikodeProfessional Certification in HR Management and Analytics
  • 6 Months
Bestseller
Duke CEDuke CEPost Graduate Certificate in Product Management
  • 4-8 Months
Bestseller
Loyola Institute of Business Administration (LIBA)Loyola Institute of Business Administration (LIBA)Executive PG Programme in Human Resource Management
  • 11 Months
Popular
Goa Institute of ManagementGoa Institute of ManagementExecutive PG Program in Healthcare Management
  • 11 Months
IMT GhaziabadIMT GhaziabadAdvanced General Management Program
  • 11 Months
Golden Gate UniversityGolden Gate UniversityProfessional Certificate in Global Business Management
  • 6-8 Months
upGradupGradContract Law Certificate Program
  • Self paced
New
IU, GermanyIU, GermanyMaster of Business Administration (90 ECTS)
  • 18 Months
Bestseller
IU, GermanyIU, GermanyMaster in International Management (120 ECTS)
  • 24 Months
Popular
IU, GermanyIU, GermanyB.Sc. Computer Science (180 ECTS)
  • 36 Months
Clark UniversityClark UniversityMaster of Business Administration
  • 23 Months
New
Golden Gate UniversityGolden Gate UniversityMaster of Business Administration
  • 20 Months
Clark University, USClark University, USMS in Project Management
  • 20 Months
New
Edgewood CollegeEdgewood CollegeMaster of Business Administration
  • 23 Months
The American Business SchoolThe American Business SchoolMBA with specialization
  • 23 Months
New
Aivancity ParisAivancity ParisMSc Artificial Intelligence Engineering
  • 24 Months
Aivancity ParisAivancity ParisMSc Data Engineering
  • 24 Months
The American Business SchoolThe American Business SchoolMBA with specialization
  • 23 Months
New
Aivancity ParisAivancity ParisMSc Artificial Intelligence Engineering
  • 24 Months
Aivancity ParisAivancity ParisMSc Data Engineering
  • 24 Months
upGradupGradData Science Bootcamp with AI
  • 6 Months
Popular
upGrad KnowledgeHutupGrad KnowledgeHutData Engineer Bootcamp
  • Self-Paced
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Bestseller
KnowledgeHut upGradKnowledgeHut upGradBackend Development Bootcamp
  • Self-Paced
upGradupGradUI/UX Bootcamp
  • 3 Months
upGradupGradCloud Computing Bootcamp
  • 7.5 Months
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 5 Months
upGrad KnowledgeHutupGrad KnowledgeHutSAFe® 6.0 POPM Certification
  • 16 Hours
upGradupGradDigital Marketing Accelerator Program
  • 05 Months
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
upGradupGradData Science Bootcamp with AI
  • 6 Months
Popular
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Bestseller
upGradupGradUI/UX Bootcamp
  • 3 Months
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 4 Months
upGradupGradCertificate Course in Business Analytics & Consulting in association with PwC India
  • 06 Months
upGradupGradDigital Marketing Accelerator Program
  • 05 Months

Dependency Parsing in NLP [Explained with Examples]

Updated on 22 September, 2022

15.82K+ views
7 min read

Natural Language Processing is an interdisciplinary concept that takes the fundamentals of computational linguistics and Artificial Intelligence to understand how human languages interact with technology.

NLP requires an in-depth understanding of various terminologies and concepts to apply them tangibly to real-world scenarios. Some of these basic concepts include Part-of-Speech(POS) Tagging, Statistical Language Modeling, Syntactic, Semantic and Sentiment Analysis, Normalization, Tokenization, Dependency Parsing, and Constituency Parsing, among others. 

In this article, we will look at the fundamentals of Dependency Parsing to gain perspective on how it is implemented in NLP.

Dependency Parsing

Dependency Parsing (DP) refers to examining the dependencies between the words of a sentence to analyze its grammatical structure. Based on this, a sentence is broken into several components. The mechanism is based on the concept that there is a direct link between every linguistic unit of a sentence. These links are termed dependencies.

Get Machine Learning Certification from the World’s top Universities. Earn Masters, Executive PGP, or Advanced Certificate Programs to fast-track your career.

Let’s take for example the sentence “I prefer the morning flight through Denver.”

The diagram below explains the dependency structure of the sentence:

Source

The relations between every linguistic unit, or word, of the sentence, is indicated using directed arcs in a typed dependency structure. As labelled in the diagram, the root of the tree “prefer” forms the head of the above sentence. 

The relationship between any two words is marked by a dependency tag. For instance, the word “flight” modifies the meaning of the noun “Denver.” Therefore, you can notice a dependency from flight -> Denver where the flight is the head and Denver is the child or dependent. It is denoted by nmod which represents a nominal modifier. 

This forms the case for dependency between every two words where one acts as the head and the other is the dependent. Currently, the Universal Dependency V2 taxonomy consists of 37 universal syntactic relations as specified in the table below:

Dependency Tag Description
acl clausal modifier of a noun (adnominal clause)
acl:relcl relative clause modifier
advcl adverbial clause modifier
advmod adverbial modifier
advmod:emph emphasizing word, intensifier
advmod:lmod locative adverbial modifier
amod adjectival modifier
appos appositional modifier
aux auxiliary
aux:pass passive auxiliary
case case-marking
cc coordinating conjunction
cc:preconj preconjunct
ccomp clausal complement
clf classifier
compound compound
compound:lvc light verb construction
compound:prt phrasal verb particle
compound:redup reduplicated compounds
compound:svc serial verb compounds
conj conjunct
cop copula
csubj clausal subject
csubj:pass clausal passive subject
dep unspecified dependency
det determiner
det:numgov pronominal quantifier governing the case of the noun
det:nummod pronominal quantifier agreeing in case with the noun
det:poss possessive determiner
discourse discourse element
dislocated dislocated elements
expl expletive
expl:impers impersonal expletive
expl:pass reflexive pronoun used in reflexive passive
expl:pv reflexive clitic with an inherently reflexive verb
fixed fixed multiword expression
flat flat multiword expression
flat:foreign foreign words
flat:name names
goeswith goes with
iobj indirect object
list list
mark marker
nmod nominal modifier
nmod:poss possessive nominal modifier
nmod:tmod temporal modifier
nsubj nominal subject
nsubj:pass passive nominal subject
nummod numeric modifier
nummod:gov numeric modifier governing the case of the noun
obj object
obl oblique nominal
obl:agent agent modifier
obl:arg oblique argument
obl:lmod locative modifier
obl:tmod temporal modifier
orphan orphan
parataxis parataxis
punct punctuation
reparandum overridden disfluency
root root
vocative vocative
xcomp open clausal complement

Dependency Parsing using NLTK

Dependency Parsing can be carried out using the Natural Language Toolkit (NLTK) package which is a collection of libraries and codes used in the statistical Natural Language Processing (NLP) of human language. 

We can use NLTK to achieve dependency parsing through one of the following methods: 

  1. Probabilistic, projective dependency parser: These parsers use the knowledge of human language gleaned from hand-parsed sentences to predict new sentences. They are known to make mistakes and work with a restricted set of training data. 
  2. Stanford parser: This is a natural language parser implemented on Java. You need the Stanford CoreNLP parser to perform dependency parsing. The parser includes several languages including English, Chinese, German, and Arabic. 

FYI: Free Deep Learning Course!

Here’s how you can use the parser:

from nltk.parse.stanford import StanfordDependencyParser

path_jar = ‘path_to/stanford-parser-full-2014-08-27/stanford-parser.jar’

path_models_jar = ‘path_to/stanford-parser-full-2014-08-27/stanford-parser-3.4.1-models.jar’

dep_parser = StanfordDependencyParser(

   path_to_jar = path_jar, path_to_models_jar = path_models_jar

)

result = dep_parser.raw_parse(‘I shot an elephant in my sleep’)

dependency = result.next()

list(dependency.triples())

The output of the above program is as follows: 

[

   ((u’shot’, u’VBD’), u’nsubj’, (u’I’, u’PRP’)),

   ((u’shot’, u’VBD’), u’dobj’, (u’elephant’, u’NN’)),

   ((u’elephant’, u’NN’), u’det’, (u’an’, u’DT’)),

   ((u’shot’, u’VBD’), u’prep’, (u’in’, u’IN’)),

   ((u’in’, u’IN’), u’pobj’, (u’sleep’, u’NN’)),

   ((u’sleep’, u’NN’), u’poss’, (u’my’, u’PRP$’))

]

Constituency Parsing

Constituency Parsing is based on context-free grammars. Here, the parse tree includes sentences broken into sub-phrases, each belonging to a grammar category. Every linguistic unit or word in a sentence acts as a terminal node, which has its parent node and a part-of-speech tag.

For example, the phrase “a cat” and “a box under the bed” are noun phrases, whereas “write a letter” and “drive a car” are verb phrases.

Let’s consider an example sentence “I shot an elephant in my pyjamas.” Here is a graphical representation of the constituency parse tree:

Source

The parse tree on the left refers to shooting an elephant wearing pyjamas and the parse tree on the right indicates the subject shooting an elephant while in his pyjamas. 

The entire sentence is broken into sub-phases until we have terminal words remaining. VP denotes a verb phrase and NP denotes noun phrases. 

Checkout: NLP Project Ideas & Topics

Dependency Parsing vs Constituency Parsing

Constituency parsing can also be implemented using the Stanford parser. It essentially parses a given sentence as per the constituency parser and subsequently converts the constituency parse tree into a dependency tree. 

If your goal is to break a sentence into sub-phrases, you should implement constituency parsing. However, if you want to explore the dependencies between the words in a sentence, you should use dependency parsing.

Conclusion

If you found this article helpful, you should check out upGrad’s 6-month PG Certification in Machine Learning and NLP that offers personalised mentorship from industry experts of Flipkart, Gramener, and Zee5. 

The program is designed for engineers, software/ IT, Data & other professionals looking to get a foothold in Data Science and Machine Learning. This Post Graduate Certification from IIIT BBangalorethe boasts a 58% average salary hike is all you need to land advanced positions of Data Analyst, Data Scientist, ML Engineer, and NLP Engineer in top companies. Block your seat today at just Rs. 3,034 per month!

Frequently Asked Questions (FAQs)

1. What is the use of dependency parsing in NLP?

In natural language processing, dependency parsing is a technique used to identify semantic relations between words in a sentence. Dependency parsers are used to map the words in a sentence to semantic roles, thereby identifying the syntactic relations between words. Dependency parsing is a well-known approach for syntactic analysis of natural language texts at the surface structure level. In this method, the syntactic structure of a sentence is recovered from a linear sequence of word tokens, by analyzing the syntactic dependencies between words and identifying the syntactic category of each word.

2. What are the applications of dependency parsing?

Here is a list of several application areas where dependency parsing is used. One of the major uses of dependency parsing is in semantic role labeling (SRL) and information extraction, which are components of natural language processing. Dependency parsing is also used for syntactic chunking and constituency parsing outside of NLP tasks. Dependency parsing is fundamentally different from phrase structure parsing, which maps the words in a sentence to the corresponding phrase marker or tree structure.

3. What is the basic difference between syntactic parsing and dependency parsing?

The difference between syntactic parser and dependency parser is that, a dependency parser builds a parse tree and a syntactic parser builds a syntax tree. Syntactic parsing involves using predefined rules to define syntax and a dependency parser, on the other hand, can understand all kinds of phrases and also can deal with ambiguous input. A dependency parser can be used for phrase recognition, chunking , dependency analysis, chunking and parsing.