NLP module -6
Applications for 5 marks if asked
1. Machine Translation (MT)
Answer:
1. Machine Translation (MT) is defined as the process of using computer
software to automatically translate text or speech from one language, known
as the source language, into another, called the target language.
2. MT systems utilize various algorithms to convert sentences while attempting
to preserve their original meaning.
3. The process can occur with or without human intervention, though human
input is sometimes required to ensure high-quality output.
4. There are three main categories of MT: Rule-Based (RBMT), which uses
linguistic rules and dictionaries; Statistical (SMT), which learns patterns
from a large corpus; and Neural (NMT), which uses deep learning.
5. The standard workflow includes Preprocessing (tokenization), Text Analysis
(syntax parsing), Translation, and Post-Processing (grammar checks). (Refer
Diagram on Page No. 4 and 19).
Example:
Source Text: "The boy is playing in the park."
Target Language: Marathi
MT Output: "मुलगा उद्यानात खेळत आहे".
Shortcut Trick: Remember "RSN" (Rule-based, Statistical, Neural) for categories and "S-
to-T" (Source to Target) for the definition.
2. Information Retrieval (IR)
Answer:
1. Information Retrieval (IR) is the process of obtaining relevant information from
a large collection of data based on specific user queries.
2. The primary goal of an IR system is to identify items—typically from
databases, document collections, or the internet—that match the information
needs of the user.
3. In this system, the user enters a query (word or phrase), and the system
responds by returning relevant documents that satisfy the requirement.
4. The system consists of key components: Document Collection (the
repository), Indexing (a roadmap for locating terms), Query Processing
(understanding intent), and Ranking (measuring closeness to search terms).
5. IR systems can be Monolingual, Bilingual (CLIR), or Multilingual (MLIR)
depending on the languages involved. (Refer Diagram on Page No. 23 and
26).
Example: A user searches for "climate change" in an academic journal database. The system
processes this and returns a ranked list of articles or books containing that term.
Shortcut Trick: Remember "D-I-Q-R" (Document, Index, Query, Retrieval).
3. Question Answering (QA) System
Answer:
1. A Question Answering (QA) system is designed to provide precise, explicit,
and concise responses to user queries articulated in natural language.
2. Unlike traditional IR systems that return a list of documents, QA systems focus
on delivering the exact answer directly derived from large databases or
knowledge sources.
3. The system generally consists of three functional parts: Question
Processing, Answer Retrieval, and Answer Generation.
4. There are two main domains: Closed-domain (specific subjects like medical
systems) and Open-domain (general topics like search engine results).
5. Modern QA systems can be IR-Based, Knowledge-Based (querying structured
databases), or LLM-Based (using models like GPT or BERT).
Example:
Factoid Question: "What is the capital of Japan?"
Answer: "Tokyo".
Shortcut Trick: Remember "P-R-G" (Process, Retrieve, Generate) and focus on the
keyword "Precise Answer."
4. Summarization
Answer:
1. Summarization is the task of reducing the size of a document while ensuring
its original meaning remains unchanged.
2. It involves creating a concise and fluent summary that outlines the major
points of a longer text document.
3. A high-quality summary must be coherent, non-redundant, and
grammatically readable.
4. There are two primary methods based on output type:
o Extractive Summarization: This involves pulling key phrases and
sentences directly from the source text and combining them without
changes.
o Abstractive Summarization: This generates new sentences that
capture the essence of the text by understanding the content,
mimicking how humans summarize. (Refer Diagram on Page No. 102).
Example:
Source Text: "Joseph and Mary rode on a tesla... Mary got job in Google."
Abstractive Summary: "Joseph and Mary came to New York where she got
job as ML developer in Google".
Shortcut Trick: Remember "Copy vs. Create" (Extractive copies sentences; Abstractive
creates new ones).
5. Sentiment Analysis (SA)
Answer:
1. Sentiment Analysis is an NLP task that identifies the orientation of opinions,
feelings, and attitudes expressed in a piece of text regarding a specific topic.
2. Its target is to find opinions and then classify their polarity—identifying them
as positive, negative, or neutral.
3. These systems typically extract three main attributes: the Polarity of the
opinion, the Subject (what is being discussed), and the Opinion holder (the
person expressing the view).
4. Classification can occur at different levels: Document-level (whole text),
Sentence-level (individual sentences), or Aspect-level (specific features
like battery life).
5. Techniques range from Rule-based (using lexicons) to Automated systems
using machine learning algorithms.
Example:
Standard Analysis: "Zapier is sooooo confusing to me" ➔ Negative.
Emotion Detection: "Hubspot makes my day a lot easier :)" ➔ Happiness.
Shortcut Trick: Remember "P-S-O" (Polarity, Subject, Opinion holder) to identify the core
components of any sentiment.
For 10 marks question refer the diagram’s from 5 marks questions
Q1. Explain the concept of Machine Translation (MT) with its categories and process.
(10 Marks)
Answer:
1. Machine Translation (MT) is the automated process of using computer
software to translate text or speech from a source language into a target
language while attempting to preserve the original meaning.
2. MT systems function by analyzing the source language and outputting the
most accurate equivalent in the target language, often requiring little to no
human assistance.
3. There are three primary categories of MT: Rule-Based (RBMT), which relies
on predefined linguistic rules and dictionaries; Statistical (SMT), which
learns patterns from large parallel corpora; and Neural (NMT), a modern
approach using deep learning and neural networks.
4. The standard workflow of an MT system involves: Preprocessing
(tokenization and tagging), Text Analysis (syntax parsing), Translation (the
core engine), Post-Processing (grammar and punctuation checks), and
Fluency Fixes.
5. RBMT specifically follows an Analysis Phase to process the source language,
a Transfer Phase to map language rules, and a Generation Phase to
produce target language output.
6. SMT operates by collecting a massive parallel corpus and training statistical
models to determine the highest probabilities for word and phrase
alignments.
7. NMT models, typically based on sequence-to-sequence architecture, process
entire sentences through artificial neural network layers to capture deeper
context and syntax.
8. Despite advancements, MT faces challenges such as lexical ambiguity, drastic
syntax differences (e.g., English to Japanese), and cultural nuances.
9. Gendered nouns, verb tenses, and resource scarcity for low-resource
languages also remain significant hurdles for accuracy.
10. Popular tools implementing these techniques include Google Translate,
DeepL, and Microsoft Translator. (Refer Proposed Block Diagram on Page No.
19).
Example: Converting "The boy is playing in the park" (Source) to "मुलगा उद्यानात
खेळत आहे" (Marathi Target) involves tokenizing the words and rearranging the English
SVO structure to the Marathi SOV structure.
Shortcut Trick: Remember "C-P-C" (Categories: RSN, Process: Pre-Analysis-Post,
Challenges: Ambiguity & Syntax).
Q2. Elaborate on Information Retrieval (IR), its components, and its variants. (10
Marks)
Answer:
1. Information Retrieval (IR) is the systematic process of obtaining relevant
information from a vast collection of data, such as databases or the internet,
to satisfy a user’s query.
2. The primary goal is to search and organize data so that the "relevant
documents"—those matching the user's specific information needs—are
identified and retrieved.
3. An IR system consists of several core components: Document Collection
(the repository), Indexing (the "map" for locating terms), Query Processing
(analyzing user intent), and Ranking (measuring closeness to search terms).
4. Additionally, it includes a User Interface for interaction and a
Feedback/Refinement loop where user actions help improve future search
algorithms.
5. IR systems are categorized into types like Text Retrieval, Multimedia
Retrieval (images/video), Web Search, and Database Retrieval.
6. Variants of IR include Monolingual IR, where the query and documents are
in the same language.
7. Bilingual/Cross-Lingual IR (CLIR) allows users to query in one language
(e.g., English) and retrieve documents in another (e.g., Spanish) by using
machine translation or bilingual dictionaries.
8. Multilingual IR (MLIR) is the most complex, dealing with queries and
document collections that span multiple different languages simultaneously.
9. CLIR specifically uses two approaches: Query Translation (translating the
search term) or Document Translation (translating the entire collection).
10. Modern IR uses ranking algorithms like TF-IDF and BM25 and is supported by
distributed systems like Hadoop or Spark. (Refer IR Cycle on Page No. 26).
Example: A search for "climate change" in an academic database results in a ranked list of
articles and research papers containing that term, sorted by relevance.
Shortcut Trick: Remember "D-I-Q-R" (Document, Index, Query, Ranking).
Q3. Describe the architecture and functional stages of a Question Answering (QA)
System. (10 Marks)
Answer:
1. A Question Answering (QA) system is an advanced NLP application designed
to provide precise, explicit, and concise answers to natural language queries.
2. Unlike IR systems that provide a list of documents, QA systems focus on direct
fact extraction from large databases or knowledge sources.
3. The functional architecture consists of three main stages: Question
Processing, Answer Retrieval, and Answer Generation.
4. Question Processing involves classifying the question (Who, What, Where),
identifying named entities (NER), and syntactic parsing to understand the
grammatical structure.
5. Answer Retrieval matches the processed query against a document corpus
or structured knowledge base to find relevant text fragments or snippets.
6. Answer Generation is the final stage where the system either performs
Extractive QA (copying the exact text span) or Abstractive QA
(synthesizing a new response using models like GPT).
7. QA systems are categorized into Closed-domain (specific subjects like
medicine) and Open-domain (any general topic).
8. Common question types handled include Factoid (dates/names),
Descriptive (processes), Yes/No, List, and Complex (How/Why).
9. Systems can be IR-Based (finding snippets in text), Knowledge-Based
(querying structured graphs like Wikidata), or LLM-Based (using pre-trained
transformers).
10. The complexity of QA is higher than IR because it requires deeper semantic
understanding and contextual reasoning rather than just keyword matching.
(Refer Comparison Table on Page No. 48).
Example: A user asks, "When did Beyonce start becoming popular?" The system processes
the "When" intent, retrieves the text, and extracts the exact answer: "in the late 1990s".
Shortcut Trick: Remember "P-R-G" (Process question, Retrieve data, Generate answer).
Q4. Explain the methods and importance of Text Summarization. (10 Marks)
Answer:
1. Text Summarization is the process of reducing a document's size while
preserving its original information content and core meaning.
2. The objective is to produce a concise, fluent, and non-redundant summary
that is grammatically readable for the user.
3. This application is crucial in the era of "information overload," helping users
save time in fields like news, legal documentation, and healthcare.
4. Summarization methods are broadly classified based on output type into
Extractive and Abstractive.
5. Extractive Summarization involves selecting and pulling keyphrases or
sentences directly from the source text and combining them to form a
summary without changing the wording.
6. Extractive techniques often use statistical approaches (word frequency),
graph-based methods, or machine learning to identify the most important
sentences.
7. Abstractive Summarization is more advanced; it involves understanding
the content and generating entirely new sentences that capture the essence
of the original text.
8. Abstractive models mimic human behavior by paraphrasing and shortening
the source material, often using Seq2Seq models, Attention mechanisms, and
Transformers.
9. Challenges in summarization include maintaining coherence and flow,
avoiding redundancy, and handling new information accurately.
10. Modern case studies for languages like Hindi or Marathi often utilize the BART
architecture to generate coherent abstractive summaries. (Refer Output
Type Diagram on Page No. 102).
Example:
Source: "Joseph and Mary rode on a tesla... Mary got job in Google."
Abstractive Summary: "Joseph and Mary came to New York where she got
job as ML developer in Google".
Shortcut Trick: Remember "Extract vs. Abstract" (Select sentences vs. Synthesize new
ones).
--------------------------------------------------------------------------------
Q5. Discuss Sentiment Analysis (SA) including its types, levels, and challenges. (10
Marks)
Answer:
1. Sentiment Analysis (SA) is an NLP task that identifies and classifies the
emotions, feelings, and attitudes expressed in text toward a specific topic.
2. The primary target of SA is to find opinions and classify their polarity as
positive, negative, or neutral.
3. A complete SA system extracts three main attributes: Polarity, the Subject
being discussed, and the Opinion Holder expressing the sentiment.
4. There are several Types of SA:
o Standard SA: Basic positive/negative classification.
o Fine-grained SA: Multi-level scales (Very Positive to Very Negative).
o Aspect-based SA: Focuses on specific features (e.g., "battery life" of
a camera).
o Emotion Detection: Identifying specific states like Happiness or
Anger.
o Intent/Sarcasm Detection: Finding the action behind the words or
identifying when the literal meaning is the opposite of the intent.
5. SA can be performed at three Levels: Document-level (whole text),
Sentence-level (individual units), and Aspect-level (specific entity
features).
6. Classification Techniques include Rule-based systems (using
lexicons/dictionaries) and Automatic systems (using Machine Learning/Deep
Learning).
7. Rule-based systems count positive/negative words and apply negation rules
(e.g., "not easy") to calculate a score from -100 to 100.
8. Automatic systems involve Feature Extraction (Vectorization via Bag of
Words or Word2Vec) and model training using algorithms like Naive Bayes or
SVM.
9. Major Challenges include Subjectivity (objective vs. subjective), Context
(words changing polarity), and the difficulty of detecting Sarcasm, Irony, and
Idioms.
10. Emojis and complex negations (e.g., "can't not buy") also present significant
hurdles for model accuracy. (Refer General Architecture on Page No. 96).
Example: "Zapier is sooooo confusing to me" is classified as Negative, while "Hubspot
makes my day a lot easier :)" is classified as Happiness/Positive.
Shortcut Trick: Remember "P-S-O" (Polarity, Subject, Opinion Holder) and "D-S-A"
(Document, Sentence, Aspect levels).
Comparison Table: IR vs. QA Systems
Aspect Information Retrieval (IR) Question Answering (QA)
ObjectiveTo retrieve a ranked list of To provide a specific, concise answer
relevant documents or resources that directly addresses the query.
based on a query.
Response A list of documents, snippets, or A direct answer or fact, typically a
Type passages that may contain the single sentence or short phrase.
answer.
Search Matches keywords, phrases, or Requires deeper semantic
Approach concepts in documents to query understanding and may involve
terms. reasoning over text.
Data Focuses on indexing large corpora Involves extracting specific
Handling of documents for fast retrieval. information or facts from the text
using NLP models.
Complexit Primarily involves ranking Requires Natural Language
y algorithms (e.g., TF-IDF, BM25) Understanding (NLU) and deep
and retrieval methods. learning to answer queries.
Interaction User must manually select User receives a direct and precise
relevant documents or sections answer without further browsing.
from a list.
Example (From the Sources)
IR System: A search for "climate change" returns a list of web pages and
articles related to the topic.
QA System: A query about the same topic returns a specific fact, such as:
"The current global temperature increase is 1.1°C since pre-industrial times".
Shortcut Trick to Remember: Think "List vs. Fact".
IR = Google Search Results (A List of links).
QA = Alexa/Siri (A direct Fact).
Use the keyword "D-I-Q-R" for IR (Document, Index, Query, Ranking) and "P-
R-G" for QA (Process, Retrieve, Generate)
Imp difference
Difference Between Top-Down and Bottom-Up Parsers
Poin Aspect Top-Down Parser Bottom-Up Parser
t
1 Parsing Root to Leaves (Start symbol to Leaves to Root (Input tokens to
Direction input tokens). start symbol).
2 Main Recursive Decomposition Reduction (Combining symbols).
Operation (Expanding goals).
3 Derivation Leftmost derivation. Rightmost derivation in reverse.
4 Strategy Predictive (Predicts structure first). Matching (Reduces input to
grammar rules).
5 Root Node Guarantees the tree starts with 'S' as Does not guarantee tree will lead
root. to 'S' root.
6 Input Does not guarantee tree will match Guarantees the tree matches input
Matching input words. words.
7 Left Recursion Struggles with left recursion (can Handles left recursion efficiently.
loop infinitely).
8 Complexity Generally simpler to implement. More complex to implement.
9 Memory Usage Less memory-intensive but can be Memory-intensive to store
inefficient. intermediate results.
10 Examples Recursive Descent and LL parsers. Shift-Reduce, LR, and SLR
parsers
Question: Explain Top-Down Parser with its subtypes and a suitable example. (10
Marks)
Answer:
1. Definition: A top-down parser is a type of syntax analyzer that starts parsing
from the root (start symbol) of the parse tree and works its way down to
the leaves, which represent the actual input words or tokens.
2. Goal-Oriented Approach: It interprets the grammar as a specification of
how to break a high-level goal (usually the sentence 'S') into several lower-
level subgoals recursively until terminal symbols are reached.
3. Key Characteristics: The process is primarily predictive and uses
recursive decomposition. It predicts which production rules to apply based
on the current non-terminal symbol.
4. Starting Symbol: The parser always begins with the highest level of the
syntax tree, typically denoted as 'S' for sentence.
5. Expansion Process: Based on the current non-terminal, the parser selects
an appropriate production rule from the grammar to expand the tree
downwards.
6. Matching Terminals: When a non-terminal is expanded into a terminal (an
actual word), the parser checks if the input sequence matches the expected
word from the grammar.
7. Backtracking: If a chosen path does not lead to a valid parse, the parser
"backs up" or backtracks to try a different alternative production rule for the
same non-terminal.
8. Derivation Type: Top-down parsing specifically utilizes leftmost
derivation, expanding the non-terminals from the start symbol in a left-to-
right fashion.
9. Subtype 1 - Recursive Descent Parsing: A simple top-down parser that
interprets grammar as a set of subgoals and builds the tree downward using
recursion and backtracking.
10. Subtype 2 - LL Parsers: A common example of top-down parsers often used
in compilers that face challenges with left recursion, which can lead to infinite
loops.
Example: For the sentence "The cat sleeps" with grammar S→NP VP, NP→Det N,
and VP→V:
1. Start with S.
2. Expand NP into Det ("The") and N ("cat").
3. Expand VP into V ("sleeps"). The parser successfully matches each terminal
word from the top-down.
Reference: (Refer to the Characteristics on Page No. 98 and the Comparison Table on Page
No. 126).
--------------------------------------------------------------------------------
Shortcut Trick: Remember "R-S-P-B"
R: Root to Leaves.
S: Start symbol ('S') first.
P: Predictive nature.
B: Backtracking if match fails.
Question: Explain the concept of Bottom-Up Parser with its working, subtypes, and an
example. (10 Marks)
Answer:
1. Definition: A bottom-up parser is a type of syntax analyzer that works in the
exact opposite direction of a top-down parser. It starts with the individual
words (terminal symbols) of the input sentence and attempts to build the
parse tree upwards toward the start symbol (root).
2. Core Objective: The primary goal of this parser is to "reduce" the input
tokens into higher-level non-terminals (such as noun phrases or verb phrases)
by gradually constructing the full hierarchical structure of the sentence.
3. The Reduction Process: At each step, the parser looks for adjacent symbols
or subsequences that match the right-hand side (RHS) of a grammar
production rule. When a match is found, it replaces that sequence with the
non-terminal on the left-hand side (LHS) of the rule.
4. Parsing Direction and Derivation: Bottom-up parsing reads the input
tokens and works upwards toward the root. It specifically utilizes rightmost
derivation in reverse to reduce the input to the start symbol.
5. Working Steps:
o Step 1: The process begins with the input symbols (words), which are
treated as terminal symbols.
o Step 2: The parser identifies possible reductions by matching
subsequences to grammar rules.
o Step 3: It applies the reduction, replacing the terminal sequence with
the corresponding non-terminal.
o Step 4: This continue until the entire input is reduced to the start
symbol 'S'.
6. Subtype 1 - Shift-Reduce Parser: This is a common bottom-up parser
using two main operations: Shift (moving the next token onto a stack) and
Reduce (applying grammar rules to stack items to form non-terminals).
7. Subtype 2 - LR Parsers: These are sophisticated shift-reduce parsers that
read input from left to right and construct the rightmost derivation in reverse.
They are commonly used in programming language compilers.
8. Advantages: They are generally more efficient for certain grammars and
handle left recursion effectively without falling into infinite loops. They also
manage syntactic ambiguities more gracefully than top-down methods.
9. Disadvantages: These parsers are typically more complex to implement and
can be memory-intensive because they must store intermediate results and
multiple potential valid structures.
10. Termination: The process is successful only if the entire input is reduced to
the single start symbol 'S', forming a complete parse tree without dangling
edges.
Example: For the sentence "The cat sleeps" with the grammar:
Det→"The", N→"cat", V→"sleeps".
NP→Det N, VP→V, S→NP VP.
"The" is reduced to Det.
"cat" is reduced to N.
"Det N" is reduced to NP.
"sleeps" is reduced to V (and then to VP).
"NP VP" is reduced to S. SUCCESS!
Reference: (Refer to the Step-by-Step Bottom-Up Parsing on Page No. 106 and the
Comparison Table on Page No. 120).
--------------------------------------------------------------------------------
Shortcut Trick to Remember: Think of "L-R-R-S"
L: Leaves to Root.
R: Reduction is the main action.
R: Rightmost derivation in reverse.
S: Shift-Reduce is the main subtype.