Introduction to Semantics
Introduction to Semantics
Semantics is the branch of Linguistics that deals with the meaning of words, phrases, and sentences.
In Natural Language Processing, semantic analysis focuses on understanding the meaning of text rather than only grammar.
Example: Sentence: “Ravi opened the bank account.”
Semantic interpretation:
- Person → Ravi
- Action → Open
- Object → Bank Account
- Meaning → Financial activity
Another example: Sentence: “The bank of the river is beautiful.”
Here bank = river side, not a financial institution.
Thus semantics helps computers identify the correct meaning depending on context.
Types of Semantic Analysis
| Type | Description | Example |
|---|---|---|
| Lexical Semantics | Meaning of individual words | “car” and “vehicle” |
| Compositional Semantics | Meaning derived from sentence structure | “Ram eats mango” |
| Word Sense Disambiguation | Identifying correct word meaning | bank (river / finance) |
| Semantic Role Labeling | Identifying roles in sentence | who did what |
Semantic Relationships
Understanding meaning often requires identifying relationships between words.
| Relationship | Meaning | Example |
|---|---|---|
| Synonym | Words with similar meaning | big – large |
| Antonym | Opposite meaning | hot – cold |
| Hypernym | General category | animal → dog |
| Hyponym | Specific instance | dog → animal |
| Homonym | Same spelling but different meaning | bank |
These relationships help NLP systems understand context and meaning.
Knowledge Representation (KR)
Knowledge Representation is a technique used in Artificial Intelligence to store information about the world in a structured format so that computers can reason and understand language.
In NLP, knowledge representation helps computers interpret text meaning logically.
Objectives of Knowledge Representation
- Represent real-world knowledge
- Enable reasoning and inference
- Help machines understand human language
- Support intelligent decision making
Techniques of Knowledge Representation
1. Semantic Network
A graph structure that shows relationships between concepts.
Example:
Dog → is-a → Animal
Animal → needs → Food
Dog → has → Tail
| Component | Meaning |
|---|---|
| Node | Object or concept |
| Link | Relationship |
2. Frames
Frames represent structured knowledge about objects or situations.
Example: Restaurant Frame
| Slot | Value |
|---|---|
| Place | Restaurant |
| Activity | Eating |
| Participants | Customer, Waiter |
| Object | Food |
Frames help machines understand typical real-world situations.
3. Logical Representation
Uses mathematical logic to represent knowledge.
Example: Sentence: “All humans are mortal.”
Logical representation: Human(x) → Mortal(x)
Example: Human(Socrates)
Therefore → Mortal(Socrates)
4. Conceptual Dependency
Represents actions in sentences independent of language.
Example: Sentence: “Ram gave Sita a book.”
Representation:
Actor → Ram
Action → Give
Object → Book
Receiver → Sita
Applications of Semantics and Knowledge Representation
1. Machine Translation
Machine Translation is the automatic translation of text from one language to another using computers.
Example system: Google Translate
Example - English sentence: “She is reading a book.”
Hindi translation: “वह एक किताब पढ़ रही है।”
The system must understand:
| Component | Meaning |
|---|---|
| Subject | She |
| Verb | Reading |
| Object | Book |
Thus semantics ensures correct meaning before translation.
Steps in Machine Translation
| Step | Function |
|---|---|
| Source Language Analysis | Analyze input sentence |
| Semantic Representation | Extract meaning |
| Transfer | Convert meaning to target language |
| Target Language Generation | Generate translated sentence |
Natural Language Database Interface
A Natural Language Interface to Database (NLIDB) allows users to query a database using natural language instead of SQL commands.
Example question: “Show all students who scored more than 80 marks.”
System converts it to SQL:
SELECT *
FROM students
WHERE marks > 80;
Advantages
| Advantage | Explanation |
|---|---|
| Easy to use | No need for SQL knowledge |
| User-friendly | Normal language queries |
| Faster information retrieval | Quick data access |
Example Process
User Question
↓
Language Analysis
↓
Semantic Interpretation
↓
SQL Query Generation
↓
Database Result
Difference Between Syntax and Semantics
| Feature | Syntax | Semantics |
|---|---|---|
| Meaning | Structure of sentence | Meaning of sentence |
| Focus | Grammar rules | Interpretation |
| Example | “She eats apple” structure | What the sentence means |
Key Points for Exams
| Topic | Important Idea |
|---|---|
| Semantics | Study of meaning in language |
| Knowledge Representation | Structured storage of knowledge |
| Semantic Networks | Graph relationships |
| Frames | Structured situation representation |
| Machine Translation | Automatic language translation |
| Database Interface | Natural language query system |
Short Definition
Semantics is the study of meaning in language and is an important component of Natural Language Processing. Knowledge Representation is the method of storing information in structured formats such as semantic networks, frames, and logical representations so that computers can understand, reason, and process natural language. These concepts are widely used in applications such as machine translation and natural language database interfaces.