0% found this document useful (0 votes)
3 views13 pages

NLP Topics Study Notes

The document covers key concepts in Natural Language Processing (NLP) related to semantics, pragmatics, and first-order logic. It explains the differences between semantics (literal meaning) and pragmatics (contextual meaning), outlines requirements for semantic and pragmatic representation, and introduces first-order logic as a formal system for representing meaning. Additionally, it discusses syntax-driven semantic analysis and word sense disambiguation, highlighting their importance in improving language understanding and processing.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views13 pages

NLP Topics Study Notes

The document covers key concepts in Natural Language Processing (NLP) related to semantics, pragmatics, and first-order logic. It explains the differences between semantics (literal meaning) and pragmatics (contextual meaning), outlines requirements for semantic and pragmatic representation, and introduces first-order logic as a formal system for representing meaning. Additionally, it discusses syntax-driven semantic analysis and word sense disambiguation, highlighting their importance in improving language understanding and processing.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

NLP Study Notes | Semantics, Pragmatics & First-Order Logic

NLP STUDY NOTES


Semantics, Pragmatics & First-Order Logic
Topics Covered: Semantics & Pragmatics | Requirements for Representation | First-Order Logic |
Syntax-Driven Semantic Analysis | Word Sense Disambiguation

Natural Language Processing

Page 1
NLP Study Notes | Semantics, Pragmatics & First-Order Logic

Topic 1: Semantics and Pragmatics

1. Semantics
Definition
Semantics is the study of the literal meaning of words and sentences without considering
context. The goal is to understand the exact meaning using dictionary definitions and logical
relationships.

Example: Semantic Analysis


Sentence: "The cat sat on the mat."
Semantic Mapping: Cat → animal Sat → sitting down Mat → floor covering Semantic
Understanding: The sentence means a cat is sitting on a mat (literal meaning only).

2. Pragmatics
Definition
Pragmatics studies the meaning in context — what the speaker actually means, not just
what the words say. The goal is to understand speaker intention and hidden meaning.

Example: Pragmatic Analysis


Sentence: "It's cold in here."
Pragmatic Meaning (depends on context): → Close the door → Turn off the AC → Give
a blanket Pragmatics interprets the implied request, not just the literal meaning.

3. NLP Understanding Process


Natural Language Processing understands language in four main steps:

Step Analysis Description


1 Lexical Analysis Breaking the sentence into words (tokenization)

2 Syntax Analysis Checking grammar structure and sentence


formation
3 Semantic Analysis Finding the literal meaning of words and phrases

Page 2
NLP Study Notes | Semantics, Pragmatics & First-Order Logic

Step Analysis Description


4 Pragmatic Analysis Understanding the speaker's intent and context

Worked Example: "I am hungry."


Step 1: Lexical Analysis
"I | am | hungry" → Sentence split into individual words

Step 2: Syntax Analysis


Structure: Subject + Verb + Adjective Subject → I Verb → am Adjective → hungry

Step 3: Semantic Analysis


Literal meaning → Person feels hungry

Step 4: Pragmatic Analysis


Actual intention → Request for food

4. Semantics vs Pragmatics — Comparison


Semantics Pragmatics
Literal meaning Contextual meaning
Dictionary-based Speaker intention
No context needed Uses context
"It's cold" → temperature "It's cold" → close the door

Page 3
NLP Study Notes | Semantics, Pragmatics & First-Order Logic

Topic 2: Requirements for Representation in NLP


Natural Language Understanding (NLU) requires a proper representation of meaning so that
machines can understand human language. This is achieved through Semantic Representation
(literal meaning) and Pragmatic Representation (contextual and intended meaning).

1. Semantic Representation
Semantic representation captures the literal meaning of words and sentences.

1.1 Unambiguous Meaning Representation


Reduce lexical ambiguity — words with multiple meanings must be resolved correctly.

Example
Bank → financial institution Bank → river bank System must identify correct meaning based
on sentence context.

1.2 Compositionality
The meaning of a sentence is derived from the meanings of individual words combined
together.

Example: "The boy eats rice."


Boy → person Eats → action Rice → food Combined meaning → Boy performs eating
action on rice.

1.3 Representation of Semantic Relations


Capture relations between words such as:
● Synonymy — same meaning
● Antonymy — opposite meaning
● Hyponymy — is-a relation
● Metonymy — related concept
Example
Dog → Animal (Hyponymy relationship)

1.4 Representation of Semantic Roles


Identify who did what to whom using semantic roles:
● Agent — performer of the action
● Patient — receiver of the action
● Instrument — tool used

Page 4
NLP Study Notes | Semantics, Pragmatics & First-Order Logic

Example: "Ram broke the glass with a stone."


Agent → Ram Patient → Glass Instrument → Stone

1.5 Logical Inference Support


Ability to derive new facts from known facts.

Example
Fact 1: All humans are mortal Fact 2: Ram is a human Conclusion: Ram is mortal

1.6 Formal Structure


Knowledge should be represented in a precise machine-understandable format. Common
methods:
● Predicate Logic
● Semantic Networks
● Frames

2. Pragmatic Representation
Pragmatic representation focuses on contextual and intended meaning.

2.1 Context Awareness


Meaning depends on situation, time, place, and speaker.

Example: "He's feeling blue."


Literal → color blue Contextual → feeling sad

2.2 Speaker Intent Recognition


Identify communication intention — request, command, promise, etc.

Example
"Can you help me?" → Interpreted as a Request, not a question about ability

2.3 Discourse Representation


Handle multi-sentence meaning and maintain coherence across sentences.

Example
"Ram went to school. He was late." "He" refers to Ram — pronoun resolution is required.

Page 5
NLP Study Notes | Semantics, Pragmatics & First-Order Logic

2.4 Handling Implied Meaning


Understand meaning that is implicit but not directly stated.

Example
"Some students passed." Implied → Not all students passed

2.5 Deixis Resolution


Interpret context-dependent words whose meaning depends on the speaker's position:
● This / That
● Here / There
● Now

2.6 Presupposition Handling


Capture assumed information embedded in sentences.

Example
"Ram stopped smoking." Presupposition → Ram smoked earlier (this is assumed)

2.7 World Knowledge Integration


Use background knowledge to understand meaning.

Example
"The glass fell and broke." System knows → Glass is fragile, so breaking is expected.

Page 6
NLP Study Notes | Semantics, Pragmatics & First-Order Logic

Topic 3: First-Order Logic (FOL)

Definition
First-Order Logic (FOL) is a formal system used to represent meaning in natural language
through logical expressions. It helps NLP systems understand, represent, and reason about
sentence meaning.

Basic Elements of FOL

Element Description Examples


Constants Represent specific objects or entities Ram, John, Mary, Book, Dog
Variables Represent general / unknown x, y, z
entities
Predicates Represent properties or Human(x), Eats(x,y), Loves(x,y)
relationships
Quantifiers Specify how many objects satisfy a ∀ x (for all x), ∃ x (there exists x)
condition
Connectives Combine logical statements ∧ (AND), ∨ (OR), ¬ (NOT), →
(IMPLIES)

Examples of FOL Representation


Example 1
Sentence: "Ram eats rice."
FOL Representation: Eats(Ram, Rice) Meaning → Ram performs the eating action on rice.

Example 2
Sentence: "All humans are mortal."
FOL Representation: ∀ x (Human(x) → Mortal(x)) Meaning → If x is human, then x is mortal.

Example 3
Sentence: "John loves Mary."
FOL Representation: Loves(John, Mary) Meaning → John loves Mary.

Page 7
NLP Study Notes | Semantics, Pragmatics & First-Order Logic

Why FOL is Important in NLP


● Represents meaning clearly and precisely
● Removes ambiguity from language
● Supports logical reasoning and inference
● Used in semantic analysis tasks

Quick Reference Summary


Element Meaning Example
Constant Specific object Ram
Variable General object x
Predicate Property / Relation Human(x)
Quantifier For all / There exists ∀ x, ∃ x
Connective Logical link ∧, ∨, ¬

Page 8
NLP Study Notes | Semantics, Pragmatics & First-Order Logic

Topic 4: Syntax-Driven Semantic Analysis (SDSA)

Definition
Syntax-Driven Semantic Analysis is an approach in NLP where the meaning of a sentence
is derived directly from its syntax tree (parse tree). It follows the principle of compositionality
— the meaning of the whole sentence comes from the meanings of individual words and
how they are combined.

Core Idea of SDSA


● Parse the sentence → Identify grammatical structure
● Assign meaning to words → Lexical semantics
● Combine meanings → Use syntax tree to build sentence meaning

Why Syntax Matters for Semantics


Syntax helps to:
● Determine word relationships
● Identify who does what to whom
● Find modifiers and scope
● Resolve ambiguity in sentences

Ambiguity Example
Sentence: "The boys saw the man with a telescope."
Two possible meanings: 1. Boys used a telescope to see the man 2. The man had a
telescope The syntax tree structure determines which meaning is correct.

Process of SDSA

Step 1: Syntax Parsing


The sentence is converted into a parse tree structure.

Example: "The boy saw the dog"


S NP → The boy VP → saw the dog

Step 2: Lexical Semantics


Assign semantic representation to each individual word.

Page 9
NLP Study Notes | Semantics, Pragmatics & First-Order Logic

Word-level Mapping
boy → Boy(x) dog → Dog(y) saw → See(x, y)

Step 3: Semantic Composition


Combine meanings according to the syntax tree structure.

Final Representation
See(Boy, Dog) Meaning → Boy saw the dog.

Step 4: Syntax–Semantic Interface


Grammar rules guide semantic combination. Example rules:
● S → NP VP
● VP → V NP
These rules help combine meanings properly during analysis.

Another Complete Example


Sentence: "Ram eats rice"
Lexical meaning: Ram → Ram eats → Eat(x, y) rice → Rice Semantic composition →
Eat(Ram, Rice)

Why SDSA is Important


Benefit Explanation
Links grammar with meaning Uses syntactic structure to guide semantic interpretation
Handles ambiguity Parse tree determines correct interpretation of ambiguous
sentences
Produces structured semantics Outputs formal representations (e.g., FOL)
Useful in machine translation Helps systems map meaning across languages
Improves NLP understanding Enables more accurate language comprehension

Page 10
NLP Study Notes | Semantics, Pragmatics & First-Order Logic

Topic 5: Word Sense & Word Sense Disambiguation


(WSD)

What is Word Sense?


Definition
A word sense is the specific meaning of a word in a given context. Many words have
multiple meanings — this is called polysemy. Meaning depends on surrounding words and
the sentence context.

Example of Word Sense


Word: "bank"
"She works in a bank." → Meaning: Financial institution "He sat on the bank of the river."
→ Meaning: River edge Same word, different meanings depending on context.

Word Sense Disambiguation (WSD)


Definition
Word Sense Disambiguation is the process of identifying the correct meaning of a word
based on its context. It is used to remove ambiguity and improve language understanding.

Applications of WSD
Application Description
Machine Translation Correctly translating polysemous words into another
language
Search Engines Understanding user query intent to return relevant results
Text Summarization Identifying correct word meanings to produce accurate
summaries
Chatbots Understanding user messages correctly in conversation
Virtual Assistants Interpreting spoken or typed commands accurately

Relations Between Word Senses

Page 11
NLP Study Notes | Semantics, Pragmatics & First-Order Logic

1. Synonymy
Words with the same or similar meaning.

Examples
Big – Large Happy – Joyful

2. Antonymy
Words with opposite meanings.

Examples
Hot – Cold Big – Small

3. Hyponymy & Hypernymy


"Is-a" relationship between more specific and more general terms.

Example
Dog → Animal Dog is a hyponym (more specific) Animal is a hypernym (more general)

4. Meronymy & Holonymy


Part–whole relationship between terms.

Example
Wheel → part of Car Wheel = Meronym (the part) Car = Holonym (the whole)

5. Troponymy
Describes the manner of an action — a more specific way of performing an action.

Examples
Jog → a way of Running Whisper → a way of Speaking

6. Polysemy
One word with multiple related meanings.

Example
Word: "Head" → body part → leader of an organization → top of an object

7. Homonymy
Same word spelling/sound with completely unrelated meanings.

Page 12
NLP Study Notes | Semantics, Pragmatics & First-Order Logic

Example
Bat → animal (the creature) Bat → sports equipment (cricket/baseball)

8. Entailment Relation
One action implies another action must also be occurring.

Example
Snore → Sleep If someone snores, they must be sleeping.

9. Cause–Effect Relation
One action causes another to occur.

Examples
Kill → Die Push → Move

Summary of Word Sense Relations


Relation Type Example
Synonymy Same meaning Big – Large
Antonymy Opposite meaning Hot – Cold
Hyponymy Is-a (specific) Dog → Animal
Hypernymy Is-a (general) Animal ← Dog
Meronymy Part of whole Wheel → Car
Holonymy Whole of part Car ← Wheel
Troponymy Manner of action Jog → Running
Polysemy One word, related meanings Head (body/leader/top)
Homonymy One word, unrelated Bat (animal/sports)
meanings
Entailment Implies another action Snore → Sleep
Cause-Effect Action causes result Kill → Die

Page 13

You might also like