NLP END SEM QUESTION BANK
UNIT NO: 5
Q. No Question Marks
1 What is Textual Entailment in NLP? Apply it on question answering application and simplify its 6
working with suitable examples.
ANS Textual Entailment:
Textual entailment is a simple exercise in logic that attempts to discern whether one sentence
can be inferred from another.
A computer program that takes on the task of textual entailment attempts to categorize an
ordered pair of sentences into one of three categories.
The first category, called “positive entailment,” occurs when you can use the first sentence
to prove that a second sentence is true.
The second category, “negative entailment,” is the inverse of positive entailment.
This occurs when the first sentence can be used to disprove the second sentence.
Finally, if the two sentences have no correlation, they are considered to have a “neutral
entailment.”
Objective: Determine the relationship between a premise (P) and a hypothesis (H) from
three categories:
o Entailment: P guarantees H
o Contradiction: P refutes H
o Neutral: P neither confirms nor refutes H
Significance:
o Essential for NLP tasks like question answering (validating answers), information
retrieval (ensuring document relevance), information extraction (consistency checks),
and machine translation evaluation (maintaining semantic accuracy).
o Textual entailment, often referred to as natural language inference (NLI), is a
fundamental task in natural language processing that involves determining the
relationship between two pieces of text, a premise, and a hypothesis.
o The task is to decide whether the hypothesis is entailed (can be logically inferred),
contradicted, or is neutral with respect to the premise.
Example:
NLP END SEM QUESTION BANK
Importance:
1) Question Answering: To verify if the answer obtained from a source truly addresses the
posed question.
2) Information Retrieval: To ensure the retrieved documents are relevant to the search query.
3) Information Extraction: To verify if the extracted pieces of information are consistent with
the source content.
4) Machine Translation Evaluation: To determine if the translated content retains the
meaning of the original.
Approaches:
1) Feature-basedModels:
Utilize hand-crafted features: lexical overlaps, syntactic structures (parse tree
comparisons), and semantic alignments (wordnet-based similarity).
Employ techniques like TF-IDF, cosine similarity, and semantic role labeling.
2) Deep Learning Models:
RNNs (LSTMs & GRUs): Sequential models capturing context in texts, e.g.,
decomposable attention model uses LSTM representations for alignment-based
entailment.
1) Transformers (e.g., BERT, RoBERTa):
2) Architecture: Multiple self-attention layers for capturing contextual information.
3) Pre-training: On large corpora with masked language modeling tasks.
4) Fine-tuning: On specific NLI datasets for optimal results. BERT, for instance, uses
[CLS] token’s representation for sentence pair classification after fine-tuning.
3) Attention Mechanisms:
Weighting scheme allowing models to focus on relevant parts of the text.
Especially efficient in transformers where self-attention enables understanding intra-
textual relationships and dependencies.
Applying Textual Entailment to Question Answering (QA):
NLP END SEM QUESTION BANK
In a QA system, textual entailment can determine if a proposed answer satisfies a given
question.
How it works:
Input Question and Candidate Answer: The system generates or retrieves potential answers
for a question.
Formulate Hypotheses: Combine the question and each candidate answer to create a
hypothesis.
Example:
o Question: "Who is the president of the United States in 2024?"Candidate Answer: "Joe
Biden."
o Hypothesis: "Joe Biden is the president of the United States in 2024."
o Check Entailment: Compare the hypothesis against background knowledge or retrieved
supporting information (premises).
o Output Answer: If the hypothesis is entailed by the premise, the answer is considered
valid.
Example:
o Question: "Did Albert Einstein develop the theory of relativity?"
o Candidate Answer: "Albert Einstein developed the theory of relativity."
o Premise: "Albert Einstein is a renowned physicist who developed the theory of
relativity."
o Hypothesis: "The theory of relativity was developed by Albert Einstein."
o Entailment Analysis: Compare the hypothesis to the premise using a textual entailment
model.
o Result: Entailment (the hypothesis logically follows the premise).
o Outcome: The system confirms the answer as correct.
2 Write a short note on “Importance of Sentiment Analysis.” 6
ANS Sentiment Analysis:
Sentiment analysis is the process of classifying whether a block of text is positive, negative,
or neutral.
The goal that Sentiment mining tries to gain is to be analyzed people’s opinions in a way
that can help businesses expand.
It focuses not only on polarity (positive, negative & neutral) but also on emotions (happy,
sad, angry, etc.).
It uses various Natural Language Processing algorithms such as Rule-based, Automatic, and
Hybrid.
Importance of Sentiment Analysis:
1) Business intelligence and Market research:
Companies invest significant resources in understanding their customers' sentiments.
By analyzing social media posts, reviews, and customer feedback, businesses gain
insights into how their products or services are perceived.
Example: A leading smartphone manufacturer discovers that negative sentiment around
battery life is affecting sales. Armed with this information, they can improve battery
performance or adjust marketing strategies.
2) Reputation management:
Sentiment analysis helps monitor brand perception. Brands can track sentiment trends
over time and respond proactively to negative sentiment spikes.
Example: A hotel chain notices a surge in negative reviews related to cleanliness. They
promptly address the issue, leading to improved customer satisfaction.
NLP END SEM QUESTION BANK
3) Customer Service Enhancement:
Sentiment analysis aids in identifying customer pain points.
By analyzing support tickets, chat logs, and call transcripts, companies can prioritize
areas for improvement.
Example: An e-commerce platform identifies common complaints about delayed
deliveries. They optimize logistics to enhance customer experience.
4) Financial Markets and Trading:
Sentiment analysis extends beyond customer opinions.
It's also used in financial markets to gauge investor sentiment.
News sentiment analysis can impact stock prices.
Example: A hedge fund uses sentiment analysis on news articles to predict market
movements. Positive sentiment around a company's earnings report may lead to stock
price gains.
5) Political Campaigns and Public Opinion:
Sentiment analysis plays a crucial role in political campaigns.
Candidates can assess public sentiment and tailor their messaging accordingly.
Example: During an election, sentiment analysis reveals that voters respond positively
to messages emphasizing job creation. A candidate adjusts their campaign speeches
accordingly.
6) Healthcare and Patient Feedback:
Sentiment analysis isn't limited to business.
In healthcare, it helps hospitals understand patient experiences and improve services.
Example: A hospital analyzes patient reviews to identify areas where communication
can be enhanced between doctors and patients.
7) Content Creation and marketing:
Content creators use sentiment analysis to fine-tune their messaging.
Understanding audience sentiment ensures content resonates.
Example: A travel blogger notices positive sentiment around adventure travel. They
create more content on this topic, attracting engaged readers.
3 What is Information Retrieval in NLP? Explain Cross Lingual Information Retrieval (CLIR) in 6
Brief.
ANS Information Retrieval:
Information retrieval (IR) may be defined as a software program that deals with the
organization, storage, retrieval and evaluation of information from document repositories
particularly textual information.
The system assists users in finding the information they require but it does not explicitly
return the answers of the questions.
It informs the existence and location of documents that might consist of the required
information.
The documents that satisfy user’s requirement are called relevant documents.
A perfect IR system will retrieve only relevant documents.
NLP END SEM QUESTION BANK
It is clear from the above diagram that a user who needs information will have to formulate
a request in the form of query in natural language.
Then the IR system will respond by retrieving the relevant output, in the form of documents,
about the required information.
4 Explain the Process and importance of Sentiment analysis. 6
ANS Process of Sentiment Analysis:
1) Data Collection: Gather textual data from sources like social media, customer reviews,
surveys, or forums.
2) Text Pre-processing:
Tokenization: Break the text into words or sentences
Stop-word Removal: Remove common words (e.g., "the", "is", "at") that do not add
much meaning.
Stemming/Lemmatization: Reduce words to their root forms (e.g., "running"
becomes "run")
Normalization: Convert text to lowercase and remove punctuation, numbers, etc
3) Feature Extraction: Extract meaningful features such as word frequency or word
embeddings (which capture the meaning of words in context).
4) Sentiment Classification:
Lexicon-based approach: Uses predefined dictionaries or lists of words with
associated sentiment scores.
Machine Learning-based approach: Trains models (e.g., Naive Bayes, SVM,
LSTM) to classify text into categories (positive, negative, neutral) based on labeled
data.
Deep Learning-based approach: Uses neural networks to analyze large volumes of
text and recognize patterns that signify sentiment.
5) Post-processing and Analysis: Review the results to classify overall sentiment. It may
include visualizing sentiment trends or aggregating sentiment scores.
Importance of Sentiment Analysis:
1) Business intelligence and Market research:
NLP END SEM QUESTION BANK
Companies invest significant resources in understanding their customers' sentiments.
By analyzing social media posts, reviews, and customer feedback, businesses gain
insights into how their products or services are perceived.
Example: A leading smartphone manufacturer discovers that negative sentiment around
battery life is affecting sales. Armed with this information, they can improve battery
performance or adjust marketing strategies.
2) Reputation management:
Sentiment analysis helps monitor brand perception. Brands can track sentiment trends
over time and respond proactively to negative sentiment spikes.
Example: A hotel chain notices a surge in negative reviews related to cleanliness. They
promptly address the issue, leading to improved customer satisfaction.
3) Customer Service Enhancement:
Sentiment analysis aids in identifying customer pain points.
By analyzing support tickets, chat logs, and call transcripts, companies can prioritize
areas for improvement.
Example: An e-commerce platform identifies common complaints about delayed
deliveries. They optimize logistics to enhance customer experience.
4) Financial Markets and Trading:
Sentiment analysis extends beyond customer opinions.
It's also used in financial markets to gauge investor sentiment.
News sentiment analysis can impact stock prices.
Example: A hedge fund uses sentiment analysis on news articles to predict market
movements. Positive sentiment around a company's earnings report may lead to stock
price gains.
5) Political Campaigns and Public Opinion:
Sentiment analysis plays a crucial role in political campaigns.
Candidates can assess public sentiment and tailor their messaging accordingly.
Example: During an election, sentiment analysis reveals that voters respond positively
to messages emphasizing job creation. A candidate adjusts their campaign speeches
accordingly.
6) Healthcare and Patient Feedback:
Sentiment analysis isn't limited to business.
In healthcare, it helps hospitals understand patient experiences and improve services.
Example: A hospital analyzes patient reviews to identify areas where communication
can be enhanced between doctors and patients.
7) Content Creation and marketing:
Content creators use sentiment analysis to fine-tune their messaging.
Understanding audience sentiment ensures content resonates.
Example: A travel blogger notices positive sentiment around adventure travel. They
create more content on this topic, attracting engaged readers.
5 Explain the Architecture of an Information Retrieval System with a neat Diagram. 6
ANS
6 Write a short note on Sentiment analysis. 6
ANS Sentiment Analysis:
Sentiment analysis is a popular task in natural language processing.
The goal of sentiment analysis is to classify the text based on the mood or mentality
expressed in the text, which can be positive negative, or neutral.
NLP END SEM QUESTION BANK
Sentiment analysis is the process of classifying whether a block of text is positive, negative,
or neutral.
The goal that Sentiment mining tries to gain is to be analyzed people’s opinions in a way
that can help businesses expand.
It focuses not only on polarity (positive, negative & neutral) but also on emotions (happy,
sad, angry, etc.).
It uses various Natural Language Processing algorithms such as Rule-based, Automatic, and
Hybrid.
Consider a scenario, if we want to analyze whether a product is satisfying customer
requirements, or is there a need for this product in the market.
We can use sentiment analysis to monitor that product’s reviews.
Sentiment analysis is also efficient to use when there is a large set of unstructured data, and
we want to classify that data by automatically tagging it.
Net Promoter Score (NPS) surveys are used extensively to gain knowledge of how a
customer perceives a product or service.
Sentiment analysis also gained popularity due to its feature to process large volumes of NPS
responses and obtain consistent results quickly.
Key reasons why sentiment analysis is important for business:
1) Customer Feedback Analysis: Businesses can analyze customer reviews, comments, and
feedback to understand the sentiment behind them helping in identifying areas for
improvement and addressing customer concerns, ultimately enhancing customer
satisfaction.
2) Brand Reputation Management:
Sentiment analysis allows businesses to monitor their brand reputation in real-time.
By tracking mentions and sentiments on social media, review platforms, and other
online channels, companies can respond promptly to both positive and negative
sentiments, mitigating potential damage to their brand.
3) Product Development and Innovation:
Understanding customer sentiment helps identify features and aspects of their products
or services that are well-received or need improvement.
This information is invaluable for product development and innovation, enabling
companies to align their offerings with customer preferences.
4) Competitor Analysis:
Sentiment Analysis can be used to compare the sentiment around a company’s products
or services with those of competitors.
Businesses identify their strengths and weaknesses relative to competitors, allowing
for strategic decision-making.
NLP END SEM QUESTION BANK
5) Marketing Campaign Effectiveness:
Businesses can evaluate the success of their marketing campaigns by analyzing the
sentiment of online discussions and social media mentions.
Positive sentiment indicates that the campaign is resonating with the target audience,
while negative sentiment may signal the need for adjustments.
Types of Sentiment Analysis:
1) Fine-Grained Sentiment Analysis:
This depends on the polarity base.
This category can be designed as very positive, positive, neutral, negative, or very
negative.
The rating is done on a scale of 1 to 5.
If the rating is 5 then it is very positive, 2 then negative, and 3 then neutral.
2) Emotion detection:
The sentiments happy, sad, angry, upset, jolly, pleasant, and so on come under emotion
detection.
It is also known as a lexicon method of sentiment analysis.
3) Aspect-Based Sentiment Analysis: It focuses on a particular aspect for instance if a
person wants to check the feature of the cell phone then it checks the aspect such as the
battery, screen, and camera quality then aspect based is used.
4) Multilingual Sentiment Analysis:
Multilingual consists of different languages where the classification needs to be done
as positive, negative, and neutral.
This is highly challenging and comparatively difficult.
How does Sentiment Analysis work?
1) Preprocessing:
Starting with collecting the text data that needs to be analyzed for sentiment like
customer reviews, social media posts, news articles, or any other form of textual
content.
The collected text is pre-processed to clean and standardize the data with various tasks:
Removing irrelevant information (e.g., HTML tags, special characters).
Tokenization: Breaking the text into individual words or tokens.
Removing stop words (common words like “and,” “the,” etc. that don’t contribute
much to sentiment).
Stemming or Lemmatization: Reducing words to their root form.
2) Analysis:
Text is converted for analysis using techniques like bag-of-words or word embeddings
(e.g., Word2Vec, GloVe).
Models are then trained with labeled datasets, associating text with sentiments
(positive, negative, or neutral).
After training and validation, the model predicts sentiment on new data, assigning
labels based on learned patterns.
Approaches to Sentiment Analysis:
1) Rule-based:
The lexicon method, tokenization, and parsing come in the rule-based.
The approach is that counts the number of positive and negative words in the given
dataset.
NLP END SEM QUESTION BANK
If the number of positive words is greater than the number of negative words then the
sentiment is positive else vice-versa.
2) Machine Learning:
This approach works on the machine learning technique.
Firstly, the datasets are trained and predictive analysis is done.
The next process is the extraction of words from the text is done.
This text extraction can be done using different techniques such as Naive Bayes,
Support Vector machines, hidden Markov model, and conditional random fields like
this machine learning techniques are used.
3) Neural Network:
In the last few years neural networks have evolved at a very rate.
It involves using artificial neural networks, which are inspired by the structure of the
human brain, to classify text into positive, negative, or neutral sentiments.
It has Recurrent neural networks, long short-term memory, gated recurrent unit, etc to
process sequential data like text.
4) Hybrid Approach:
It is the combination of two or more approaches i.e. rule-based and Machine Learning
approaches.
The surplus is that the accuracy is high compared to the other two approaches.
Application of Sentiment Analysis:
1) Brand Monitoring: Sentiment analysis can help businesses to monitor their brand
reputation by analyzing customer feedback on social media platforms.
2) Product Development: By analyzing customer feedback on existing products, businesses
can identify areas of improvement and develop new products that meet customer needs.
3) Market Research: Sentiment analysis can help businesses to understand market trends
and consumer preferences by analyzing customer feedback on social media platforms.
4) Fraud Detection: Sentiment analysis can be used to detect fraudulent activities by
analyzing customer feedback and identifying suspicious patterns.
5) Customer Segmentation: By analyzing customer feedback, businesses can segment their
customers based on their sentiments towards specific products or services and tailor their
marketing campaigns accordingly.
7 Explain in Detail about Transformers and Pre-trained Language Model. 6
ANS