← View in Interactive Graph

11. Phrase Structure Parsing And Dependency Parsing

1. Phrase Structure Parsing (Constituency Parsing)

Definition: Phrase Structure Parsing identifies the nested phrase structure of a sentence by breaking it down into constituents (phrases like Noun Phrases, Verb Phrases, etc.). It typically relies on rules from Context-Free Grammar (CFG).

Common Phrase Types

Phrase Type Meaning Example
NP Noun Phrase the lazy dog
VP Verb Phrase eats an apple
PP Prepositional Phrase in the garden
ADJP Adjective Phrase very tall
ADVP Adverb Phrase quite slowly

Structural Example

Sentence: "The dog barked loudly."

Tree Representation:

(S
  (NP (DT The) (NN dog))
  (VP (VBD barked) 
      (ADVP (RB loudly)))
)

Breakdown:

2. Dependency Parsing

Definition: Dependency Parsing determines how words are related to each other using head-dependent relations (e.g., subject, object, modifier). Unlike phrase structure parsing, it connects words directly using directed arcs (Head \toDependent).

Dependency Example

Sentence: "The dog barked loudly."

Visual Logic:

      [ROOT]
         |
       barked
       /    \
     dog   loudly
      |
     The

Dependency Relation Types

Relation Meaning
nsubj Nominal subject
dobj Direct object
amod Adjective modifier
advmod Adverbial modifier
det Determiner
prep Prepositional modifier
pobj Object of a preposition
ROOT Root verb of the sentence

3. Comparison: Phrase Structure vs. Dependency Parsing

Feature Phrase Structure Parsing Dependency Parsing
Structure Type Constituency tree (Nested phrases) Dependency tree (Word-to-word links)
Focus Phrase grouping (NP, VP) Head-dependent word relations
Root Sentence (S) Main verb (ROOT)
Used In Grammar-based NLP Modern NLP (syntax, translation, extraction)
Tools NLTK, Berkeley Parser spaCy, Stanza, UDPipe

4. Applications of Parsing

Application Usage
Question Answering Understanding Subject-Verb-Object relationships to pinpoint answers.
Machine Translation Essential for sentence reordering between languages with different grammar rules.
Grammar Correction Identifying incorrect structures or broken dependencies.
Information Extraction Extracting specific relations like Subject-Action.
Semantic Role Labeling Understanding the underlying meaning and roles within a sentence.

Tags: #data-engineering #sql

Machine_Learning_Concepts_In_Programming