NLP 2
NLP 2
Sure! Here's a clear, exam-ready answer for Differentiating between Syntactic Ambiguity and
Lexical Ambiguity, perfect for your Mumbai University BE NLP exams.
Source of Sentence structure leads to more than Word meaning leads to confusion
Ambiguity one possible interpretation. because it has different senses.
Example 1 “I saw the man with the telescope.” “He went to the bank.” Which
Who has the telescope? (You? Or the bank? (Riverbank or financial bank?)
man?)
Example 2 “Flying planes can be dangerous.” “The bat flew out of the cave.”
Planes that are flying? Or the act of flying Bat (animal)? Or bat (used in
planes? cricket)?
Short Definitions:
• Syntactic Ambiguity:
Occurs when the structure of a sentence allows for multiple interpretations.
• Lexical Ambiguity:
Occurs when a word in a sentence has more than one meaning.
Summary with Example Sentences:
Word: “Crane”
Meaning 1: A type of bird.
Meaning 2: A construction machine.
Let me know if you want more examples or diagrams to help memorize this! Ready for the next
question?
Sure! Here's an exam-ready answer for your Mumbai University BE NLP paper on Affixes.
Definition of Affixes:
An affix is a morpheme (the smallest unit of meaning in a language) that is attached to a root word
or base word to form a new word or change its grammatical function.
Purpose of Affixes:
Prefix Added before the root word. un- in unhappy re- in rewrite
Suffix Added after the root word. -ness in kindness -ing in running
Infix Inserted inside the root word. Rare in English. Example (informal): fan-bloody-
tastic
Circumfix Added both before and after a Rare in English. Example (in German): ge-...-t
word. "geliebt" (loved)
1⃣ Prefix
2⃣ Suffix
3️⃣ Infix
4️⃣ Circumfix
• Not commonly used in English but found in languages like German and Dutch.
Example (German):
Diagram Summary:
• Prefix: Front
• Suffix: End
• Infix: Inside
• Circumfix: Around
Let me know if you want examples for morphological analysis or diagrams for your notes!
Ready for the next question?
Q: Describe open class words and closed class words in English with examples.
Sure! Here's a clear and exam-ready answer on Open Class Words and Closed Class Words in
English, ideal for your Mumbai University BE NLP exam.
Definition:
Open class words are content words that carry the main meaning in a sentence.
Examples:
• New words are frequently added, especially with technology and trends.
Example:
Definition:
Closed class words are function words that help in the grammatical structure of a sentence.
• The class is "closed" because new members are not easily added.
Examples:
Articles the, a, an
• The word "and" or "the" has existed for centuries without change.
Function Express concepts and ideas Link and organize words in sentences
Open Class:
• Noun: Student
• Verb: Study
• Adjective: Brilliant
• Adverb: Quickly
Closed Class:
• Pronoun: She
• Preposition: On
• Conjunction: And
• Article: The
Importance in NLP:
• Open class words are important in information extraction and semantic analysis.
• Closed class words are crucial in syntactic parsing and grammar structure.
Here’s an exam-friendly answer for Rule-Based Machine Translation (RBMT), suitable for your
Mumbai University BE NLP paper:
Rule-Based Machine Translation (RBMT)
Definition:
Rule-Based Machine Translation (RBMT) is a method of automatically translating text from one
language (source language) to another (target language) using linguistic rules and bilingual
dictionaries.
1. Analysis Phase:
2. Transfer Phase:
o The system translates the analyzed text into the target language structure.
3. Generation Phase:
o The translated structure is generated in the target language, following its grammar
and syntax.
1. Direct Translation:
o Word-for-word translation.
2. Transfer-Based Translation:
3. Interlingua-Based Translation:
Advantages of RBMT:
• Useful for specialized domains where rules are well-defined (legal, medical).
Disadvantages of RBMT:
• Requires a lot of linguistic knowledge and manual effort to create rules and dictionaries.
English Sentence:
The student reads a book.
RBMT Process:
• Morphological Analysis:
• Syntactic Structure:
Applications of RBMT:
Let me know if you want an easy-to-remember flow diagram for the RBMT process! Ready for the
next question?
Q: Explain with suitable example following relationships between word meanings. Homonymy,
Polysemy, Synonymy, Antonymy
Absolutely! Here's a clear and concise answer on the relationships between word meanings,
covering Homonymy, Polysemy, Synonymy, and Antonymy, perfect for your Mumbai University BE
NLP exams.
1. Homonymy
Definition:
Homonymy refers to two or more words that sound the same or are spelled the same, but have
different meanings and different origins.
Example:
• Bank
Explanation:
Same word “bank”, but different meanings and no relation between them.
2. Polysemy
Definition:
Example:
• Mouth
Explanation:
The meanings are related (both refer to an opening).
3️. Synonymy
Definition:
Synonymy refers to two or more words that have similar or identical meanings.
Example:
Explanation:
Both “begin” and “start” have similar meanings (to initiate something).
4️. Antonymy
Definition:
Example:
• Hot ↔ Cold
Explanation:
The words “hot” and “cold” are opposites in temperature.
Polysemy One word, related multiple meanings Foot (of a person) / Foot (of a
mountain)
Let me know if you want diagrams or mnemonics to memorize these! Ready for the next one?
Here's a simple and exam-friendly explanation of Perplexity in Language Models, tailored for your
Mumbai University BE NLP paper:
Definition:
Perplexity is a measurement used to evaluate how well a language model predicts a sample.
It shows how confused or uncertain the model is when it makes predictions.
Lower perplexity means the model is better at predicting the next word in a sequence.
Higher perplexity means the model is less accurate (more confused).
Mathematical Formula:
For a probability distribution given by a language model over a test set, perplexity (PP) is calculated
as:
Or equivalently:
PP(W)=2H(W)PP(W) = 2^{H(W)}
Where:
Interpretation:
• A bigram model (predicts word based on the previous one) may have higher perplexity.
• A trigram model (predicts word based on the previous two) usually has lower perplexity,
because it captures more context.
• Perplexity is used to evaluate models like N-gram models, Neural language models, and
GPT-like models.
Concept Explanation
Perplexity measures How well the model predicts the next word
Here's a clear and exam-ready answer to “Explain the role of FSA in Morphological Analysis”,
perfect for your Mumbai University BE NLP paper!
Morphological analysis is the process of analyzing the structure of words and breaking them
down into morphemes (smallest units of meaning), such as roots, prefixes, and suffixes.
Example:
• Word: “unhappiness”
An FSA is a computational model made up of states and transitions, used to recognize patterns
or sequences of inputs.
In NLP, FSAs are used to model word structures, morphological rules, and to process text
efficiently.
o FSA can recognize valid word forms by traversing states that represent morphemes
(prefix, root, suffix).
2. Example:
FSA can recognize that “cats” is composed of cat + s (root + plural marker).
o Example:
Input = “replayed”
Output = re- (prefix) + play (root) + -ed (suffix)
o FSAs are fast and simple, suitable for processing large dictionaries and efficient
morphological analysis.
Example:
Type Use
Finite State Acceptors Recognize whether a word is valid
Finite State Transducers (FST) Map between surface forms and lexical/morphological forms
• FSAs are simple, fast, and suitable for rule-based morphology systems.
Let me know if you want more examples or a diagram explanation! Ready for the next question?
Here’s a simple and exam-ready answer to “Explain Different Stages Involved in NLP Process with
Suitable Example”, tailored for your Mumbai University BE NLP exam!
I’ve broken it down into clear points so you can remember and write easily.
Natural Language Processing (NLP) involves a series of stages to analyze, understand, and generate
human language by machines.
What Happens?
The text is divided into smaller units such as words, sentences, or tokens.
Purpose:
Identify basic units (tokens) for further processing.
Example:
Input: “NLP is interesting.”
Tokens: [NLP], [is], [interesting], [.]
2. Morphological Analysis
What Happens?
It analyzes the structure of words and breaks them into morphemes (smallest meaningful units).
Purpose:
Understand roots, prefixes, suffixes, etc.
Example:
Word: “unhappiness” → un- + happy + -ness
What Happens?
Check the grammar and structure of the sentence based on grammar rules.
Purpose:
Generate a parse tree that shows the syntactic structure.
Example:
Sentence: “The cat sits on the mat.”
What Happens?
Understand the meaning of words and sentences.
Purpose:
Map syntactic structures to their meanings.
Example:
“The cat sits on the mat.”
→ It understands that there is a cat that is sitting on a mat.
5. Discourse Analysis
What Happens?
Analyzes relationships between sentences in a paragraph or conversation.
Purpose:
Ensure contextual consistency and reference resolution.
Example:
“Ravi went to the shop. He bought apples.”
→ Understands “He” refers to Ravi.
6. Pragmatic Analysis
What Happens?
Interpret the intended meaning in context, including speaker intention and real-world knowledge.
Purpose:
Derive meaning beyond literal words.
Example:
“Can you pass the salt?”
→ It’s not a question about ability, but a request.
What Happens?
Deals with speech-to-text and text-to-speech conversions.
Purpose:
Understand and generate spoken language.
Example:
Voice input: “What is the weather today?”
System converts speech to text → processes it → responds.
Input Sentence:
“John gave Mary a book.”
Stage Explanation
Lexical Analysis Split text into tokens NLP → [N], [L], [P]
Syntactic Analysis Check grammatical structure “The cat sat on the mat.”
(parsing)
Pragmatic Analysis Understand intention & context “Can you pass the salt?” → Request
Let me know if you need diagrams, flowcharts, or more examples! Ready for the next question?
Q: Consider the following corpus <s> I tell you to sleep and rest </s> <s> I would like to sleep for an
hour </s> <s> Sleep helps one to relax </s> List all possible bigrams. Compute conditional
probabilities and predict the next ord for the word “to”.
Let's break it down step by step in a clear, easy-to-write format for your Mumbai University NLP
exam!
Given Corpus:
From Sentence 1:
<s> I
I tell
tell you
you to
to sleep
sleep and
and rest
rest </s>
From Sentence 2:
<s> I
I would
would like
like to
to sleep
sleep for
for an
an hour
hour </s>
Sleep helps
helps one
one to
to relax
relax </s>
<s> I
I tell
tell you
you to
to sleep
sleep and
and rest
rest </s>
I would
would like
like to
sleep for
for an
an hour
hour </s>
Sleep helps
helps one
one to
to relax
relax </s>
Step 3️: Count Bigram Occurrences
Bigram Count
I 2
Sleep 1
I tell 1
I would 1
tell you 1
you to 1
would like 1
like to 1
to sleep 2
sleep and 1
sleep for 1
Sleep helps 1
helps one 1
one to 1
to relax 1
and rest 1
rest 1
for an 1
an hour 1
hour 1
relax 1
Formula:
• to sleep → Count = 2
• to relax → Count = 1
**sleep**
Final Answer (For your exam):
I, I tell, tell you, you to, to sleep, sleep and, and rest, rest ,
I, I would, would like, like to, to sleep, sleep for, for an, an hour, hour ,
Sleep helps, helps one, one to, to relax, relax .
Prediction:
The next word after "to" is sleep, as it has the highest probability.
Let me know if you want me to explain unigram probabilities or build the full probability table!
Introduction:
• Mainly used for word sense disambiguation (WSD) but also applicable to text classification
tasks.
Step Explanation
2 Build an initial classifier (based on features like collocations, context words, etc.).
3️ Apply the classifier to the unlabeled data to assign labels to high-confidence examples.
5 Retrain the classifier on the new labeled set (old + new examples).
6 Repeat steps 3-5 until no more new high-confidence predictions are found (or convergence
is reached).
• Sense 1: Factory
Step 1:
Step 2:
Step 3️:
Step 4️:
• Add high-confidence predictions to training data.
Disadvantages:
↑ ↓
Yarowsky Bootstrapping is a semi-supervised learning algorithm that starts with a small set of
labeled examples, builds a classifier, and then iteratively labels unlabeled data by adding high-
confidence predictions to the training data. It works on the assumptions of one sense per
collocation and one sense per discourse, and was initially designed for word sense disambiguation
tasks.
Let me know if you want a flowchart or MCQs based on this topic for revision!
Here's a clear and structured answer for POS Tagging and its challenges, perfect for your
Mumbai University NLP exams:
Example:
POS Tags:
The (Determiner)
cat (Noun)
sat (Verb)
on (Preposition)
the (Determiner)
mat (Noun)
POS Meaning
NN Common noun
VB Verb (base)
JJ Adjective
RB Adverb
IN Preposition
DT Determiner
Challenge Explanation
1. Ambiguity of Words Many words can have multiple parts of speech depending on context.
Example: "Book" can be a noun (Read a book) or a verb (Book a ticket).
2. Unknown Words New words, slang, technical terms, or foreign words may not be
(Out-of-Vocabulary) present in the training data, making them hard to tag.
3️. Context Dependency The same word can have different POS tags depending on sentence
structure. Example: "Fast": - He runs fast (adverb). - He drives a fast car
(adjective).
4️. Free Word Order Languages like Hindi have flexible word order, making POS tagging
Languages harder compared to fixed word order languages like English.
5. Complex Sentence Long sentences, nested clauses, and coordination increase complexity.
Structures
6. Multiword Phrases like "kick the bucket" or "give up" act as a single semantic unit,
Expressions (MWEs) but tagging individual words can cause confusion.
7. Domain Adaptation A POS tagger trained on news articles may not work well on medical
texts, social media, or legal documents due to domain-specific
vocabulary.
8. Lack of Annotated For low-resource languages, there may be insufficient labeled corpora
Data to train accurate POS taggers.
POS Tagging assigns parts of speech (noun, verb, adjective, etc.) to words in a sentence based on
context.
Challenges include word ambiguity, unknown words, context dependency, free word order,
complex sentence structure, multiword expressions, domain adaptation, and lack of annotated
data.
Let me know if you want a diagram, flowchart, or MCQ practice for this topic!
Q: What are the limitations of Hidden Markov Model?
Here’s a clear, exam-friendly answer for the limitations of Hidden Markov Models (HMMs) in
Natural Language Processing (NLP)—perfect for your Mumbai University BE exams in Artificial
Intelligence & Machine Learning!
Hidden Markov Models (HMMs) are widely used for tasks like POS tagging, speech recognition, and
sequence labeling in NLP.
However, they have several limitations, as listed below:
• HMM assumes that the current state depends only on the previous state (first-order Markov
assumption).
This ignores long-range dependencies between words in a sentence.
• In natural language, context often depends on more than just the previous word.
• It tries to model the entire data distribution, which can be complex and inefficient,
especially when discriminative models like Conditional Random Fields (CRFs) focus directly
on prediction (P(states | observations)).
7. Time Complexity
• For large vocabularies and many states, the computation of probabilities (using algorithms
like Viterbi) can become slow and expensive.
Limitations of HMMs:
Alternative models like CRFs and Neural Networks (LSTMs, BERT) overcome many of these
limitations.
Let me know if you want a comparison table between HMM and CRF, or examples of real-world
HMM applications!
• This corpus becomes the data source for indexing and searching.
2. Tokenization
• Break down text into smaller units called tokens (words, phrases, symbols).
Example:
• Common, frequent words that do not add significant meaning are removed.
Example:
• “Retrieval” → “retrieval”
• “better” → “good”
6. Indexing
• Create an inverted index mapping terms to document IDs where they appear.
Example:
• IDF (Inverse Document Frequency): How rare a term is across all documents.
8. Query Processing
• User query goes through same preprocessing steps (tokenization, stop word removal,
stemming).
• Query terms are matched with the inverted index to retrieve documents.
• Retrieved documents are ranked based on relevance scores (TF-IDF, BM25, etc.).
• The system may use user feedback (clicks, ratings) to improve future searches.
Here's a clear, structured answer comparing Top-Down and Bottom-Up Parsing—perfect for
your Mumbai University BE exams in NLP!
In Natural Language Processing (NLP), parsing is the process of analyzing a sentence to understand
its syntactic structure, typically represented by a parse tree.
Direction of Starts from the root (start symbol) and Starts from the leaves (input words)
Parsing goes down to the leaves (input words). and goes up to the root (start
symbol).
Approach Predictive—tries to predict the Constructive—builds the structure
structure from the grammar. from the input tokens.
Process Begins with the start symbol (e.g., S) Begins with the input sentence and
and applies production rules to applies reductions to reach the start
generate the sentence. symbol.
Goal Try to derive the sentence from the Try to reduce the sentence into the
start symbol. start symbol.
Type of Works best with context-free grammars Can handle left recursion better and
Grammar that are non-left-recursive. works well with ambiguous
grammars.
Grammar Rule:
S → NP VP
1. Start with S
2. Expand S → NP VP
4. Expand VP → V ("sleeps")
Prediction first, match later. | Sentence: "The cat sleeps"
6. "cat" → N
7. Combine Det + N → NP
8. "sleeps" → V
9. Combine NP + V → S
Build parts first, combine later. | | Advantages | Simpler and intuitive
Easy to implement | Efficient for complex grammars
Handles ambiguity better | | Disadvantages | Struggles with left recursion
May explore unnecessary possibilities (inefficient). | Can be less intuitive
More complex to implement in some cases. |
Grammar:
S → NP VP
NP → Det N
VP → V
Det → "The"
N → "cat"
V → "sleeps"
• Start with S
• Expand: S → NP VP
• Expand: NP → Det N
• Expand: VP → V
• Match: V → sleeps
• "The" → Det
• "cat" → N
• Combine: Det + N → NP
• "sleeps" → V
• Combine: NP + V → S
Top-Down Bottom-Up
Can't handle left recursion well Can handle left recursion better
Q: What do you mean by word sense disambiguation (WSD)? Discuss dictionary based approach for
WSD.
Here's a clear and exam-friendly answer for Word Sense Disambiguation (WSD) and its
Dictionary-Based Approach, tailored for your Mumbai University BE AI/ML NLP paper!
Word Sense Disambiguation (WSD) is the task of identifying the correct meaning (sense) of a word
in context when the word has multiple meanings (polysemy).
Example:
• Word: “Bank”
WSD helps machines understand and process natural language accurately by selecting the
correct sense of words.
The dictionary-based approach uses lexical resources like dictionaries, thesauri, or WordNet to
identify the correct sense of a word.
Main Idea:
• It compares the context of the ambiguous word with the definitions (glosses) of each
possible sense in the dictionary.
• The sense whose gloss has the largest overlap with the context is selected.
Example:
Target Word: “Plant”
• Algorithms match these semantic relations with context to choose the correct sense.
• Easy to implement.
Limitations
Dictionary-Based Approach Uses dictionaries (WordNet) to compare glosses and select sense.
Let me know if you want me to explain the Lesk Algorithm step-by-step, or show
diagrams/flowcharts for better understanding!
Here's a clear, exam-oriented answer for Hobbs Algorithm used in Anaphora (Pronoun)
Resolution, tailored for your Mumbai University BE AI/ML NLP exam.
Anaphora resolution is the task of finding the antecedent (reference) of a pronoun or anaphoric
expression in a sentence.
Example:
Definition:
2. Go up the tree to the first NP or S node. Call this node X, and the path you took P.
3. Traverse all branches below node X to the left of path P, in left-to-right, breadth-first order.
Any NP encountered is a potential antecedent.
4. If X is the highest S node, continue to step 5.
Otherwise:
Example Sentence:
Parse Trees:
• S
├─ NP (John)
└─ VP (went ...)
• S
├─ NP (He)
└─ VP (played ...)
Pronoun: "He"
Start at NP (He)
• Move up to S
Limitations
Feature Details
Key Steps Go up the tree → Traverse left branches → Move to previous sentences
Let me know if you want a diagram of tree traversal for better understanding or examples with
complex sentences!
Here's a simple, clear, and exam-friendly answer for Text Summarization, perfect for your
Mumbai University BE AI/ML NLP exam.
Definition:
Text Summarization is the process of automatically generating a shorter version of a long text
document while preserving its key information and meaning.
It aims to reduce the size of the content without losing important points.
1. Extractive Summarization
• Selects important sentences, phrases, or paragraphs directly from the original text.
Example:
Original text:
"Natural Language Processing is a field of AI. It deals with interaction between computers and
human languages."
Extractive summary:
"Natural Language Processing is a field of AI."
How it works:
o Frequency of keywords
o Sentence position
2. Abstractive Summarization
• Uses deep learning models to understand the text and reproduce key ideas in its own
words.
Example:
Original text:
"Natural Language Processing deals with the interaction between computers and human
languages."
Abstractive summary:
"NLP enables computers to understand human language."
How it works:
• Uses Seq2Seq models, Transformer models like BERT, GPT, T5, etc.
Method Description
TF-IDF Gives importance to words that are frequent in the document but rare
elsewhere
Graph-Based Builds a graph where sentences are nodes, and edges represent similarity.
(TextRank) Sentences are ranked and top-ranked ones are selected
Concept Details
Let me know if you want examples of algorithms like TextRank or Transformer-based models
explained!
Here's a clear, exam-oriented answer for the Porter Stemming Algorithm, perfect for your
Mumbai University BE AI/ML NLP exams (NLP Subject).
Definition:
The Porter Stemming Algorithm is a rule-based algorithm used for reducing words to their
stem/root form.
It helps in removing suffixes from words, thereby simplifying words to a common base form.
Example:
Purpose of Stemming:
• Reduce words to their base form (stem) to improve text processing tasks like:
o Information retrieval
o Text classification
o Search engines
Developed By:
• Each rule identifies common suffix patterns and applies conditions to decide whether to
remove or replace them.
• The algorithm processes the word from end to start, chopping off suffixes like -ing, -ed, -es, -
tion, etc.
Example:
• caresses ➜ caress
• caressed ➜ caress
• meeting ➜ meet
Example:
• relational ➜ relate
• conditional ➜ condition
• rational ➜ rational
• valizer ➜ valize
Example:
• electrical ➜ electric
• hopefulness ➜ hope
• goodness ➜ good
Example:
• agreement ➜ agree
• replacement ➜ replace
Example:
• probate ➜ probat
• cease ➜ ceas
Example Walkthrough:
Word: "Caresses"
Word: "Relational"
1. Information Retrieval
Feature Details
Limitations Over-stemming/Under-stemming
Let me know if you want to see Porter Stemmer pseudocode or an implementation example in
Python!