NLP Unit 03
NLP Unit 03
Processing (KOE-088)
Unit - 03 (Grammars And Parsing)
Structure
Syntax
Formal Representation
Context-Free Grammar (CFG)
Probabilistic Context-Free Grammar (PCFG)
Back to Agenda Page
Parser
It is a software component that takes input and
checks it on several grammar rules if it is valid
then it generates a parse tree.
Grammar Checking
Intermediate Stage of semantic Analysis
Back to Agenda Page
Concept of Parser
1. Initialization
2. Prediction
3. Scanning
4. Completion
5. Repetition
Top Down Chart Parsing Algorithm Back to Agenda Page
Initialization
Start with an empty chart (a table used to store intermediate parsing results).
Initialize the chart with the start symbol of the grammar at the root.
Prediction
For each non-terminal in the chart, use the grammar rules to predict possible
expansions (productions) of that non-terminal.
Add these expansions to the chart.
Scanning
Compare the next word in the input sentence with the terminals in the chart.
If there’s a match, add this information to the chart.
Top Down Chart Parsing Algorithm Back to Agenda Page
Completion
Once all parts of a rule match the input, mark this rule as completed in the chart.
Use completed rules to complete higher-level rules that depend on them.
Repetition
Repeat the prediction, scanning, and completion steps until the entire input is
parsed or no more expansions are possible.
Top Down Chart Parsing Algorithm Back to Agenda Page
Example
Consider a simple grammar for a fragment of English:
S → NP VP
NP → Det N
VP → V NP
Det → 'the'
N → 'cat' | 'mat'
V → 'sat on'
Morphemes
Free & Bound
Word Formation
Inflection
Derivation
Compounding
Steps in Morphological Analysis Back to Agenda Page
Identification of Morphemes:
Derivation (happiness)
Compounding (sunflower)
Augmented Transition Network Back to Agenda Page
An Augmented Transition Network (ATN) is a type of computational model used in Natural Language
Processing (NLP) for parsing sentences. An ATN is like a flowchart that processes sentences by moving
through different states according to specific rules, augmented with additional capabilities to handle complex
language
Key Components
1. States: Points in the network representing different stages in the parsing process.
2. Transitions: Arrows connecting states, representing the rules for moving from one state to another.
4. Tests and Actions: Conditions that must be met to follow a transition and actions to be taken (like
How It Works
Word Tests: Checking if the next word in the input matches specific criteria (e.g., part of speech).
Push: Handling recursive structures by temporarily moving to a subroutine or another part of the
network.
Pop: Returning from a subroutine or another part of the network after processing a nested structure.
Actions: Operations like storing parts of the sentence in registers for later use.
Issues in Parsing Back to Agenda Page
Parsing in NLP involves analyzing the grammatical structure of sentences to derive their syntactic
1. Ambiguity:
Example: "I saw the man with the telescope" can mean either "I used a telescope to see the
2. Complex Sentences:
3) Non-Standard Grammar:
challenging to parse.
4) Error Propagation:
trees.
Incomplete sentences or sentences with errors (e.g., typos) can complicate parsing.