Semantics and Pragmatics in NLP
Semantics and Pragmatics in NLP
1
What is Pragmatics?
Pragmatics is the study of how context influences the interpretation of
meaning.
It looks at:
• Who is speaking?
• What is the situation?
• What is the speaker’s intention?
• What does the listener understand?
Pragmatics = Meaning based on context and intention
Example of Pragmatics:
• Sentence: “It’s cold in here.”
Semantically, it just means the temperature is low.
But pragmatically, the meaning could be:
• A request: "Please close the window."
• A complaint: "I’m not comfortable."
• A hint: "Let’s go somewhere warmer."
So pragmatics looks at what the speaker actually meant in a particular
context.
Key Concepts in Pragmatics:
1. Deixis: Words like here, there, you, now — whose meaning depends on
who is speaking and when.
2. Presupposition: Background assumptions.
o E.g., “John stopped smoking.” → Assumes John used to smoke.
3. Speech Acts: Saying something is doing something (e.g., "I promise" is
making a promise).
4. Implicature: Hidden meaning understood indirectly.
o E.g., “Can you pass the salt?” is actually a request, not a question
about ability.
Semantics vs Pragmatics – A Quick Comparison
2
Aspect Semantics Pragmatics
Example “It’s cold” = low temperature “It’s cold” = Close the window?
4
Example:
If it knows:
"John is a doctor"
and "Doctors treat patients",
It should infer: "John treats patients".
7. Minimal Redundancy
• Should not store repetitive or duplicate meanings of a sentence
unnecessarily.
Example: Don't store the same word vector multiple times if the word appears
often.
8. Generalization (Handle New Sentences)
• Should work for new or unseen sentences or phrases, not just the ones
seen in training.
Example:
Even if the model never saw “The boy fed the giraffe,” it should still
understand it using knowledge of verbs and nouns.
9. Scalability
• Should support large vocabulary and many documents without slowing
down or crashing.
NLP models like GPT or BERT handle millions of sentences, so representation
must be scalable.
10. Consistency
• Words or phrases should always be represented in the same way in
similar contexts.
Example:
The word “bank” in the context of money should not be confused with the
riverbank.
This is often solved using contextual word embeddings (like BERT).
Summary Table (NLP-Focused)
5
Requirement NLP Meaning (Simple)
6
Natural language (like English, Tamil, or Hindi) is full of ambiguity and
complex structure. For example:
"Every student loves a teacher."
This sentence can have different meanings depending on how we interpret "a
teacher."
FOL helps by:
• Representing the exact meaning
• Removing confusion
• Allowing logical reasoning
So, in NLP, FOL is used for:
• Understanding sentence meaning (semantics)
• Question answering
• Information extraction
• Knowledge representation
• Chatbots and dialogue systems
3. Components of FOL
Let’s understand the building blocks of FOL in NLP.
State properties or
Predicates Student(x), Loves(x, y)
relationships
7
• Student is a predicate, and John is a constant.
Example 2: "All students study."
• FOL: ∀x (Student(x) → Studies(x))
• Means: "For every x, if x is a student, then x studies."
Example 3: "Some students play football."
• FOL: ∃x (Student(x) ∧ PlaysFootball(x))
• Means: "There is at least one x who is a student and plays football."
Example 4: "Every teacher teaches some student."
• FOL: ∀x (Teacher(x) → ∃y (Student(y) ∧ Teaches(x, y)))
• Means: "For every x, if x is a teacher, then there exists a y such that y
is a student and x teaches y."
5. Logical Reasoning in NLP
Once we represent sentences in FOL, we can perform reasoning. That means
we can derive new facts from existing ones.
Example:
• ∀x (Student(x) → Studies(x))
• Student(Ravi)
We can deduce: Studies(Ravi)
This is called inference. It’s very useful in:
• Chatbots that answer questions
• Intelligent systems that make decisions
• Semantic search engines
6. FOL vs Natural Language
8
7. How NLP Systems Use FOL
Semantic Parsing
Semantic parsing is the task of converting a sentence into a logical form (like
FOL).
Example:
Sentence: “Which students play football?”
FOL: λx. Student(x) ∧ PlaysFootball(x)
This helps the system understand exactly what is being asked and how to
answer it.
Information Extraction
From text like:
“John lives in Paris and works at Google.”
FOL can extract and represent:
• LivesIn(John, Paris)
• WorksAt(John, Google)
These facts can be stored in a knowledge base for future queries.
Dialogue Systems and Chatbots
Chatbots can use FOL to:
• Understand user intentions
• Maintain logical consistency
• Give relevant responses
Example:
• User: “Does Ravi study?”
• Bot checks if Studies(Ravi) is true in its knowledge base using FOL.
Machine Translation
FOL helps preserve logical meaning when translating from one language to
another.
For example:
• English: “All birds can fly.”
• FOL: ∀x (Bird(x) → CanFly(x))
9
8. Limitations of FOL in NLP
• Human language is rich and vague.
• FOL is rigid and can’t capture emotion, sarcasm, or contextual meaning
easily.
• Handling uncertainty is difficult in FOL. (That’s why probabilistic logic
is also used in NLP.)
9. Summary
Point Explanation
10
Meaning: For every x, if x is a doctor, then x helps patients.
Example 5: "There is a boy who likes all kinds of fruits."
This has a universal quantifier inside an existential quantifier.
Chatbots/Virtual
Maintains conversation logic, avoids contradictions
Agents
11
Description Logics (DL) are a family of formal knowledge representation
languages used to represent the structure of knowledge in a domain.
In simple words:
Description Logics help us describe concepts (things), their relationships, and
their properties in a clear, logical way — so that machines can understand
and reason about them.
They are used in Artificial Intelligence to build ontologies and knowledge-
based systems.
Where Are Description Logics Used?
• Ontologies (like in the Semantic Web)
• Knowledge Representation
• Reasoning Systems
• Medical Terminologies (e.g., SNOMED)
• OWL (Web Ontology Language) is based on DL
Simple Comparison
12
Examples:
• hasChild
• teaches
• drives
3. Individuals (a, b, c) = Objects or Instances
Actual members of concepts.
Examples:
• Ravi, Car1, BTI_College
Example Knowledge Representation
Let’s write some common sentences in DL form.
Example 1: “All teachers are persons.”
In DL:
Teacher ⊑ Person
This means: Every teacher is a person
(Teacher is a subclass of Person)
Example 2: “Ravi is a student.”
In DL:
Student(Ravi)
Ravi is an individual of the class Student.
Example 3: “A student has at least one subject.”
In DL:
Student ⊑ ∃[Link]
Every student is related to at least one subject via the role hasSubject.
Example 4: “No student is a teacher.”
In DL:
Student ⊓ Teacher ⊑ ⊥
Means: The intersection of Student and Teacher is empty (no one can be both).
Summary of Symbols in Description Logics
13
Symbol Meaning Example
14
Based on
Tool/Ontology Language Purpose
DL?
Feature Explanation
15
• A DL ontology is a structured knowledge base made up of:
o Concepts (like Doctor, Person)
o Roles or Relationships (like hasSpecialization)
o Individuals (like John, Ravi)
Step-by-Step Explanation
Let’s break this down into steps, so it’s easy to understand.
Step 1: Use the Grammar (Syntax) of the Sentence
Grammar tells us how words are arranged and how they relate to each other.
Sentence: "John is a doctor who specializes in cardiology."
The grammar helps us break this sentence into parts:
• Main clause: "John is a doctor"
• Sub-clause: "who specializes in cardiology"
This structure tells us that:
• John is a person.
• John is a doctor.
• John has a specialization in cardiology.
So, we use the structure to guide the meaning.
Step 2: Map Parts to Logical Concepts (DL Ontology)
Now we map these parts into DL concepts and relationships.
What do we have?
• John: an individual
• Doctor: a concept (class)
• Cardiology: another concept
• specializes in: a relationship (role)
16
What Does the Machine Understand?
Now that we’ve mapped the sentence into DL:
• The machine knows who John is.
• It knows that Doctor is a type of Person.
• It knows that John has a specialization in Cardiology.
So it can now:
• Answer questions like “Who specializes in Cardiology?”
• Classify people into roles (e.g., doctors, specialists)
• Draw conclusions using logical reasoning
Why Use This Approach?
Reason Explanation
Real-Life Example
Let’s take another sentence:
Sentence: "Ravi is a teacher who teaches Artificial Intelligence."
1. Break into syntax:
o Main clause: "Ravi is a teacher"
o Sub-clause: "who teaches Artificial Intelligence"
2. Use DL concepts:
o Ravi: Individual
o Teacher: Concept
o Artificial Intelligence: Concept
o teaches: Role
3. DL representation:
Teacher ⊑ Person
17
Ravi : Teacher
teaches(Ravi, ArtificialIntelligence)
The sentence is now machine-readable, stored in a knowledge base, and ready
to be used in AI applications.
Key Assumption
The core belief of this approach is:
“The grammar of a sentence reflects its meaning.”
So if we understand the structure, we can figure out the meaning. This makes
the approach reliable, especially for AI systems that rely on logic and
reasoning.
Summary
Concept Explanation
Semantic attachments
What are Semantic Attachments?
Semantic Attachments are a way of labeling who does what to whom in a
sentence.
They tell us the meaning-based roles that words or phrases play in a sentence,
based on the action (verb) and the participants involved in that action.
In simple words:
When you read a sentence, you can usually answer:
• Who is doing the action?
18
• What is the action?
• What is being affected by the action?
• How or with what is the action being done?
These answers help us understand the roles that different parts of the
sentence play.
These roles are called:
• Agent
• Patient
• Instrument
• Location
• Experiencer, etc.
Each of these is a semantic attachment or semantic role.
Key Components
Let’s break this down:
Term Meaning
Location Where the action happens "in the kitchen" (if added)
19
Example (in "John ate the pizza
Role Description
with a fork")
Phrase Role
John Agent
ate Action
pizza Patient
So, each phrase in the sentence is attached to the verb “ate” with a specific
semantic role.
Why Is It Important?
In Natural Language Processing (NLP):
Computers need to understand:
• Who is doing what?
• What objects are involved?
• What tools are being used?
• What is being affected?
By labeling roles with semantic attachments, NLP systems can:
• Understand sentence meaning
• Answer questions
20
• Translate accurately
• Extract information from text
Real-Life Example for Students
Sentence: “Ravi gave the book to Priya.”
Word/Phrase Role
21
Concept Explanation
Semantic
Labels that show the role of each part of a sentence
Attachments
22
What Are Semantic Attachments?
Semantic Attachments are a way to attach meaning to each word in a
sentence by:
• Looking at its role (like Agent, Patient, etc.)
• And also, by identifying its correct sense in context.
They help NLP systems (like chatbots, translators, search engines)
understand:
• What the word really means
• What concept or entity it refers to
Example in Detail
Let’s take the word “bank”.
Sentence 1: "I deposited money in the bank."
• Here, “bank” means a financial institution.
• The word is linked to concepts like:
o money
o savings
o loans
o accounts
So, the semantic attachment is:
• Word: bank
• Sense: financial institution
• Attachment: links to concepts like money, loan, ATM, etc.
Sentence 2: "The kids played near the bank of the river."
• Here, “bank” means the side of a river.
• It’s linked to:
o water
o shore
o trees
o sand
Semantic attachment becomes:
• Word: bank
23
• Sense: river bank
• Attachment: links to river, shore, nature, etc.
Why Do We Need Semantic Attachments?
In Natural Language Processing (NLP), understanding the correct sense of a
word is very important.
Otherwise, a computer might:
• Think you're talking about a money bank when you actually mean
riverbank!
• Translate or respond incorrectly.
By using semantic attachments, the machine:
• Picks the correct meaning from possible meanings
• Connects it to the right concepts
This helps in:
Process Summary
When a sentence is given:
1. The system looks at the word (e.g., “bank”).
2. It checks the context (surrounding words like “money” or “river”).
3. It identifies the correct sense (financial institution or riverside).
4. It attaches this word to the correct concepts.
5. Now, the sentence can be understood correctly by the computer.
Real-Life Analogy for Students
Think of a dictionary.
A word like “light” has many meanings:
• Not heavy
• Bright
24
When you use the word in a sentence, your brain picks the right meaning by
looking at the full sentence.
Computers are not as smart as human brains. So, semantic attachments help
them do the same thing — understand the meaning based on context.
Practice Example
Sentence: “She saw the bat in the cave.”
• Word: bat
• Possible senses:
o An animal (linked to flying, night, caves)
o A cricket bat (linked to sports, games)
The word “cave” gives a clue → So, “bat” here refers to the animal.
Semantic attachment:
• Word: bat
• Sense: animal
• Attachment: linked to cave, wings, flying
Summary
👉 Example:
The word “car” is related to:
25
• “vehicle” (more general word)
• “automobile” (same meaning)
• “bus” or “bike” (similar category)
• “wheel” or “engine” (parts of a car)
These kinds of semantic relations help machines understand how words are
connected in meaning.
Why Is This Important in NLP?
When we speak or write:
• We use many words that mean similar things or are related in some
way.
• Computers and NLP systems need to understand these relations to
work properly in tasks like:
o Word sense disambiguation (choosing correct meaning)
o Information retrieval (finding related documents)
o Machine translation (using correct words in another language)
Types of Semantic Relations
Let’s understand the main types of relations between word senses, using very
simple examples.
🔸 1. Hyponymy / Hypernymy
Relation: "Is-a" relationship
• A Hyponym is a more specific word.
• A Hypernym is a more general word.
Example Explanation
"Vehicle" is a hypernym of "Car", "Bike", "Bus" These are all types of vehicles
🔸 2. Synonymy
Relation: Same or very similar meaning
26
Example Explanation
👉 Used in search engines: When you search “automobile,” it also finds “car.”
🔸 3. Antonymy
Relation: Opposite meanings
Example Explanation
🔸 4. Meronymy / Holonymy
Relation: Part-to-whole relationship
• A Meronym is a part of something
• A Holonym is the whole
Example Explanation
🔸 5. Troponymy
Relation: Specific way of doing an action
• It’s used for verbs.
• A troponym is a specific kind of action.
Example Explanation
27
Example Explanation
28
Semantic Relation Meaning Example
Applications in NLP
Thematic Roles
What are Thematic Roles?
When you write or say a sentence, you usually describe an action and the
people or things involved in that action.
👉 Example:
“John kicked the ball.”
• Someone (John) is doing the action.
• Something (the ball) is affected by the action.
These different participants in the sentence have different roles.
These roles are called thematic roles.
Why Are Thematic Roles Important?
In Natural Language Processing (NLP) and linguistics, machines need to:
• Understand who did what to whom
• Understand how entities are involved in an action or event
Thematic roles help us identify:
29
• Who is doing the action?
• What is affected by the action?
• Where or how is the action happening?
Common Thematic Roles (with Simple Examples)
Let’s now look at the main types of thematic roles using simple sentences:
🔸 1. Agent
The person or thing that does the action.
“The dog barked.” The dog is the one doing the action
🔸 2. Patient
The person or thing that is affected by the action.
“She broke the vase.” The vase got broken (was affected)
🔸 3. Theme
The thing that is moved, given, or talked about.
“John gave the book to Mary.” The book is what is being given
💡 Tip: Sometimes similar to patient, but more neutral — just what the
sentence is about.
🔸 4. Experiencer
The person or thing that feels or experiences something (emotions,
perceptions, etc.)
30
Example Sentence Experiencer
🔸 5. Instrument
The thing that is used to perform the action.
🔸 6. Location
The place where the action happens.
🔸 7. Source
The place or person from which something comes or starts.
“He got the gift from his friend.” His friend is the source
🔸 8. Goal
The place or person towards which something moves or is directed.
“He gave the gift to his friend.” His friend is the goal
31
💡 Tip: Goal = destination or endpoint.
Let’s See It All Together
Sentence:
“John gave the book to Mary at the library with a pen.”
John Agent
Mary Goal
Summary Table
Information
Identifying who did what, to whom, where
Extraction
32
NLP Task How Thematic Roles Help
Selectional restrictions
What Are Selectional Restrictions?
Selectional restrictions (also known as semantic constraints) are rules about
which types of words can go together, especially when you're using verbs
(actions) and their arguments (subjects, objects, etc.).
👉 They make sure that the meaning of a sentence makes sense, not just its
grammar.
Simple Definition:
Selectional restrictions are rules that control which kinds of words can be
used with a verb, based on their meaning.
Example:
🔸 1. Syntactic Restrictions
Based on grammar and the structure of the sentence.
Example:
33
• Transitive verb: needs two arguments (subject + object)
→ “She kicked the ball.”
• Intransitive verb: needs only one argument (subject)
→ “He sleeps.”
Incorrect use:
• “She kicked.” → Incomplete (missing object for a transitive verb)
• “He sleeps the bed.” → Wrong structure (intransitive verb used with
object)
🔸 2. Semantic Restrictions
Based on the meaning of the words involved.
Example:
• “The baby drank milk.” → Makes sense: milk is drinkable.
Example:
• “The baby drank rocks.” → Doesn’t make sense: rocks are not
drinkable.
🔸 3. Selectional Preferences
Some verbs prefer certain kinds of subjects or objects more than others.
Example:
• “The teacher gave the student a book.”
o “Give” likes three arguments: giver (agent), receiver (goal), and
thing given (theme).
Example:
• “The chair gave the student a book.” → Strange: a chair cannot give.
🔸 4. Prototypicality Effects
Some verbs prefer objects with typical features.
Example:
• “She ate rice.” – Makes sense.
• “He ate metal.” – Sounds weird.
Even though grammatically correct, semantically it feels odd, because “metal”
is not a typical food item.
🔸 5. Frame Semantics
34
Think of verbs as part of an event frame — a situation that includes
participants and roles.
Example (for “buy”):
• The buyer, the seller, the item, and the money are all part of the buying
frame.
→ “John bought a car from the dealer for $10,000.”
This helps NLP systems understand complete events, not just word meanings.
Use in NLP Applications
Is It
Sentence Why?
Valid?
Summary
35
Key Point Explanation
✏️ Final Analogy:
Think of a verb like a machine that accepts only certain inputs:
• The verb “eat” expects something like food.
• If you give it a stone, the machine doesn’t work — it’s an error.
Word Sense Disambiguation
What is Word Sense Disambiguation?
WSD stands for Word Sense Disambiguation.
It means:
Finding the correct meaning (sense) of a word when it has more than one
meaning, based on the context in which it is used.
Why is this needed?
Because many English words have multiple meanings, and we need to figure
out the correct one depending on the sentence.
Example:
Take the word "bank":
• In “He went to the bank to deposit money,” → bank = financial
institution
• In “She sat by the bank of the river,” → bank = riverbank
Both sentences are correct, but the word "bank" means different things.
👉 WSD helps us figure out which "bank" the sentence is talking about.
Why is WSD Important?
1. Ambiguity Resolution
Natural language is full of ambiguity. Words can mean many things.
→ WSD helps us remove confusion and choose the correct meaning.
2. Improves Accuracy
In tasks like translation or text analysis, if we get the meaning of a
36
word wrong, the whole output can be wrong.
→ WSD ensures better accuracy.
3. Better Precision
Helps in reducing false positives (wrong results) and false negatives
(missed results) when retrieving or analyzing information.
4. Helps in Language Understanding
Computers need to understand context just like humans do.
→ WSD brings machines closer to human-like understanding.
5. Useful in Information Retrieval
When you search something on Google, WSD helps ensure that the
search engine shows relevant results, not random ones.
Techniques Used in WSD
WSD can be done using different methods or algorithms:
🔹 1. Rule-Based Methods
• Use a set of hand-written rules to determine meaning.
• For example:
o If the word “bank” is near words like money, deposit, then it
likely means financial bank.
o If it is near river, water, shore, then it means riverbank.
✅ Simple to create
❌ Can’t handle all cases well
🔹 2. Knowledge-Based Methods
• Use dictionaries, thesauruses (like WordNet), and definitions to
compare the context with word meanings.
Example: Using a dictionary, compare the surrounding words in the sentence
with each meaning of the word to find the best match.
37
• Use unlabeled data, try to group word usages into clusters (each
cluster representing a sense).
Real-Life Analogy
Imagine you’re reading the word "crane".
• In a bird-watching blog, you guess it's a bird.
• In a construction site manual, you guess it's a machine.
• In a yoga guide, it could be a yoga pose.
👉 You understood the correct meaning each time using context — that’s
what WSD does!
Summary Table
Concept Explanation
🔹 1. Supervised Approach
What is it?
• Just like teaching a child with examples, this approach trains a
machine using labeled data (sentences where the meanings of words
are already known).
• The model learns from those examples and then applies that learning
to predict the meaning of the same word in new sentences.
How it works:
• You prepare a training dataset where each sentence has a word whose
correct meaning is labeled.
• Then, you use a machine learning algorithm to train a model.
• Once trained, the model can read a new sentence and guess the correct
meaning.
Example:
Sentence:
“I went to the bank to deposit my paycheck.”
• The word bank could mean:
o A financial institution, or
o The side of a river
→ A supervised model uses examples like this, along with clue words like
“deposit,” “paycheck,” “money,” and learns that in this context, bank =
financial institution.
39
Common Algorithm:
Naive Bayes Classifier (a simple and fast machine learning algorithm used in
NLP)
Summary:
Feature Description
🔹 2. Dictionary-Based Approach
What is it?
• This approach uses dictionary definitions to understand the possible
meanings of a word.
• It compares those meanings with the words around the target word in
the sentence (context) and selects the best match.
Example:
Sentence:
“I love to play the bass guitar.”
• The word bass can mean:
o A type of fish
o A musical instrument with low pitch
→ The dictionary lists both meanings. But based on nearby words like "play"
and "guitar", we match it to the musical instrument sense.
Tools used:
Dictionaries like WordNet, Oxford, Merriam-Webster, etc.
Summary:
Feature Description
40
🔹 3. Thesaurus-Based Approach
What is it?
• This method uses a thesaurus or semantic network to find related or
similar words.
• Then it checks which group of related words best fits the sentence.
Example:
Sentence:
“The company's revenue has been steadily increasing.”
• The word increase could mean:
o A rise in profits
o A rise in size
o Or just a general growth
→ A thesaurus will group “increase” with growth, improvement, gain, etc.
→ Based on surrounding words like “revenue” and “steadily,” it guesses the
correct meaning: financial growth.
Tools used:
• Thesaurus
• WordNet
• Semantic networks (like ConceptNet)
Summary:
Feature Description
Needs
Approach Based On Pros Cons
Training?
Machine
High accuracy if Needs a lot of
Supervised learning with ✅ Yes
trained labeled data
labeled data
41
Needs
Approach Based On Pros Cons
Training?
May not
Dictionary- Definitions of Easy to use,
❌ No handle vague
Based words human-readable
contexts well
Understands
Thesaurus- Groups of Might be less
❌ No word
Based similar words precise
relationships
Real-Life Analogy
Let’s say you’re learning the meaning of “bark”.
• Supervised: Your teacher gives you examples of “bark” as dog sound
and tree covering, so you learn when to use which.
• Dictionary-Based: You check a dictionary, read meanings and pick the
right one based on sentence.
• Thesaurus-Based: You group “bark” with similar words like “woof,”
“howl” or “tree,” and guess which group fits best.
Final Thoughts
Word Sense Disambiguation is key to understanding language correctly.
These approaches help computers and AI systems understand what we really
mean when we use ambiguous words.
Bootstrapping methods
What is Bootstrapping?
The word bootstrapping means starting with a little and growing gradually by
using what you already have.
In NLP (Natural Language Processing), bootstrapping refers to building a
system using a small amount of labeled data, and then automatically
improving it by learning from more unlabeled data.
Why is it useful?
Because labeling large datasets is expensive and time-consuming.
Bootstrapping helps create smarter models with less manual work.
Bootstrapping Methods
There are four main bootstrapping methods used in NLP:
1️⃣ Self-Training
What is it?
42
Self-training is like a student learning a few chapters first, then trying out
questions from more chapters using their current knowledge, and learning
from the new answers.
How it works:
1. You train a model using a small labeled dataset.
2. The model makes predictions on unlabeled data.
3. The confident predictions are added to the training set.
4. The model is retrained, and the cycle repeats.
✅ Example:
You want to train a model to do Part-of-Speech (POS) tagging.
• Start with 100 sentences where each word is labeled with its POS tag
(like noun, verb).
• Train the model.
• Now give it 1,000 unlabeled sentences.
• The model tags them.
• Take the best predictions (ones it is most confident about) and add them
to the training data.
• Train the model again — now it’s better!
2️⃣ Co-Training
What is it?
Co-training is like two friends learning from different books. Each teaches the
other what they know best.
How it works:
1. Train two (or more) models using different features (or perspectives) of
the same data.
2. Each model makes predictions on unlabeled data.
3. They share the predictions with each other.
4. They add new labeled data to their sets and retrain.
✅ Example:
You are doing sentiment analysis.
• Model A is trained using tweets.
• Model B is trained using news articles.
43
• Both are trained with a small amount of labeled data.
• Now you feed them lots of unlabeled social media posts.
• Model A labels some; Model B labels others.
• They exchange their best predictions, retrain, and get better.
44
Example:
You are building a Machine Translation model (say, English to French).
• You have 1,000 sentence pairs (English ↔ French) that are labeled.
• You also have 10,000 sentences in English and French separately (not
aligned).
• The model learns structure and grammar from the unlabeled data.
• This extra knowledge helps translate more accurately.
Summary Table
Human
Method Idea Data Needed Example
Help
Small labeled
Active Model asks human to Named Entity
+ large ✅
learning label confusing data Recognition
unlabeled
Real-Life Analogy
Bootstrapping
Real-Life Analogy
Method
A student asks the teacher for help with only the tough
Active learning
questions.
45
Final Thoughts
Bootstrapping is a smart way to train models with less effort and less labeled
data. It helps in building efficient, scalable NLP applications even when
human-labeled data is limited.
Word Similarity using Thesaurus and distributional methods:
Word Similarity: What is it?
Word similarity is the task of finding how similar two words are in terms of
meaning.
For example:
• "Car" and "automobile" are very similar.
• "Car" and "banana" are not similar.
Why is Word Similarity Important in NLP?
Word similarity is used in many applications like:
• Search engines – to show results even if the words are not exactly the
same.
• Chatbots – to understand user inputs better.
• Machine translation – to choose correct words in the target language.
• Spelling correction – to suggest similar words when a mistake is made.
🔹 1. Thesaurus-Based Method
What is a Thesaurus?
A thesaurus is like a dictionary that shows:
• Synonyms (words with similar meanings),
• Antonyms (opposite meanings), and
• Word relationships (like part-whole or type-kind).
WordNet – A Popular Thesaurus
• WordNet is a digital thesaurus.
• It organizes words into synsets (sets of synonyms that express the same
concept).
How Thesaurus-Based Methods Work:
1. Words are grouped into synsets.
2. Synsets are arranged in a graph (like a tree or network).
3. The distance between two words in this graph is measured.
46
o Shorter distance → more similar meaning.
o Longer distance → less similar.
Example:
• "Dog" and "Wolf" might belong to similar synsets.
• In WordNet, you might find only 1 or 2 steps between them → They are
highly similar.
• "Dog" and "Pen" might be far apart in WordNet → Not similar.
🔹 2. Distributional-Based Method
Key Idea:
Words that appear in similar contexts have similar meanings.
For example:
• "Teacher" and "professor" often appear with words like “class”,
“students”, “lecture”.
• So, they are likely to be similar.
How Distributional Methods Work:
1. A huge text dataset (corpus) is used.
2. Each word is represented as a vector (a list of numbers) based on how
it appears with other words.
3. We then compare the vectors of two words using mathematical
formulas.
Common Similarity Measures:
• Cosine similarity – measures angle between vectors (0° means they are
identical).
• Euclidean distance – measures straight-line distance.
• Mahalanobis distance – advanced distance taking into account the
spread of data.
Popular Distributional Tools:
• Word2Vec
• GloVe
• BERT
These are all machine learning models that create word embeddings
(numerical vector representations of words).
Example:
47
• "King" and "Queen" will have vectors close to each other in space.
• "King" and "Apple" will have vectors far apart → they are not similar.
Comparison of Thesaurus-Based and Distributional Methods
48