Artificial Intelligence Part B - Unit 6 4 Study Options Available

Unit 6: Natural Language Processing

CHAPTER PDF

Complete curriculum textbook chapter document for reading and offline study.

NOTES

Complete conceptual breakdown, formulas, diagrams, and memory aids.

Class 10 AI | Unit 6: Natural Language Processing
CBSE • Class X • Artificial Intelligence (417)

Unit 6: Natural Language Processing

Complete textbook-aligned notes, activities, worked examples, objective questions, competency-based practice and board-examination revision.

29-page source coveredSimple EnglishSolved exercisesMobile responsive

Unit overview

Lesson title: Natural Language Processing (NLP) · Approach: Session + Activity.

This unit introduces NLP, its importance and applications; the five stages of NLP; text normalisation; Bag of Words; TFIDF; sentiment analysis; and no-code tools such as Orange Data Mining.

Learning objectives

  1. Understand NLP and its importance.
  2. Identify applications of NLP.
  3. Explain the stages of NLP.
  4. Understand text-processing techniques.
  5. Identify no-code NLP tools.
  6. Explain Bag of Words.
  7. Understand TFIDF.
  8. Explore Orange Data Mining.

Learning outcomes

  1. Describe why NLP data is pre-processed.
  2. Recognise the steps of NLP pre-processing.
  3. List no-code NLP applications and tools.
  4. Outline Bag of Words.
  5. Explain TFIDF.
  6. Explain sentiment analysis.
Key concepts: Natural Language Processing, applications of NLP, stages of NLP, text processing, Bag of Words, TFIDF, Orange Data Mining. Prerequisites: None.

6.1 Introduction

What is a natural language?

A natural language is a language that human beings use to communicate, such as English, French, Spanish and Japanese.

Features of natural languages

  1. Rules: Natural languages follow rules involving syntax (grammar and arrangement), lexicon (words and phrases) and semantics (meaning).
  2. Redundancy: The same information can be communicated in more than one way.
  3. Change over time: Vocabulary, expressions and usage evolve over generations.

Same-sounding words can have different meanings

Pronunciation alone may not tell us which word is intended. Context helps us decide.

Sentence / promptCorrect wordReason
I am so tired; I want to take a ___.breakA break means a rest. A brake is used to slow or stop a vehicle.
Let’s ___ her a letter.writeWrite means to form words. Right means correct or a direction.

Meaning depends on context

  • “His face turned red after he found out that he took the wrong bag.” Red may indicate embarrassment or anger; the surrounding situation helps interpret it.
  • “The red car zoomed past his nose.” Red refers to the car’s colour.
  • “His face turns red after consuming the medicine.” It may describe a physical reaction, such as flushing or an allergy. The sentence alone does not prove the cause.
Board point: A word may have multiple meanings. NLP must use context to identify the intended meaning rather than interpreting every word in isolation.

Computer language

A computer language is a language used to give instructions to a computer. Examples include Python, C++, Java and HTML.

Can computers understand our language?

Computers need instructions in a form they can process. Human language is flexible, ambiguous and context-dependent. A computer program converts or analyses human-language input so that a machine can process it.

Why is NLP important?

Computers ultimately process electronic information in digital/binary form. NLP helps bridge the gap between human communication and computer processing. Its purpose is to make communication between people and computer systems possible while helping systems interpret intent and context.

Definition — Natural Language Processing (NLP): NLP is a sub-field of Artificial Intelligence that enables computers to analyse, understand and process human languages to derive meaningful information from them.
Think and answer: Give two examples of words with multiple meanings.

Bank: “I deposited money in the bank.” (financial institution); “We sat on the river bank.” (side of a river).

Light: “Switch on the light.” (illumination); “This bag is light.” (not heavy).

6.2 Applications of Natural Language Processing

NLP is used in everyday AI systems to understand speech or text, identify information, classify content and respond to people.

1. Voice assistants

Voice assistants receive spoken language, process the request and provide an output or perform a task.

Examples: “Hey Google, set an alarm at 3:30 pm”; “Hey Alexa, play some music”; “Hey Siri, what’s the weather today?”

2. Auto-generated captions

Speech is converted into text in real time or near real time. Captions improve accessibility and help viewers follow video content.

Examples: YouTube captions and captions in Google Meet.

3. Language translation

Text or speech is converted from one language into another, supporting communication between people who use different languages.

Example: Google Translate.

4. Sentiment analysis

Sentiment analysis identifies whether an opinion expressed in text is positive, negative or neutral. Businesses can analyse customer opinions about products, services or a brand.

5. Text classification

Text classification places a sentence or document into a predefined category. For example, news articles can be grouped as Food, Sports or Politics.

6. Keyword extraction

Keyword extraction automatically identifies important words or phrases in a text. It can help reveal the main topics in customer feedback and social-media posts.

It is useful in document summarisation, information retrieval and content analysis.

Activity 1: Keyword Extraction

Purpose: Learn how an API can perform keyword extraction from a website.

  1. Open Google Cloud Natural Language.
  2. Open the Natural Language API demonstration and choose Analyse.
  3. Observe the highlighted keywords in the sample paragraph (the textbook illustration shows words such as “Google” and “Mountain View”).
  4. Try other available analysis options.
  5. Enter your own paragraph and compare the output.
Activity observation: The tool highlights words or phrases that it considers important. The result depends on the text supplied and the analysis feature selected. The original activity is an exploration task; it does not prescribe one fixed output.

6.3 Stages of Natural Language Processing (NLP)

The textbook presents five stages. They help a system move from identifying words to interpreting intended meaning.

1. Lexical Analysis
→
2. Syntactic Analysis
→
3. Semantic Analysis
→
4. Discourse Integration
→
5. Pragmatic Analysis

1. Lexical Analysis

It identifies the structure of input text by dividing a large body of text into paragraphs, sentences and words. Lexicon means the collection of words and phrases used in a language.

Example: “The quick brown fox jumped over the lazy dog” can be broken into individual word units: The | quick | brown | fox | jumped | over | the | lazy | dog.

2. Syntactic Analysis / Parsing

It checks the grammatical structure of sentences and phrases and establishes relationships among words. It can identify grammatically incorrect word arrangements.

Example: “The quick brown jumped fox over the lazy dog” has an incorrect word arrangement. “The quick brown fox jumped over the lazy dog” is grammatically structured correctly.

3. Semantic Analysis

It checks whether words and phrases make sense in meaning. A sentence may be grammatically correct but semantically unusual or meaningless.

Example: “hot ice cream” is presented in the textbook as a phrase whose meaning is contradictory in the usual sense. “The fox jumped into the dog” is also used as an example of an unusual meaning.

4. Discourse Integration

It checks the relationship between a sentence and the sentences before and after it. This helps form a coherent flow of ideas and resolve references.

Example: “The quick brown fox jumped over the lazy dog. Then it went into the thick bushes.” In context, “it” refers to the fox. Without the earlier sentence, the reference may be unclear.

5. Pragmatic Analysis

It checks the intended meaning in a real-world situation. It goes beyond the literal meaning of words and considers the speaker’s purpose or intent.

Example: “Relax! I’m just pulling your leg” means “I am joking”, not that someone is physically pulling a leg.

StageMain questionWhat it does
LexicalWhat are the text units?Breaks text into paragraphs, sentences and words.
SyntacticIs the arrangement grammatical?Checks grammar and relationships among words.
SemanticDoes it make sense?Checks literal meaning and meaningfulness.
DiscourseHow do sentences connect?Uses preceding and succeeding sentences for coherence.
PragmaticWhat does the speaker intend?Interprets practical, contextual and intended meaning.
Remember the order: Lexical → Syntactic → Semantic → Discourse → Pragmatic. The first stage is Lexical Analysis; meaningfulness is checked in Semantic Analysis; intended meaning is interpreted in Pragmatic Analysis.

6.4 Chatbots

A chatbot is a computer program designed to simulate human conversation through voice commands, text chats or both. It may answer questions, troubleshoot customer problems, qualify prospects, generate sales leads and support online shopping.

Activity 2: Play with chatbots

Purpose: Identify and interact with different chatbots.

Textbook examples:

Interact with one or more chatbots and discuss: Which chatbot did you try? What is its purpose? How was the interaction? Did it feel human-like or robotic, and why? Did it appear to have a personality?

Types of chatbots

Script bot (traditional chatbot)Smart bot (AI-powered chatbot)
Easy to make.More flexible and powerful.
Works around a predefined script.Can work on larger databases and other resources directly.
Often free and easy to integrate into a messaging platform.Can learn from more data.
Little or no language-processing skill.Requires coding to set up, as described in the textbook.
Limited functionality.Wide functionality.
Exam comparison: A script bot follows predefined rules and has limited responses. A smart bot uses AI/NLP capabilities to handle a wider range of inputs and tasks.

6.5 Text Processing

Human languages are convenient for people but complex for computers. Since computers process numerical representations, text is cleaned and converted into a simpler, structured form before analysis. The textbook introduces Text Normalisation as the first major step in this process.

Corpus

Corpus: A collection of written text from multiple documents, considered together for text processing and analysis.

Text Normalisation — six steps

1. Sentence Segmentation
→
2. Tokenization
→
3. Remove stop words, special characters and numbers (as appropriate)
→
4. Convert to common case
→
5. Stemming
→
6. Lemmatization

1. Sentence Segmentation

The corpus is divided into individual sentences. Each sentence is treated as a separate data unit.

Example:
Input: “In CBT, we learn to decipher the lies we are undermining ourselves with. I’m never going to make any friends.”
Output: Sentence 1: “In CBT, we learn to decipher the lies we are undermining ourselves with.”
Sentence 2: “I’m never going to make any friends.”

2. Tokenization

Each sentence is divided into tokens. A token may be a word, number or special character. Each is treated separately.

Example:
“In CBT, we learn.” → In | CBT | , | we | learn | .

3. Removing stop words, special characters and numbers

Stop words occur frequently but usually contribute little to the topic being analysed. Examples shown in the textbook include: a, an, and, are, as, for, it, is, into, in, if, on, or, such, that, the, there, to.

Removing these words helps a computer focus on meaningful terms. Special characters and numbers may also be removed when they are not useful. However, the decision depends on the corpus: for an email-address dataset, symbols and numbers may be important and should be retained.

Important: Stop-word removal is task-dependent. Do not remove a number or symbol if it carries useful information for the problem being solved.

4. Converting text to a common case

Text is converted to a consistent case, preferably lowercase. This prevents a case-sensitive system from treating “HELLO”, “Hello” and “hello” as different words.

5. Stemming

Stemming removes affixes (such as suffixes) to reduce words to a stem or base-like form. It does not check whether the result is a meaningful dictionary word, so it is generally faster.

WordAffix removedStem
healed-edheal
healing-ingheal
healer-erheal
studies-esstudi
studying-ingstudy

6. Lemmatization

Lemmatization also reduces words by removing or changing affixes, but it ensures that the resulting lemma is a meaningful word. It usually takes longer than stemming because it considers the valid base form.

WordAffix removedLemma
healed-edheal
healing-ingheal
healer-erheal
studies-esstudy
studying-ingstudy
Stemming vs Lemmatization: The textbook example is “Caring”. Lemmatization gives “care” (a meaningful word), while stemming gives “car” (a mechanically reduced stem that changes the intended word). Stemming is generally faster; lemmatization gives a meaningful lemma.

Bag of Words (BoW)

Definition: Bag of Words is an NLP model that extracts features from text for use in machine-learning algorithms. It identifies the unique words in a corpus and records their occurrences.

The “bag” metaphor means that the sequence or order of words is ignored. The model focuses on which words occur and how often they occur.

What does Bag of Words produce?

  1. Vocabulary: A list of all unique words in the corpus.
  2. Word frequency: The number of times each vocabulary word occurs.

Steps of the Bag of Words algorithm

  1. Text processing: Collect and preprocess the text.
  2. Create a dictionary: List all unique words in the corpus. This is the vocabulary.
  3. Create document vectors: For each document, count how many times each vocabulary word occurs.
  4. Repeat for all documents: Create one vector for every document in the corpus.

Worked textbook example

Step 1 — Documents after text normalisation

DocumentNormalised tokens
Document 1aman, and, avni, are, stressed
Document 2aman, went, to, a, therapist
Document 3avni, went, to, download, a, health, chatbot

Step 2 — Create the dictionary

The vocabulary contains each unique token once. For clarity, this table uses the same vocabulary as the textbook:

aman · and · avni · are · stressed · went · to · a · therapist · download · health · chatbot

Step 3 — Create the vector for Document 1

Put 1 where the vocabulary word occurs and 0 where it does not occur. If a word occurs more than once, record its count (not merely 1).

Wordamanandavniarestressedwenttoatherapistdownloadhealthchatbot
Doc 1111110000000

Step 4 — Create vectors for all documents

Documentamanandavniarestressedwenttoatherapistdownloadhealthchatbot
Doc 1111110000000
Doc 2100001111000
Doc 3001001110111
Interpretation: Each row represents one document; each column represents one vocabulary word. A value of 1 means the word occurs once, 0 means it does not occur. In a count-based BoW vector, a repeated word receives a value greater than 1.

TFIDF: Term Frequency and Inverse Document Frequency

Bag of Words counts words, but very common words may not be useful for distinguishing one document from another. TFIDF estimates how important a word is to a particular document within a corpus.

The textbook graph on page 21 distinguishes:

  • Stop words: Extremely common words with negligible value for the topic.
  • Frequent words: Words that occur adequately and often describe the subject.
  • Rare / valuable words: Words that occur less often but may carry more information.
TFIDF: Term Frequency–Inverse Document Frequency. It assigns a value to a word based on how often it occurs in a document and how widely it is distributed across the corpus.

1. Term Frequency (TF)

Term Frequency is the number of times a word occurs in one document. In the document-vector table, it is the count in the relevant document row.

2. Document Frequency (DF)

Document Frequency is the number of documents in which a word occurs, regardless of how many times it occurs in each document.

3. Inverse Document Frequency (IDF)

The textbook calculates IDF by dividing the total number of documents by the document frequency.

IDF(W) = Total number of documents ÷ Number of documents containing W

4. TFIDF formula used in the textbook

TFIDF(W) = TF(W) × log10(IDF(W))

The logarithm is base 10. The textbook notes that a calculator’s log function can be used.

Worked example based on the textbook’s three-document corpus

There are 3 documents. The words aman, avni, went, to, a occur in 2 documents each; the other vocabulary words occur in 1 document each.

WordDFIDF = 3/DFlog10(IDF)
aman, avni, went, to, a21.50.176
and, are, stressed, therapist, download, health, chatbot130.477

Multiply each document’s TF by the corresponding log10(IDF) value. For example, in Document 1, TF(aman)=1 and log10(3/2)=0.176, so TFIDF(aman)=1 × 0.176 = 0.176. For “and”, TF=1 and log10(3/1)=0.477, so TFIDF= 0.477.

Interpretation and textbook illustration

  • A word appearing in every document has IDF = N/N = 1, so log10(1)=0 and its TFIDF becomes 0 under this formula.
  • A word appearing in fewer documents has a larger IDF and can receive a higher value when it occurs in a particular document.
  • A high TFIDF value indicates that the word is important to a document but is not common throughout the corpus.
Example from the textbook: If there are 10 documents and “and” occurs in all 10, IDF(and)=10/10=1 and log(1)=0. If “pollution” occurs in 3 documents, IDF(pollution)=10/3=3.333… and log10(3.333)≈0.522.

Applications of TFIDF

ApplicationUse
Document classificationHelps classify the type or genre of a document.
Topic modellingHelps predict or identify the topic of a corpus.
Information retrieval systemHelps extract important information from a corpus and rank relevant text.
Stop-word filteringHelps identify and remove words that contribute little information.

6.6 Natural Language Processing: Use Case Walkthrough

Purpose: Introduce no-code tools for NLP and use Orange Data Mining to explore sentiment analysis.

Code NLP tools

  • NLTK (Natural Language Toolkit): A Python package containing functions and modules for text processing and NLP.
  • spaCy: An open-source NLP library for building NLP applications. Features include tokenisation, part-of-speech tagging, named-entity recognition and dependency parsing.

No-code NLP tools

  • Orange Data Mining: A machine-learning and data-analysis tool that supports visual programming. Users can perform operations through drag-and-drop widgets.
  • MonkeyLearn: A text-analysis platform offering NLP and machine-learning tools for classification, sentiment analysis and entity recognition. It supports custom or pre-trained models.

Sentiment analysis

Sentiment analysis is an NLP technique used to analyse whether textual data is positive, negative or neutral. It can help detect customer opinions and emotions in feedback about products, services or brands.

Applications of sentiment analysis

Customer service

Automatically detects customer sentiment during interactions and helps organisations understand customer reactions.

Voice of the Customer (VoC)

Analyses customer feedback to produce actionable insights and measure the gap between customer expectations and actual experience.

Orange Data Mining case walkthrough

The textbook provides a guided project resource:

Activity note: The PDF points to an external case walkthrough and QR code rather than printing every Orange workflow step in the chapter. Use the linked resource for the software-specific practical sequence. The conceptual learning objective is to perform sentiment analysis with a no-code tool.

Textbook Test Yourself and Quiz — solved

Section 6.1: Choose the right word (page 2)

1. I am so tired; I want to take a ____.
Answer: break. A break is a period of rest. A brake is a device used to slow or stop a vehicle.
2. Let’s ____ her a letter.
Answer: write. Write means to create text. Right means correct or a direction.

Section 6.3: Choose the right answer (page 10)

1. Syntax refers to the grammatical structure of a sentence. Yes or No?
Answer: YES. Syntactic analysis checks sentence structure and grammatical relationships.
2. Which technique is used to assess the meaningfulness of the input text?
Answer: Semantic Analysis. It checks the meaning of words and phrases.

Section 6.4: Quiz Time (pages 12–13)

1. NLP majorly deals with which type of processing?
Answer: B — Textual data. NLP works with human language in text or speech form; among the given options, textual data is correct.
2. Which NLP tool expresses whether sentiment is positive, negative or neutral?
Answer: C — Sentiment Analysis. It classifies the opinion expressed in text.
3. What is the first stage of NLP?
Answer: C — Lexical Analysis. It identifies and breaks down the text into structural units.
4. Words filtered out before text analysis are called what?
Answer: B — Stop words. These frequent words usually contribute little to the topic.
5. What does discourse integration involve?
Answer: C — Establishing relationships between preceding and succeeding sentences. It creates coherence across sentences.

Section 6.6: Test Yourself (pages 26–28)

1. Primary challenge faced by computers in understanding human languages?
Answer: A — Complexity of human languages. Human language includes ambiguity, context, changing usage and complex rules.
2. How do voice assistants use NLP?
Answer: C — To understand natural language. They process spoken requests so they can respond or perform tasks.
3. Which is NOT a step in Text Normalisation?
Answer: D — Document summarisation. Summarisation is an NLP task, not one of the six normalisation steps listed in this unit.
4. What is the purpose of tokenisation?
Answer: B — To segment sentences into smaller units. These units are tokens such as words, numbers and special characters.
5. What distinguishes lemmatization from stemming?
Answer: A — Lemmatization produces meaningful words after affix removal, while stemming does not.
6. Primary purpose of Bag of Words?
Answer: B — To extract features from text for machine-learning algorithms.
7. What are stop words?
Answer: B — Words with negligible value that are often removed during preprocessing.
8. Characteristic of rare or valuable words?
Answer: C — They occur the least but add the most value to the corpus.
9. What information does a document-vector table provide?
Answer: B — The frequency of each word in a single document. Each row gives word frequencies for one document; the full table contains rows for all documents.
10. Primary purpose of TFIDF?
Answer: C — To identify the value of each word in a document.
11. Assertion–Reason: Pragmatic analysis checks practical applicability; it considers intended meaning rather than only literal meaning. Choose the correct option.
Answer: A — Both Assertion and Reason are true, and the Reason correctly explains the Assertion. Pragmatic analysis uses context and intent to interpret what a speaker means.
12. Assertion–Reason: Lowercasing text creates uniform word representation and prevents case variants being treated as distinct. Choose the correct option.
Answer: A — Both Assertion and Reason are true, and the Reason correctly explains the Assertion. Converting to a common case reduces unnecessary differences such as “Hello” and “hello”.

Reflection Time — complete textbook answers

1. Mention a few features of natural languages.

Natural languages have the following features:

  1. They follow rules such as syntax, lexicon and semantics.
  2. They are redundant, which means the same information can be expressed in different ways.
  3. They change over time as vocabulary and usage develop.
  4. The meaning of a word can depend on the context in which it is used.
2. What is the significance of NLP?

NLP is important because it enables computers to process and understand human language. Computers work with digital information, whereas people communicate through natural languages. NLP helps bridge this gap. It is used in voice assistants, translation, captions, chatbots, sentiment analysis and text classification.

3. What do you mean by lexical analysis in NLP?

Lexical analysis is the first stage of NLP. It identifies the structure of input text by dividing a large text into paragraphs, sentences and words. The term lexicon refers to the collection of words and phrases in a language. For example, a sentence can be separated into individual word tokens.

4. What do you mean by a chatbot?

A chatbot is a computer program designed to simulate conversation with a human through text messages, voice commands or both. It can answer questions, provide customer support, troubleshoot problems and help users complete tasks. Chatbots may be script-based or AI-powered.

5. What does “Bag of Words” refer to in NLP?

Bag of Words is a model that represents text using the unique words in a corpus and their frequencies. It first creates a vocabulary and then creates a numerical vector for each document by counting how often each vocabulary word occurs. It ignores the order of words and is used to extract features for machine-learning algorithms.

6. Describe two practical uses of NLP in real-world scenarios.

1. Voice assistants: Tools such as Google Assistant, Alexa and Siri process spoken requests, understand the user’s intent and perform tasks such as setting alarms or playing music.

2. Language translation: Tools such as Google Translate convert text or speech from one language into another, helping people communicate across language barriers.

7. Explain stemming and lemmatization with an example.

Stemming removes affixes to produce a stem without checking whether the result is a meaningful word. For example, “studies” may become “studi”.

Lemmatization reduces a word to a meaningful base form (lemma). For example, “studies” becomes “study”. In the textbook’s comparison, “caring” becomes “car” through stemming but “care” through lemmatization. Stemming is usually faster, whereas lemmatization aims for a meaningful result.

8. Describe any four applications of TFIDF.
  1. Document classification: Helps identify the type or genre of a document by assigning importance to its terms.
  2. Topic modelling: Helps identify or predict the topics represented in a collection of documents.
  3. Information retrieval: Helps find and rank documents containing terms important to a user’s search.
  4. Stop-word filtering: Helps identify very common words that contribute little information and can be filtered.
9. Samiksha must normalise the two given documents. Show the steps.

Given documents:

Document 1: “Akash and Ajay are best friends.”
Document 2: “Akash likes to play football but Ajay prefers to play online games.”

Step 1 — Sentence segmentation: Each given sentence is already one sentence, so each document remains one sentence.

Step 2 — Tokenisation:

Doc 1: Akash | and | Ajay | are | best | friends | .
Doc 2: Akash | likes | to | play | football | but | Ajay | prefers | to | play | online | games | .

Step 3 — Remove stop words and punctuation: Using the textbook’s common stop-word examples, remove “and”, “are” and “to”; remove the full stop. “But” may also be treated as a stop word by a chosen NLP stop-word list, but it is not explicitly included in the textbook’s displayed examples. To keep the result reproducible, this worked answer removes only the listed words.

Doc 1: Akash, Ajay, best, friends
Doc 2: Akash, likes, play, football, but, Ajay, prefers, play, online, games

Step 4 — Convert to lowercase:

Doc 1: akash, ajay, best, friends
Doc 2: akash, likes, play, football, but, ajay, prefers, play, online, games

Step 5 — Stemming: Apply a stemmer to reduce inflected forms. These words are already mostly in base form; a stemmer may leave them unchanged. “friends” may be reduced to “friend”.

Step 6 — Lemmatization: Convert remaining words to meaningful dictionary forms. Example: “friends” → “friend”; the other listed words remain in their base forms.

One clear final normalised representation:
Doc 1: akash, ajay, best, friend
Doc 2: akash, like, play, football, but, ajay, prefer, play, online, game

The exact output of stemming depends on the stemmer and the stop-word list selected. The steps above make the assumptions explicit rather than pretending that every tool produces identical tokens.
10. Calculate TFIDF for the given four-document corpus, step by step.

Documents:

  1. Johny Johny Yes Papa
  2. Eating sugar? No Papa
  3. Telling lies? No Papa
  4. Open your mouth, Ha! Ha! Ha!

Step 1 — Text normalisation: Convert to lowercase and remove punctuation. For this worked calculation, retain the meaningful words (including “your”) so the assumptions are clear.

DocumentTokens
D1johny, johny, yes, papa
D2eating, sugar, no, papa
D3telling, lies, no, papa
D4open, your, mouth, ha, ha, ha

Step 2 — Create vocabulary: eating, ha, johny, lies, mouth, no, open, papa, sugar, telling, yes, your.

Step 3 — Calculate TF (word count in each document):

Documenteatinghajohnyliesmouthnoopenpapasugartellingyesyour
D1002000010010
D2100001011000
D3000101010100
D4030010100001

Step 4 — Document Frequency (DF): Count the number of documents containing each word. There are 4 documents in total.

Word(s)DFIDF = 4/DFlog10(IDF)
eating, ha, johny, lies, mouth, open, sugar, telling, yes, your140.602
no220.301
papa31.3330.125

Step 5 — Apply formula: TFIDF = TF × log10(4/DF).

Examples:

  • D1, johny: TF=2, DF=1 → TFIDF = 2 × log10(4) = 2 × 0.602 = 1.204.
  • D2, no: TF=1, DF=2 → TFIDF = 1 × log10(2) = 0.301.
  • D1, papa: TF=1, DF=3 → TFIDF = 1 × log10(4/3) ≈ 0.125.
  • D4, ha: TF=3, DF=1 → TFIDF = 3 × 0.602 = 1.806.

Step 6 — Final TFIDF vectors (rounded to 3 decimal places):

DocumentNon-zero TFIDF values
D1johny = 1.204; papa = 0.125; yes = 0.602
D2eating = 0.602; no = 0.301; papa = 0.125; sugar = 0.602
D3lies = 0.602; no = 0.301; papa = 0.125; telling = 0.602
D4ha = 1.806; mouth = 0.602; open = 0.602; your = 0.602

Conclusion: Words such as “johny”, “eating”, “sugar”, “lies”, “telling” and “ha” are specific to individual documents and receive higher IDF weights. “Papa” occurs in three documents and therefore has a lower IDF weight. “No” occurs in two documents and has an intermediate weight.

Calculation convention: The textbook formula uses raw term count and log10(N/DF). Some software packages use normalised TF, smoothing or other conventions, which can produce different numerical scores. The values above follow the formula taught in this chapter.

Additional CBSE Board Examination Practice

A. Multiple-choice questions

1. Which NLP stage checks the grammatical arrangement of words?
Answer: Syntactic Analysis. It examines sentence structure and grammar.
2. Which stage interprets “pulling your leg” as joking?
Answer: Pragmatic Analysis. It identifies the intended meaning in context.
3. Which process divides a sentence into words, numbers and symbols?
Answer: Tokenization. Each unit becomes a token.
4. Which process converts “studies” into “study” as a meaningful base word?
Answer: Lemmatization. It returns a meaningful lemma.
5. Which model ignores word order and counts vocabulary terms?
Answer: Bag of Words. It represents documents through vocabulary counts.
6. A word appears in every document. Under the textbook IDF formula, what is log10(IDF)?
Answer: 0. If it appears in all N documents, IDF=N/N=1 and log10(1)=0.
7. Which tool is a visual drag-and-drop no-code data-mining tool?
Answer: Orange Data Mining.
8. Which sentiment category indicates neither a positive nor a negative opinion?
Answer: Neutral.

B. Assertion–Reason practice

1. Assertion: Stemming may produce a non-dictionary word. Reason: Stemming removes affixes without checking whether the result is meaningful.
Answer: Both statements are true, and the Reason correctly explains the Assertion.
2. Assertion: A word with high document frequency always has a high IDF. Reason: IDF is calculated as total documents divided by document frequency.
Answer: Assertion is false; Reason is true. As DF increases, N/DF decreases.
3. Assertion: Discourse integration connects sentences. Reason: It considers relationships with preceding and succeeding sentences.
Answer: Both statements are true, and the Reason correctly explains the Assertion.
4. Assertion: Lowercasing can prevent “HELLO” and “hello” from being treated as separate tokens. Reason: It standardises text case.
Answer: Both statements are true, and the Reason correctly explains the Assertion.

C. Short-answer questions (2–3 marks)

1. Differentiate between syntax and semantics.

Syntax deals with the grammatical arrangement and relationship of words in a sentence. Semantics deals with the meaning of words and phrases and checks whether the sentence makes sense. A sentence can be grammatically correct but still have an unusual or incorrect meaning.

2. Why are stop words removed during text processing?

Stop words occur very frequently but usually add little information about the topic. Removing them reduces unnecessary tokens and allows a computer to focus on meaningful words. Their removal depends on the task; a word should be retained if it carries useful information.

3. What is the difference between a corpus and a document?

A document is one individual text item. A corpus is a collection of documents considered together for processing and analysis.

4. State two differences between script bots and smart bots.

Script bots follow predefined scripts and have limited functionality. Smart bots use AI capabilities, are more flexible and can handle a wider range of inputs. Script bots are generally simpler to create, while smart bots usually require more sophisticated development.

5. What is the role of document frequency in TFIDF?

Document frequency counts how many documents contain a term. It is used to calculate inverse document frequency. A term appearing in many documents receives a lower IDF, while a term appearing in fewer documents receives a higher IDF.

D. Long-answer questions (4–5 marks)

1. Explain the five stages of NLP with examples.
  1. Lexical analysis: Breaks text into paragraphs, sentences and words.
  2. Syntactic analysis: Checks grammar and word arrangement.
  3. Semantic analysis: Checks whether the sentence has meaningful content.
  4. Discourse integration: Connects a sentence with preceding and succeeding sentences to maintain coherence.
  5. Pragmatic analysis: Interprets the speaker’s intended meaning using real-world context, such as understanding “pulling your leg” as joking.
2. Explain all six steps of text normalisation.
  1. Sentence segmentation divides the corpus into sentences.
  2. Tokenization divides each sentence into words, numbers and special characters.
  3. Stop words, unnecessary special characters and numbers are removed where appropriate.
  4. Text is converted to a common case, usually lowercase.
  5. Stemming removes affixes to produce a stem, which may not be a meaningful word.
  6. Lemmatization produces a meaningful base word or lemma.
3. Explain Bag of Words and its implementation steps.

Bag of Words is a feature-extraction model that represents text using a vocabulary and the frequency of each vocabulary word. First, collect and preprocess the corpus. Next, create a dictionary of unique words. Then count each vocabulary word in every document and create a document vector. Repeat for all documents. The resulting table can be used as numerical input for machine-learning algorithms. Word order is not represented.

4. Explain TFIDF and its applications.

TFIDF estimates the importance of a word in a document relative to a corpus. TF is the count of a word in one document. DF is the number of documents containing that word. IDF is N/DF. The textbook formula is TFIDF(W)=TF(W)×log10(IDF(W)). Words common to all documents receive a low or zero IDF weight, while words concentrated in fewer documents receive a higher weight. Applications include document classification, topic modelling, information retrieval and stop-word filtering.

E. Competency-based / case-based questions

Case 1: A school analyses 500 student feedback comments. It wants to know whether comments are positive, negative or neutral. Identify the NLP application and explain its value.

Application: Sentiment analysis. It classifies feedback by polarity—positive, negative or neutral. The school can identify common areas of satisfaction and concern and use the results to improve services. Human review may still be needed for sarcasm or ambiguous comments.

Case 2: A news website automatically places articles into Sports, Politics and Business. Which NLP application is used? Explain.

Application: Text classification. The system analyses an article and assigns it to one of the predefined categories. This makes news easier to organise and search.

Case 3: A search system finds the word “and” in almost every document but finds “photosynthesis” in only two documents. Which term is likely to have higher IDF, and why?

Answer: “Photosynthesis” is likely to have higher IDF because it appears in fewer documents. “And” appears in many documents, so N/DF is close to 1 and its logarithm is close to 0.

Case 4: A chatbot always responds using a fixed set of menu options. Another chatbot understands varied questions and uses AI to generate responses. Compare them.

The first is a script bot because it follows predefined rules and fixed paths. The second is a smart bot because it uses AI/NLP to handle more varied language and has broader functionality.

Case 5: A sentence is grammatically correct, but the phrase “hot ice cream” is unusual. Which stage examines this problem?

Answer: Semantic analysis. It examines the meaning and meaningfulness of words and phrases, not just grammatical structure.

F. Numerical practice

1. A corpus contains 20 documents. A term occurs in 5 documents and 3 times in Document A. Calculate its IDF and TFIDF in A using the textbook formula.

N=20, DF=5, TF=3.

IDF=20/5=4.

log10(4)≈0.602.

TFIDF=3×0.602=1.806.

2. A term occurs in all 8 documents and 4 times in one document. Calculate its IDF and TFIDF.

N=8, DF=8, TF=4. IDF=8/8=1. log10(1)=0. Therefore TFIDF=4×0=0.

Quick Revision Notes

Important definitions

TermDefinition to learn
Natural languageA human language used for communication, such as English or French.
NLPAn AI sub-field that enables computers to analyse, understand and process human language.
LexiconThe collection of words and phrases used in a language.
CorpusA collection of written text from multiple documents.
TokenA word, number or special character treated as a separate unit.
Stop wordsFrequent words that often contribute little to the topic being analysed.
StemmingRemoving affixes to produce a stem without checking whether it is a meaningful word.
LemmatizationReducing a word to a meaningful base form called a lemma.
Bag of WordsA model that represents text through unique vocabulary words and their frequencies.
TFNumber of times a term occurs in one document.
DFNumber of documents in which a term occurs.
IDFTotal number of documents divided by document frequency, as used in this textbook.
Sentiment analysisAnalysis that classifies textual opinion as positive, negative or neutral.

Formula sheet

IDF(W) = N / DF(W)
TFIDF(W) = TF(W) × log10(IDF(W))

Where: N = total number of documents; DF(W) = number of documents containing word W; TF(W) = frequency of W in the selected document.

High-priority distinctions

CompareDifference
Syntax vs SemanticsGrammar/arrangement vs meaning.
Discourse vs PragmaticConnections between sentences vs intended meaning in real-world context.
Stemming vs LemmatizationMay produce a non-word vs produces a meaningful lemma.
Script bot vs Smart botPredefined script and limited functions vs AI-enabled flexibility and wider functions.
TF vs DFCount in one document vs count of documents containing the word.
BoW vs TFIDFRepresents word counts vs weights terms by local frequency and corpus-wide rarity.
Last-minute exam checklist
  • Learn the five NLP stages in the correct order.
  • Practise all six text-normalisation steps.
  • Know the examples “studies → studi” (stemming) and “studies → study” (lemmatization).
  • Be able to build a vocabulary and document-vector table.
  • Memorise the TFIDF formula and practise DF, IDF and logarithm calculations.
  • Prepare examples of voice assistants, captions, translation, sentiment analysis, text classification and keyword extraction.

Source coverage and verification

These notes follow the order and content of the uploaded 29-page PDF, Unit 6: Natural Language Processing. The page-by-page coverage checklist below records the material incorporated.

PDF page(s)Content covered in these notes
1Unit summary, objectives, outcomes, prerequisites and key concepts.
2–36.1 Introduction, natural-language features, break/brake and right/write, context examples, computer language and importance of NLP.
4–6NLP definition; applications; keyword extraction activity and Google Cloud Natural Language demonstration steps.
7–10Five NLP stages, diagrams/sequence, examples, summary and Test Yourself questions.
11–136.4 Chatbots, activity, named chatbot examples, script bot vs smart bot, Quiz Time.
13–176.5 Text Processing, corpus, six text-normalisation steps, stop words, case conversion, stemming and lemmatization tables/examples.
18–20Bag of Words definition, purpose, algorithm steps, Aman–Avni three-document worked example and document vectors.
20–24TFIDF, stop/frequent/rare words, TF, DF, IDF, formula, worked values and applications.
24–266.6 Code/no-code tools, sentiment analysis, customer service, Voice of the Customer and Orange walkthrough links.
26–28All 12 Test Yourself MCQs and Assertion–Reason questions with answers and explanations.
28–29All 10 Reflection Time questions, including normalisation and the four-document TFIDF numerical.
Source-faithful calculation note: The chapter’s TFIDF formula is followed exactly as printed: TF × log10(N/DF), using raw term counts. For the final nursery-rhyme corpus, punctuation is removed and the meaningful tokens are retained; the assumptions are stated so the working can be reproduced. The PDF links to an external Orange Data Mining walkthrough but does not print all software workflow screens as text; the supplied links are retained here.

Prepared as a learning resource from the supplied textbook PDF. Students should follow their teacher’s instructions if a classroom activity uses a particular stop-word list, software version or calculation convention.

Class 10 Artificial Intelligence · Unit 6: Natural Language Processing
Study • Practise • Revise
Back to top ↑

TEXTBOOK SOLUTION

Step-by-step solved textbook exercises, derivations, and solutions.

Class 10 AI Unit 6 – NLP Textbook Exercise Solutions
CBSE · Class 10 · Artificial Intelligence (417)

Unit 6: Natural Language Processing (NLP)

Complete textbook back-exercise solutions · Test Yourself · Assertion–Reason · Reflection Time · Worked Numericals

About these solutions

This document answers the textbook exercise from the uploaded Unit 6: Natural Language Processing PDF, especially the end-of-unit questions on pages 26–29. Answers are written in simple English for Class 10 students. Long-answer questions are explained in sufficient detail, and numerical questions show the steps and formulas.

Exam tip: For a 1-mark MCQ, write the correct option. For a 2–3 mark answer, write the definition and key points. For a long answer, explain the process in sequence and add an example wherever possible.

1. Test Yourself — Multiple-Choice Questions (Pages 26–28)

Q1. What is the primary challenge faced by computers in understanding human languages?
A) Complexity of human languages
B) Lack of computational power
C) Incompatibility with numerical data
D) Limited vocabulary
Correct answer: A) Complexity of human languages.

Explanation: Human languages contain ambiguity, different meanings, context, grammar, slang and changing expressions. The same word can have different meanings in different situations. Computers need NLP techniques to process these complexities.

Q2. How do voice assistants utilise NLP?
A) To analyse visual data
B) To process numerical data
C) To understand natural language
D) To execute tasks based on computer code
Correct answer: C) To understand natural language.

Explanation: Voice assistants such as Google Assistant, Alexa and Siri process spoken commands, identify the user's intention and respond or perform a requested task.

Q3. Which of the following is NOT a step in Text Normalisation?
A) Tokenisation
B) Lemmatization
C) Punctuation removal
D) Document summarisation
Correct answer: D) Document summarisation.

Explanation: Text normalisation cleans and standardises text through steps such as tokenisation, removing unnecessary punctuation and stop words, converting text to lowercase, stemming and lemmatisation. Document summarisation is a separate NLP task.

Q4. In text processing, what is the purpose of tokenisation?
A) Convert text into numerical data
B) Segment sentences into smaller units
C) Translate text into multiple languages
D) Summarise documents
Correct answer: B) Segment sentences into smaller units.

Explanation: Tokenisation divides text into smaller units called tokens. A token may be a word, number or special character. For example, “I love AI!” can be tokenised as I, love, AI, !.

Q5. What distinguishes lemmatisation from stemming?
A) Lemmatization produces meaningful words after affix removal, while stemming may not.
B) Lemmatization is faster than stemming.
C) Stemming ensures the accuracy of the final word.
D) Stemming generates shorter words compared to lemmatization.
Correct answer: A).

Explanation: Stemming removes word endings using simple rules and may produce a word fragment such as studi from studies. Lemmatisation uses vocabulary and grammatical information to produce a meaningful base word, such as study.

Q6. What is the primary purpose of the Bag of Words model in NLP?
A) Translate text into multiple languages
B) Extract features from text for machine-learning algorithms
C) Summarise documents
D) Remove punctuation marks
Correct answer: B) Extract features from text for machine-learning algorithms.

Explanation: Bag of Words converts text into a numerical representation by creating a vocabulary of unique words and recording how frequently each word occurs in each document. Machine-learning algorithms can then use these numerical features.

Q7. In text processing, what are stop words?
A) Words with frequent occurrence in the corpus
B) Words with negligible value that are often removed during preprocessing
C) Words with the lowest occurrence
D) Words with the most value added to the corpus
Correct answer: B).

Explanation: Stop words are commonly occurring words that usually add little topic-specific information, such as “the”, “is”, “and” and “of”. They are often removed so that the system can focus on more meaningful words. The exact stop-word list depends on the task.

Q8. What is the characteristic of rare or valuable words in the described plot?
A) They have the highest occurrence in the corpus
B) They are often stop words
C) They occur the least but add the most value to the corpus
D) They are typically removed during preprocessing
Correct answer: C).

Explanation: Rare or valuable words occur in fewer documents but may describe a document's specific subject. They can therefore receive a higher IDF value and contribute strongly to the TFIDF score.

Q9. What information does the document vector table provide?
A) Frequency of each word across all documents
B) Frequency of each word in a single document
C) Total number of words in the entire corpus
D) Average word length in the corpus
Correct answer: B) Frequency of each word in a single document.

Explanation: Each row of a document-vector table represents one document, and each column represents a vocabulary word. The value in a cell tells how many times that word occurs in that particular document.

Q10. What is the primary purpose of TFIDF in text processing?
A) Identify stop words
B) Remove punctuation
C) Identify the value of each word in a document
D) Translate text into multiple languages
Correct answer: C).

Explanation: TFIDF assigns a numerical importance score to a word in a document. A word receives a higher score when it occurs frequently in a particular document but appears in relatively few documents across the corpus.

Q11. Assertion: Pragmatic analysis in NLP involves assessing sentences for their practical applicability in real-world scenarios. Reason: Pragmatic analysis requires understanding intended meaning and considering practical or logical implications, rather than relying only on literal word meanings from semantic analysis.

Options: A) Both true and Reason correctly explains Assertion. B) Assertion true, Reason false. C) Both true, but Reason does not correctly explain Assertion. D) Assertion false, Reason true.

Correct answer: A). Both Assertion and Reason are true, and the Reason correctly explains the Assertion.

Explanation: Pragmatic analysis studies the intended meaning of a sentence in its real-life context. It considers the speaker's purpose and the situation in which the sentence is used. The Reason explains why pragmatic analysis goes beyond the literal meaning of individual words.

Q12. Assertion: Converting the entire text into lowercase following stop-word removal is a crucial preprocessing step in NLP. Reason: This ensures uniformity in word representation and prevents a machine from treating words with different cases as different entities.

Options: A) Both true and Reason correctly explains Assertion. B) Assertion true, Reason false. C) Both true, but Reason does not correctly explain Assertion. D) Assertion false, Reason true.

Correct answer: A). Both Assertion and Reason are true, and the Reason correctly explains the Assertion.

Explanation: Converting text to lowercase makes words such as “Hello”, “HELLO” and “hello” appear in the same form. This reduces unnecessary differences in the vocabulary and makes text analysis more consistent. It is a common preprocessing step, although case may need to be preserved in tasks where capitalisation carries useful information.

2. Reflection Time — Descriptive Questions (Pages 28–29)

Q1. Mention a few features of natural languages.

Natural languages are the languages that human beings use to communicate with one another, such as English, Hindi, Gujarati, French, Spanish and Japanese. Some important features are:

  1. They follow rules: Natural languages follow rules of syntax (sentence structure), lexicon (vocabulary) and semantics (meaning).
  2. They are redundant: The same information can often be communicated in different ways. For example, “Please close the door” and “Could you shut the door?” communicate a similar message.
  3. They change over time: New words, expressions and meanings are added as society, technology and culture change.
  4. They depend on context: A word or sentence can have different meanings depending on the situation in which it is used.
  5. They can be ambiguous: One word or sentence may have more than one possible meaning.

Conclusion: Natural languages are flexible and context-dependent. These features make human communication rich, but they also make it challenging for computers to understand language correctly.

Q2. What is the significance of NLP?

Natural Language Processing (NLP) is a sub-field of Artificial Intelligence that enables computers to analyse, understand and process human languages to obtain meaningful information.

NLP is significant because computers mainly process information in digital and numerical forms, whereas humans communicate using spoken and written languages. NLP helps bridge this gap and makes communication between humans and computer systems easier.

Importance of NLP:

  1. It allows computers to understand human text and speech.
  2. It makes voice assistants such as Google Assistant, Alexa and Siri possible.
  3. It supports language translation between different languages.
  4. It helps generate captions and convert speech into text.
  5. It analyses customer reviews and feedback through sentiment analysis.
  6. It helps classify documents, extract keywords and find useful information.
  7. It supports chatbots that answer questions and help users.

Conclusion: NLP makes human-computer communication more natural and useful. It is widely used in education, business, healthcare, customer service and many other fields.

Q3. What do you mean by lexical analysis in NLP?

Lexical analysis is the first stage of Natural Language Processing. It deals with identifying and analysing the structure of the input text by breaking a large piece of text into smaller units such as paragraphs, sentences and words.

The word “lexicon” refers to the collection of words and phrases used in a language. During lexical analysis, the system identifies the words or tokens present in the input so that later stages can process them.

Example: The sentence “Students are learning NLP” can be divided into the tokens Students, are, learning and NLP.

Conclusion: Lexical analysis organises the input text into smaller language units and prepares it for further NLP stages such as syntactic and semantic analysis.

Q4. What do you mean by a chatbot?

A chatbot is a computer program designed to simulate a conversation with a human through text messages, voice commands or both. It uses predefined rules, artificial intelligence and, in many cases, Natural Language Processing to understand a user's message and provide a suitable response.

Uses of chatbots:

  • Answer frequently asked questions.
  • Provide customer support and troubleshoot common problems.
  • Help users find products or services on e-commerce websites.
  • Generate sales leads and guide customers.
  • Provide information and assistance at any time.

Types of chatbots:

  1. Script-bot: A traditional chatbot that follows predefined rules, scripts and decision paths. It generally responds to specific keywords or selected options.
  2. Smart-bot: An AI-powered chatbot that uses NLP and machine-learning techniques to understand messages more flexibly and generate or select relevant responses.

Examples: Website customer-support chatbots, banking support bots and AI conversational assistants.

Conclusion: Chatbots make communication between users and organisations faster and more convenient by providing automated assistance.

Q5. What does the term “Bag of Words” refer to in Natural Language Processing?

Bag of Words (BoW) is a text-representation technique in NLP that converts documents into numerical features. It creates a vocabulary containing all unique words in a collection of documents and records the frequency of each vocabulary word in each document.

It is called a “bag” because the order and grammar of the words are ignored. The model focuses mainly on which words occur and how many times they occur.

Example:

  • Document 1: “AI is useful”
  • Document 2: “AI is powerful”

Vocabulary: AI, is, useful, powerful.

DocumentAIisusefulpowerful
Document 11110
Document 21101

Uses: The numerical vectors can be used by machine-learning algorithms for tasks such as text classification and document analysis.

Q6. Describe two practical uses of Natural Language Processing in real-world scenarios.

NLP is used in many applications that help computers understand, interpret and respond to human language. Two practical uses are:

1. Voice Assistants: Voice assistants such as Google Assistant, Amazon Alexa and Apple Siri use NLP to understand spoken commands. For example, when a user says, “Set an alarm for 6 AM”, the assistant processes the sentence, identifies the user's intention and sets the alarm.

2. Language Translation: NLP is used by translation systems such as Google Translate to convert text or speech from one language into another. It helps people who speak different languages communicate and understand information.

Other examples: Automatic captions convert speech into text, sentiment analysis identifies positive or negative opinions, and chatbots answer customer questions.

Conclusion: NLP reduces language barriers and makes digital services easier to use in everyday life.

Q7. Explain the process of stemming and lemmatisation in text processing, supported by an example.

Stemming and lemmatisation are text-normalisation techniques used to reduce related words to a common base form. They help reduce the number of different word forms that a computer needs to process.

1. Stemming: Stemming removes prefixes or suffixes (affixes) from a word using simple rules. It may produce a word that is not a proper dictionary word.

Examples:

Original wordAffix removedStem
healed-edheal
healing-ingheal
healer-erheal
studies-esstudi

Notice that “studi” is not the correct dictionary word. Stemming may produce such fragments because it mainly removes affixes.

2. Lemmatisation: Lemmatisation converts a word into its meaningful dictionary base form, known as a lemma. It uses vocabulary and grammatical information to select the correct base word. It is generally more accurate but can take more processing time than stemming.

Original wordLemma
healedheal
healingheal
healerheal
studiesstudy
studyingstudy

Difference: Stemming removes word endings mechanically and may create an incomplete word, whereas lemmatisation finds a meaningful dictionary form by considering the word and its grammatical use.

Remember: “studies” → “studi” by the example of stemming in the textbook, but “studies” → “study” by lemmatisation.
Q8. Describe any four applications of TFIDF.

TFIDF stands for Term Frequency–Inverse Document Frequency. It assigns an importance score to a word by considering how often it occurs in a particular document and how common it is across the entire collection of documents.

Four applications of TFIDF are:

  1. Document Classification: TFIDF converts documents into numerical features. A machine-learning model can use these features to classify documents into categories such as sports, politics, education or business.
  2. Topic Modelling: TFIDF helps identify important words in documents. These words can provide clues about the main topics discussed in a collection of documents.
  3. Information Retrieval System: Search systems can use TFIDF to identify documents containing important query terms and rank relevant documents. Words that are more informative can receive higher weights.
  4. Stop-Word Filtering: TFIDF can help identify words that occur in nearly all documents and have little distinguishing value. Such words can be considered for filtering, depending on the task.

Conclusion: TFIDF helps computers identify important words and represent documents numerically, making it useful in search, classification and text analysis.

Q9. Samiksha is performing text normalisation. Normalise the following segmented sentences.

Document 1: Akash and Ajay are best friends.

Document 2: Akash likes to play football but Ajay prefers to play online games.

We will apply the textbook's normalisation steps in order. For this worked answer, common stop words such as “and”, “are”, “to” and “but” are removed; punctuation is removed; text is converted to lowercase; and words are lemmatised to meaningful base forms.

Step 1: Sentence segmentation

The two sentences are already provided separately, so they form two documents.

Step 2: Tokenisation

Each sentence is divided into individual word tokens.

Document 1: [Akash, and, Ajay, are, best, friends, .]
Document 2: [Akash, likes, to, play, football, but, Ajay, prefers, to, play, online, games, .]

Step 3: Remove stop words and punctuation

Remove “and”, “are”, “to”, “but” and the full stop. These words and punctuation marks are not needed for this example's content representation.

Document 1: [Akash, Ajay, best, friends]
Document 2: [Akash, likes, play, football, Ajay, prefers, play, online, games]

Step 4: Convert all words to lowercase

Document 1: [akash, ajay, best, friends]
Document 2: [akash, likes, play, football, ajay, prefers, play, online, games]

Step 5: Apply lemmatisation

Convert inflected words into meaningful base forms. For example, “likes” becomes “like”, “friends” becomes “friend”, “prefers” becomes “prefer” and “games” becomes “game”. The word “play” is already in its base form.

Document 1: [akash, ajay, best, friend]
Document 2: [akash, like, play, football, ajay, prefer, play, online, game]
Final normalised documents:
Document 1: [akash, ajay, best, friend]
Document 2: [akash, like, play, football, ajay, prefer, play, online, game]

Note: A stop-word list and lemmatisation output can vary by tool and language model. The important point is to apply the same rules consistently to all documents.

3. Reflection Time Q10 — Step-by-Step TFIDF Numerical (Page 29)

Q10. Calculate TFIDF for the following corpus.

Document 1: Johny Johny Yes Papa

Document 2: Eating sugar? No Papa

Document 3: Telling lies? No Papa

Document 4: Open your mouth, Ha! Ha! Ha!

We will follow the TFIDF method explained in the textbook. First, remove punctuation and common stop words (“yes”, “no”, “your”), and convert the remaining words to lowercase. Repeated words are retained because their frequency matters.

Calculation convention: This worked solution uses raw term frequency (count of the word in the document) and IDF = log10(N/DF), matching the textbook's base-10 logarithm explanation. Different software may use smoothed or normalised TFIDF variants.

Step 1: Text preprocessing

DocumentOriginal textAfter preprocessing
D1Johny Johny Yes Papajohny, johny, papa
D2Eating sugar? No Papaeating, sugar, papa
D3Telling lies? No Papatelling, lies, papa
D4Open your mouth, Ha! Ha! Ha!open, mouth, ha, ha, ha

Step 2: Create the vocabulary

List each unique word only once across all four documents.

Vocabulary = [johny, papa, eating, sugar, telling, lies, open, mouth, ha]

Step 3: Calculate Term Frequency (TF)

Term Frequency is the number of times a word appears in a particular document.

Documentjohnypapaeatingsugartellingliesopenmouthha
D1210000000
D2011100000
D3010011000
D4000000113

Step 4: Calculate Document Frequency (DF)

Document Frequency tells us the number of different documents in which a word occurs. Count a document only once, even if the word is repeated in it.

WordDocuments containing the wordDF
johnyD11
papaD1, D2, D33
eatingD21
sugarD21
tellingD31
liesD31
openD41
mouthD41
haD41

Step 5: Calculate Inverse Document Frequency (IDF)

Total number of documents N = 4.

IDF(word) = log10(Total number of documents / Document Frequency)
IDF = log10(4 / DF)

For “johny”: DF = 1, therefore IDF = log10(4/1) = log10(4) = 0.6021.

For “papa”: DF = 3, therefore IDF = log10(4/3) = log10(1.3333) = 0.1249.

Every other vocabulary word occurs in one document, so its IDF is also log10(4) = 0.6021.

WordDFIDF = log10(4/DF)
johny10.6021
papa30.1249
eating10.6021
sugar10.6021
telling10.6021
lies10.6021
open10.6021
mouth10.6021
ha10.6021

Step 6: Calculate TFIDF = TF × IDF

Multiply each word's TF in a document by that word's IDF. Example: In D1, the word “johny” has TF = 2 and IDF = 0.6021.

TFIDF(johny, D1) = 2 × 0.6021 = 1.2042
TFIDF(papa, D1) = 1 × 0.1249 = 0.1249

Final TFIDF table (values rounded to four decimal places):

Documentjohnypapaeatingsugartellingliesopenmouthha
D11.20420.12490000000
D200.12490.60210.602100000
D300.1249000.60210.6021000
D40000000.60210.60211.8063
Final conclusion: “Papa” occurs in three documents, so its IDF is low (0.1249). The other retained words occur in only one document, so their IDF is higher (0.6021). “Johny” occurs twice in D1, giving TFIDF = 1.2042, while “ha” occurs three times in D4, giving TFIDF = 1.8063. This shows that TFIDF considers both the frequency of a word in one document and how widely it is distributed across the corpus.
Preprocessing note: The question does not specify an exact stop-word list. This solution explicitly removes “yes”, “no” and “your” as common words for the worked example. If a teacher or software tool uses a different stop-word list, the vocabulary and TFIDF values may differ. The calculation method remains the same.

4. Quick Revision — Important NLP Terms

TermEasy meaning
Natural LanguageA language used by humans to communicate, such as English or Hindi.
NLPA branch of AI that helps computers process and understand human language.
Lexical AnalysisBreaking input text into language units such as words and tokens.
Syntactic AnalysisChecking grammar and relationships among words.
Semantic AnalysisChecking the meaning of words and sentences.
Discourse IntegrationConnecting the meaning of a sentence with preceding and following sentences.
Pragmatic AnalysisUnderstanding intended meaning in a real-world context.
CorpusA collection of text documents used for analysis.
TokenA word, number or special character treated as a separate unit.
Stop WordsCommon words that often contribute little topic-specific information.
StemmingRemoving affixes to produce a stem, which may not be a complete word.
LemmatisationConverting a word into its meaningful dictionary base form.
Bag of WordsRepresenting documents by vocabulary words and their frequencies.
TFNumber of times a term occurs in one document.
DFNumber of documents containing a term.
IDFLogarithmic measure that gives more weight to terms found in fewer documents.
TFIDFTerm Frequency multiplied by Inverse Document Frequency.
Sentiment AnalysisIdentifying whether text expresses a positive, negative or neutral opinion.

Stages of NLP — correct order

  1. Lexical Analysis
  2. Syntactic Analysis / Parsing
  3. Semantic Analysis
  4. Discourse Integration
  5. Pragmatic Analysis

Text Normalisation — typical order

  1. Sentence Segmentation
  2. Tokenisation
  3. Removal of stop words, unnecessary special characters and numbers (as appropriate)
  4. Conversion to a common case, usually lowercase
  5. Stemming or lemmatisation
  6. Numerical representation using methods such as Bag of Words and TFIDF

5. Exercise Coverage

This document covers the end-of-unit exercise in the supplied 29-page PDF:

  • Pages 26–28: all 10 MCQs and both Assertion–Reason questions.
  • Pages 28–29: all 10 Reflection Time questions.
  • Q9: complete text-normalisation example for both documents.
  • Q10: full TFIDF calculation for the four-document “Johny Johny” corpus.

Short “Test Yourself” activities and informal discussion prompts earlier in the chapter are classroom activities rather than the end-of-unit back exercise. The solutions above focus on the complete final exercise and provide supporting revision material.

Class 10 Artificial Intelligence (417) · Unit 6: Natural Language Processing
Back to top ↑

IMPORTANT QUESTION

High-yield board questions, previous year questions (PYQs), and model answer keys.

Important Questions Being Compiled

Board blueprint and previous years' exam questions for this chapter will be live soon.