Module I Introduction
Module I Introduction
ASET
NLP
Module I Introduction
Dr. Sweta Srivastava
1
Module I : Introduction ASET
• What is NLP
• Modern day concepts of NLP
• Biology of Speech Processing
• Place and Manner of Articulation
• Word Boundary Detection
• Argmax based computations
• HMM and Speech Recognition
2
NLP ASET
computer
artificial science,
intelligence
(AI),
linguistics
Natural Language
Processing
3
NLP ASET
4
Goals of NLP ASET
5
Key Applications of NLP ASET
7
NLP Example ASET
•NLP Principles:
•The process of creating Kiliki mirrors NLP techniques, such as:Lexicon
Development: Defining the words (morphemes) and their meanings (semantics).
•Syntax and Grammar: Establishing rules for how words are combined to form
meaningful sentences (morphosyntax).
•Phonology and Morphology: Determining the sounds and structure of words.
8
NLP Example ASET
10
NLP Example ASET
11
NLP Example ASET
12
NLP Example ASET
13
NLP Example ASET
15
Biology of Speech ASET
Processing
• Speech processing in humans involves a complex interaction
between auditory perception, language comprehension, and
motor control. Key components include:
– Auditory Input & Perception
– Speech Recognition & Language Processing
– Semantic & Syntactic Processing
– Motor Output for Speech
16
Biology of Speech ASET
Processing
1. Auditory Input & Perception
• Cochlea (inner ear): Converts sound waves into neural signals.
• Auditory nerve: Transmits signals to the brainstem and auditory
cortex.
• Primary auditory cortex (in temporal lobe): Analyzes basic sound
features like pitch and loudness.
2. Speech Recognition & Language Processing
• Wernicke’s area (posterior temporal lobe):
• Interprets words and meaning.
• Critical for understanding spoken language.
• Broca’s area (inferior frontal gyrus):
• Involved in speech production and grammatical processing.
• Helps organize words into sentences.
17
Biology of Speech ASET
Processing
Semantic & Syntactic Processing
• Angular gyrus & supramarginal gyrus:
• Interface between auditory and visual language input.
• Prefrontal cortex:
• Higher-order planning, working memory, and pragmatics
of language.
19
ASET
20
Relevance to NLP & ASET
Speech Technology
1. Speech Recognition
• Systems like automatic speech recognition (ASR) mimic how the brain decodes audio
into linguistic units (phonemes, words).
• Neural networks (especially CNNs and RNNs) simulate hierarchical auditory processing.
2. Representation Learning
• Self-supervised learning (e.g., wav2vec 2.0 by Facebook AI) learns speech features
similar to how the auditory cortex builds internal representations.
• Contrastive learning in these models is akin to how the brain differentiates between similar
sounds in context.
3. Cognitive-Inspired Models
• Models like Transformer-based ASR and language models reflect cortical hierarchies in
processing sequential and contextual information.
4. Multimodal Integration
• Human speech understanding is often multisensory (visual cues like lip movement),
which is being incorporated into multimodal NLP models.
21
ASET
Phases of NLP
22
Phases of NLP ASET
Semantic Syntactic
Pragmatics
Analysis, Analysis,
Discourse.
23
Phonetic and Phonology ASET
24
Phonology ASET
Articulation
• Place of articulation (where in the vocal tract the constriction
occurs)
• Manner of articulation (how the airstream is affected as it flows
through the vocal tract)
• Voicing (whether the vocal cords vibrate)
26
Place of Articulation ASET
Alveolar (tongue and alveolar ridge, e.g., [t], [d], [s], [z], [n], [l])
Plosive (Stop): Complete blockage of airflow ([p], [b], [t], [d], [k], [g])
Fricative: Partial blockage, turbulent airflow ([f], [v], [s], [z], [ʃ], [ʒ], [θ], [ð], [h])
Voiced sounds: vocal cords vibrate (e.g., [b], [d], [g], [v],
[z])
Applications in NLP:
•Speech Recognition: Understanding articulatory features helps in mapping
audio to phonemes.
•Speech Synthesis: Text-to-speech systems use these to mimic realistic
pronunciation.
•Phoneme Embedding: Used in neural networks for modeling phonetic
features.
•Accent Detection and Correction: Identifying misarticulations based on this
chart.
29
ASET
30
Word Boundary Detection ASET
31
Word Boundary Detection ASET
Tokenization
• The process of breaking text into smaller units like words, subwords, or
sentences.
Parsing
• Analyzing the grammatical structure of a sentence to identify
relationships between words.
Named entity recognition
• Identifying and classifying proper names in text into categories like
person, organization, or location.
Machine translation
32
Techniques for Word ASET
Boundary Detection
• Rule-Based Methods
– Use handcrafted rules based on grammar or known word lists.
– Pros: Simple, interpretable.
– Cons: Not scalable or robust to new data/languages.
33
Techniques for Word Boundary ASET
Detection:
Rule based Methods
Rule Creation:
Based on the desired tasks, domain-specific linguistic rules are created
such as grammar rules, syntax patterns, semantic rules or regular
expressions.
Rule Application:
The predefined rules are applied to the inputted data to capture matched
patterns.
Rule Processing:
The text data is processed in accordance with the results of the matched
rules to extract information, make decisions or other tasks.
Rule refinement:
The created rules are iteratively refined by repetitive processing to
improve accuracy and performance. Based on previous feedback, the
rules are modified and updated when needed. 34
Techniques for Word ASET
Boundary Detection
• Dictionary-Based Matching
– Greedy algorithms (e.g., Maximum Matching) scan text to match known
words.
– Limitations: Struggle with unknown or ambiguous words.
Greedy Approach:
These algorithms make the locally optimal choice at each step, aiming for the
longest possible word match. For example, in the phrase "themendinehere", a
greedy algorithm might first match "theme" as the longest word, then continue
from "n".
35
Techniques for Word ASET
Boundary Detection:
Dictionary-Based Matching
[Link]
36
segmentation-maximal-matching-1-ed2ad5cab4fc
Techniques for Word ASET
Boundary Detection
• Statistical Approaches
– n-gram models: Estimate the likelihood of word sequences.
– Bayesian segmentation: Infers most probable word boundaries given a
probabilistic model.
Bayesian segmentation aims to find the optimal way to divide a sequence (e.g.,
a string of characters) into meaningful units (e.g., words).
How it works:
This approach uses a probabilistic model and Bayes' theorem to calculate the
probability of different segmentations. It looks for the segmentation that is most
likely given the model and the input sequence.
Example:
In a sequence like "thisisatest", Bayesian segmentation might infer that the
most likely word boundaries are "this is a test".
37
Techniques for Word ASET
Boundary Detection
• Machine Learning/ Deep Learning Approaches
– Supervised learning: Trained on labeled corpora (e.g., CRFs,
HMMs).
– Features used: Character sequences, POS tags, punctuation,
context windows.
– RNNs / LSTMs / Transformers:
– Learn context-aware features automatically.
– Can handle noisy or unseen data better than traditional ML.
– Often used in languages without whitespace or for speech data.
38
Techniques for Word ASET
Boundary Detection
39
Morphology ASET
40
Types of Morphological ASET
Processing in NLP
1. Stemming
•Reduces a word to its base/root form by chopping off affixes.
•Often crude; may produce non-words.
•Example:
• "connection", "connected" → "connect"
2. Lemmatization
•Returns the dictionary base form (lemma) of a word.
•Considers context and POS (Part-of-Speech).
•Example:
• "was" → "be", "better" → "good"
41
Types of Morphological ASET
Processing in NLP
42
Challenges in ASET
Morphological Analysis
Ambiguity:
One form may map to multiple lemmas
Word: saw
Possible lemmas:
• see (past tense of the verb): "I saw a bird."
• saw (noun, a tool): "He used a saw to cut wood."
Complex Word Forms:
Some languages can have entire sentences as one word.
uncharacteristically
• un- = not
• character = root noun
• -istic = relating to
• -ally = adverb form
In a way that is not typical of someone’s character
Sparse Data:
Rare or unseen morphological variants in training data.
Low-frequency or constructed words.
43
Lexical Analysis in NLP ASET
Morphological Processing:
It breaks down words into root forms and affixes. For example, "dogs" is reduced to the
root "dog" by stripping the plural suffix.
Role in Advanced NLP Tasks:
Lexical knowledge is essential for tasks like Question Answering, where machines must
understand meaning and infer real-world knowledge (e.g., knowing that a dog lives a lifespan
implies it is a living being).
Answering questions like "How many years does a dog live?" requires deep semantic
information and inferencing, which comes from rich lexical resources.
Main Challenge – Word Sense Disambiguation (WSD):
A key difficulty in lexical analysis is determining the correct meaning of a word in context,
45
making WSD one of the most complex problems in NLP.
Lexical Disambiguation in ASET
NLP
Part of Speech (POS) Disambiguation
Words often belong to multiple parts of speech depending on context.
Example: “Dog”
•Noun: “The dog barked loudly.” (animal)
•Verb: “He dogged her footsteps.” (to pursue)
Sense Disambiguation
A single word may have multiple meanings (senses) within the same
part of speech.
Example: “Dog” as a noun
•Sense 1: A domesticated animal.
•Sense 2: A despicable or detestable person.
Goal: Determine the correct sense of the word given its semantic
context.
46
Lexical Disambiguation in ASET
NLP
Importance of Word Relationships in Context
Understanding meaning requires looking at how words relate to each
other.
Examples:
•“The chair emphasized the need for adult education.”
→ "Chair" = person (not furniture)
•“Watch what you want, when you want.”
→ “Watch” =
•Verb (to view)
•Noun (TV or timepiece)
•“Groundbreaking ceremony” vs. “Groundbreaking research”
→ Same word ("groundbreaking"), different interpretations (event vs.
innovative idea)
•Context is key: Without analyzing surrounding words, disambiguation is
not possible.
47
Language Change Driven ASET
by Technology
• Language evolves constantly, and technological advancements are
one of the biggest drivers of new terms, redefined meanings, and
nuanced expressions.
• This is especially relevant in NLP and linguistics, where word
meanings must be understood in a contemporary context.
by Technology
"Communifaking" – Mobile Age "Helicopter Parenting" – Metaphor for
Behavior Overparenting
•Coined from “communication” + •Derived from helicopter hovering overhead.
“faking”. •Means:
•Meaning: Pretending to talk on a ➤ Parents who constantly monitor or interfere in their
mobile phone when you're not. children’s lives.
•Use case:
➤ A humorous example is using this "Texto" and "Speako" – Inspired by "Typo"
to escape a boring meeting. •Typo = a typing mistake.
•Reflects how mobile culture •Texto = a mistake while texting/SMS.
influences social behavior and •Speako = a mistake while speaking.
language. •Emerging from casual communication and mobile
culture.
50
Syntax Processing Stage ASET
• After the system has processed individual words, the next major step is
understanding the structure of a sentence — how words combine to form
phrases and sentences.
• This is essential for the system to derive meaning, relationships, and hierarchical
structure from natural language input.
• This goes beyond word-level analysis and looks at how words form phrases,
clauses, and sentences according to grammatical rules.
Breakdown
Let’s consider the sentence:
•S → Sentence
•NP → Noun Phrase
•VP → Verb Phrase Dependency Structure:
•V → Verb like → I (subject)
•N → Noun like → mangoes (object)
Key Concept: Parsing
•Parsing = converting a sentence into a tree-like syntactic structure
•Enables machines to understand grammar rules, phrase dependencies, and
relationships between words 52
Syntax Processing ASET
Scope Ambiguity
Occurs when it’s unclear how far a modifier or quantifier extends.
Example 1:
“The old men and women were taken to safe locations.”
•Reading A: [The old men] and women → Only men are old
•Reading B: The old [men and women] → Both men and women are old
Ambiguity: Does "old" modify both "men and women" or just "men"?
Example 2:
“No smoking areas will allow hookahs inside.”
•Meaning A: Areas where smoking is not allowed → won’t allow hookahs
•Meaning B: No areas (whatsoever) that allow smoking will allow hookahs
Ambiguity: What does “No” apply to — the smoking areas or the allowance? 54
Challenges in Syntactic ASET
56
A Case of Misleading ASET
Structure
Example: “The old man the boat.”
Explanation:
•Initial parse: The old man → assumed as noun phrase
•Problem: Where’s the verb?
•Reanalysis:
• “man” = verb (to operate/steer)
• “the old” = noun (adjective used as noun → old people)
• Correct interpretation:
The old [people] man [steer] the boat.
Key Learning:
•Part-of-speech ambiguity causes garden pathing.
•"man" as noun or verb.
57
Core Parsing Challenge ASET
[Link] modern transformers like BERT handle garden path sentences well?
[Link] strategies can be added to a parser to avoid backtracking errors?
[Link] would you rewrite garden path sentences to make them clearer?
58
Implications in NLP ASET
59
Quiz ASET
Possible Interpretations:
1.I used binoculars to see the man in the park.
➤ "with the binoculars" modifies the verb saw → instrument of seeing.
[Link] man I saw had the binoculars.
➤ "with the binoculars" modifies the noun man → describes the man.
[Link] binoculars are in the park.
➤ "in the park" modifies binoculars (less likely, but grammatically
possible).
4.I saw the man while I was in the park.
➤ "in the park" modifies the verb saw → location of action.
[Link] man was in the park, and I saw him.
➤ "in the park" modifies man → describes the man's location.
Ambiguity arises from Prepositional Phrase (“with the binoculars”, “in
the park”) and their attachment points (verb vs. noun).
60
Quiz ASET
• Meaning 1:
• The cameraman took a photo of a man who had a gun, while the man was near
Tendulkar.
• Meaning 2:
• The cameraman took a photo of a man using his (the cameraman's) own (camera’s)
gun, while he (cameraman) was near Tendulkar.
• Meaning 3:
• The cameraman used a gun to shoot the man, and the man was near Tendulkar. 61
Structural Ambiguity ASET
Definition:
Occurs when a sentence can be parsed in more than one way due to its
structure.
Examples:
• I did not know my PDA(personal digital assistant) had a phone for 3 months.
• The cameraman shot the man with the gun when he was near Tendulkar.
• Jill had rubbed ointment on Mike the Irish Terrier, taken a look at the goldfish
belonging to the cook, which had caused anxiety in the kitchen by refusing its
ant’s egg.
• (Times of India) Aid for kins of cops killed in terrorist attacks.
This ambiguity arises because the phrase "for 3 months" can grammatically attach to either:
the verb "did not know" (modifying the knowing)
Or
the verb phrase "had a phone" (modifying the possession)
A parser must determine which attachment makes more sense based on context—something that’s often
unclear without world knowledge or pragmatics. 62
Major Sources of ASET
Sentence Ambiguity
•Multiple meanings of words
•Multiple attachment points of prepositional phrases
•Clause attachment points
Example - Multiple Example - Prepositional Example - Clause
Meanings of Words Phrase Attachment Attachment
of Higher-Level Knowledge
Why Disambiguation is Hard in NLP?
•Sentences can have multiple valid parses due to:
•Prepositional phrase (PP) attachments
•Clause attachment ambiguity
Knowledge
•Semantics – Word meaning and logic
65
Semantics for ASET
Disambiguation
Sentence:
“I saw the boy with a ponytail.”
Parser’s output:
•Option A (correct): “The boy has a ponytail.”
•Option B (illogical): “I used a ponytail to see the boy.”
66
Pragmatics for ASET
Disambiguation
Sentence:
“Old men and women were taken to safe locations.”
Two interpretations:
1.(Old men) and (women) → only men are old.
2.(Old men and women) → both men and women are old.
Real world reasoning:
Younger individuals may be expected to assist in active roles, such as helping with
evacuation or response efforts.
Older individuals, are typically prioritized for relocation to safe locations due to
greater vulnerability.
Therefore, it's more plausible that the word "old" qualifies only the group that is
less likely to assist actively.
Semantics also accepts both (both men and women can be old).
But pragmatics prefers the interpretation where only men are old.
Pragmatics uses contextual expectations and real-world knowledge to resolve 67
ambiguity.
Discourse-Level Ambiguity ASET
Sentence:
“No smoking areas allow hookahs inside.”
Two readings:
[Link] A:
•Areas labeled “No smoking” do allow hookahs (but not cigars).
[Link] B:
•No area allows hookahs inside at all (strict ban).
This ambiguity is resolved by adding context (discourse).
follow-up sentences to clarify:
Sentence A:
“No smoking areas allow hookahs inside, except the one in Hotel Grand.”
•This implies that no area allows hookahs, except one exception.
•Supports Interpretation B: Hookahs are banned, except at Hotel Grand.
68
Q&A ASET
69
NLP Project Assignments ASET
1. POS Tagging with Rule-Based vs NLTK Models
Implement a basic rule-based part-of-speech (POS) tagger using simple grammar rules
for English, and compare its performance against NLTK’s statistical POS tagger. Write a
short analysis on how both systems handle ambiguous words like “book” or “can.”
Thank You…!!
71