Unit 6 Endsem PYQs
Unit 6 Endsem PYQs
Answer:
1. Ambiguity:
Lexical Ambiguity: A single word having multiple meanings (e.g., "bank" - river bank
vs. financial bank).
Syntactic Ambiguity: A sentence having multiple grammatical interpretations (e.g.,
"I saw the man with the telescope" - who has the telescope?).
Semantic Ambiguity: The meaning of a phrase or sentence being unclear (e.g.,
"The city council refused the demonstrators a permit because they advocated
violence." - who advocated violence, the council or the demonstrators?).
Pragmatic Ambiguity: The meaning depends on context and speaker's intent (e.g.,
"Can you pass the salt?" - a request, not a question about ability).
Challenge: Disambiguating these multiple meanings requires deep contextual
understanding, often beyond what simple word definitions provide.
2. Contextual Understanding:
Challenge: The meaning of words and sentences heavily depends on the
surrounding text, the speaker, the listener, and the situation. NLP systems struggle to
grasp this broader context, especially for long documents or conversations.
Example: "I like this movie" followed by "It was so good, especially the ending." - "It"
refers to the movie, requiring anaphora resolution.
3. Variability and Imprecision:
Informal Language: Slang, jargon, misspellings, grammatical errors, and
abbreviations (common in social media, chat).
Figurative Language: Metaphors, similes, irony, sarcasm, humor. These are difficult
for machines to interpret literally.
Challenge: Training data often lacks sufficient examples of these variations, and
rules are hard to define.
4. Lack of Labeled Data:
Challenge: Many advanced NLP tasks require large, high-quality labeled datasets
for training machine learning models. Creating such datasets is expensive, time-
consuming, and requires human expertise. Unsupervised or semi-supervised
learning methods are still catching up.
5. Language Evolution:
Challenge: Language is dynamic; new words, phrases, and meanings emerge
constantly. NLP models need continuous updates to stay relevant.
6. Cultural and Linguistic Nuances:
Challenge: Different cultures express ideas differently. Idioms, proverbs, and cultural
references are highly language-specific and difficult to translate or interpret
universally.
Example: "It's raining cats and dogs" has no literal meaning.
7. Data Sparsity:
Challenge: Even in large corpora, many legitimate word combinations or linguistic
phenomena might appear rarely, making it hard for models to learn robust
representations.
8. Computational Complexity:
Challenge: Processing vast amounts of text data (especially with deep learning
models) requires significant computational resources and efficient algorithms.
Overcoming these challenges is an ongoing area of research and development in NLP, often
relying on advancements in deep learning, transfer learning, and larger datasets.
Answer:
While the questions focus on feature extraction, it's useful to place it in the context of the
overall NLP pipeline:
Feature extraction in NLP is the process of transforming raw textual data into a numerical
representation (vectors of numbers) that machine learning algorithms can understand and
process. Since algorithms cannot directly work with text, this step is fundamental. The choice
of technique depends on the task and the complexity of the data.
1. Bag-of-Words (BoW):
Concept: Represents a document as an unordered collection of words, disregarding
grammar and word order. It counts the frequency of each word's occurrence in a
document.
Process:
1. Create a vocabulary of all unique words from the entire corpus.
2. For each document, create a vector where each dimension corresponds to a
word in the vocabulary, and the value is the count of that word in the document.
Example:
Doc 1: "I love apples and oranges."
Doc 2: "I love fruits."
Vocabulary: {"I", "love", "apples", "and", "oranges", "fruits"}
Vector for Doc 1: [1, 1, 1, 1, 1, 0] (counts for "I", "love", "apples", "and",
"oranges", "fruits")
Vector for Doc 2: [1, 1, 0, 0, 0, 1]
Pros: Simple, easy to understand.
Cons: Ignores word order and context, vocabulary size can be very large (high
dimensionality), sparsity (many zeros in vectors).
2. TF-IDF (Term Frequency-Inverse Document Frequency):
Concept: A more sophisticated statistical measure than simple word count. It
evaluates how important a word is to a document in a corpus. It increases with the
number of times a word appears in the document but is offset by the frequency of the
word in the corpus.
Calculation:
Term Frequency (TF): How often a term appears in a document. $ \text{TF}(t,
d) = \frac{\text{Number of times term } t \text{ appears in document } d}
{\text{Total number of terms in document } d} $
Inverse Document Frequency (IDF): How rare or unique a term is across the
entire corpus. $ \text{IDF}(t, D) = \log\left(\frac{\text{Total number of documents }
N}{\text{Number of documents with term } t}\right) $
TF-IDF: $ \text{TFIDF}(t, d, D) = \text{TF}(t, d) \times \text{IDF}(t, D) $
Pros: Captures relative importance of words, reduces impact of common words (like
"the", "a").
Cons: Still doesn't capture semantics or word order.
3. N-grams:
Concept: Instead of single words (unigrams), N-grams are contiguous sequences of
N items (words or characters).
Example: For "I love apples":
Unigrams (1-gram): "I", "love", "apples"
Bigrams (2-gram): "I love", "love apples"
Trigrams (3-gram): "I love apples"
Pros: Captures some level of local context and word order.
Cons: Vocabulary size explodes rapidly with increasing N, leading to higher
dimensionality and sparsity.
4. Word Embeddings (Word Vectors):
Concept: Modern and powerful techniques that represent words as dense, low-
dimensional vectors in a continuous vector space. Words with similar meanings or
contexts are mapped to nearby points in this space.
Popular Models:
Word2Vec (Skip-gram, CBOW): Learns word embeddings by predicting
context from a word (Skip-gram) or predicting a word from its context (CBOW).
GloVe (Global Vectors for Word Representation): Learns embeddings based
on global co-occurrence statistics.
FastText: Extends Word2Vec by considering subword information (character n-
grams), useful for rare words and morphology.
Pros: Captures semantic relationships (e.g., "king" - "man" + "woman" ≈ "queen"),
handles synonyms better, much lower dimensionality than BoW/TF-IDF, dense
representations.
Cons: Can be computationally intensive to train from scratch on very large corpora.
5. Contextualized Word Embeddings (Deep Learning based):
Concept: These are the state-of-the-art. Unlike static word embeddings, they
generate word representations that change based on the word's context within a
sentence.
Popular Models:
ELMo (Embeddings from Language Models): Uses a bidirectional LSTM.
BERT (Bidirectional Encoder Representations from Transformers): A
transformer-based model that pre-trains on masked language modeling and
next sentence prediction tasks.
GPT (Generative Pre-trained Transformer): Transformer-based, primarily for
language generation.
Pros: Capture highly nuanced contextual meaning, achieve state-of-the-art
performance on many NLP tasks.
Cons: Very computationally expensive to train, require massive datasets, complex
models.
Process Diagram (General):
The evolution of NLP feature extraction has moved from simple frequency counts to
sophisticated neural network-based contextual representations, significantly improving the
performance of NLP applications.
Answer:
NLP is a vast field with numerous applications that permeate various aspects of our digital
lives and industries. Here are some key applications:
1. Machine Translation:
Explanation: Automatically translating text or speech from one natural language to
another (e.g., Google Translate). This involves understanding the source language,
converting it into an intermediate representation, and generating text in the target
language.
Example: Translating a website from English to French, or facilitating cross-lingual
communication in real-time.
2. Sentiment Analysis (Opinion Mining):
Explanation: Determining the emotional tone or polarity of text (positive, negative,
neutral). It analyzes opinions, emotions, and attitudes expressed in written content.
Example: Analyzing customer reviews to gauge product satisfaction, tracking public
opinion about a brand on social media, or understanding feedback from surveys.
(Detailed explanation below).
3. Chatbots and Virtual Assistants:
Explanation: Enabling human-like conversation with machines (e.g., Siri, Alexa,
customer service chatbots). These systems use NLP for understanding user queries
(Natural Language Understanding - NLU) and generating appropriate responses
(Natural Language Generation - NLG).
Example: A banking chatbot answering queries about account balances, or a virtual
assistant playing music upon voice command.
4. Text Summarization:
Explanation: Automatically generating a concise and coherent summary of a longer
text document while retaining its main points.
Example: Summarizing news articles, research papers, or legal documents to
quickly grasp the essence of the content.
5. Information Extraction:
Explanation: Automatically identifying and extracting structured information (e.g.,
entities, relationships, events) from unstructured text. This includes Named Entity
Recognition (NER), relationship extraction, etc.
Example: Extracting all company names, people, and locations from a news report,
or pulling specific data points from medical records.
6. Speech Recognition:
Explanation: Converting spoken language into written text (e.g., voice-to-text
features on phones). It involves acoustic modeling and language modeling.
Example: Dictating emails, transcribing meetings, or controlling devices with voice
commands.
7. Spam Detection:
Explanation: Classifying incoming emails as legitimate or spam based on the
linguistic patterns, keywords, and characteristics of the email content.
Example: Your email provider filtering out unwanted promotional messages or
phishing attempts.
8. Spell Checking and Grammar Correction:
Explanation: Identifying and correcting errors in written text. Advanced systems use
contextual analysis to suggest more appropriate corrections.
Example: Grammarly, Microsoft Word's spell checker.
9. Topic Modeling:
Explanation: Discovering abstract "topics" that occur in a collection of documents. It
identifies hidden thematic structures in text.
Example: Categorizing a large archive of customer feedback into prevalent topics
like "shipping issues," "product quality," "customer service."
1. Text Pre-processing: Clean the raw text by removing noise (HTML tags, special
characters), performing tokenization (splitting into words), lowercasing, and potentially
removing stop words or applying stemming/lemmatization.
2. Feature Extraction: Convert the cleaned text into numerical features. Common methods
include:
Lexicon-based: Using predefined dictionaries of words with associated sentiment
scores (e.g., positive words like "excellent," "amazing" and negative words like
"terrible," "horrible"). The overall sentiment of a text is calculated by aggregating the
scores of its words.
Machine Learning-based: Training a classification model (e.g., Logistic Regression,
Support Vector Machines, Naive Bayes) on labeled data where text examples are
pre-classified as positive, negative, or neutral. Features often involve Bag-of-Words,
TF-IDF, or word embeddings.
Deep Learning-based: Using neural networks (e.g., RNNs like LSTMs/GRUs, or
Transformer models like BERT) that can learn complex patterns and contextual
nuances directly from raw text or word embeddings. These models often achieve
higher accuracy.
3. Model Training/Application: The chosen model learns to map text features to
sentiment labels. Once trained, it can predict the sentiment of new, unseen text.
Imagine a large e-commerce company that receives millions of customer reviews for its
products daily. Manually reading and categorizing these reviews to understand customer
satisfaction and identify product strengths/weaknesses is impossible. This is where
Sentiment Analysis becomes invaluable.
Scenario: A company wants to understand customer sentiment about their newly launched
smartphone.
1. Data Collection: Gather all customer reviews from their website, social media, and
forums.
2. Sentiment Analysis Process:
Feed the collected text reviews into an NLP system equipped with a trained
sentiment analysis model.
The system processes each review and assigns a sentiment label (e.g., "Positive",
"Negative", "Neutral").
For advanced analysis, it might also extract aspects (e.g., "screen," "battery,"
"camera") and their associated sentiment.
3. Insights and Actions:
Overall Product Sentiment: Quickly see that 70% of reviews are positive, 15%
negative, and 15% neutral.
Identify Problem Areas: Discover that while overall sentiment is positive, a
significant portion of negative reviews specifically mention "battery life" or "slow
software updates." This indicates areas for product improvement.
Highlight Strengths: Notice that many positive reviews praise the "camera quality"
or "design." This information can be used in marketing campaigns.
Real-time Monitoring: Continuously monitor incoming reviews to detect sudden
shifts in sentiment, allowing for quick response to emerging issues or successful
features.
Sentiment analysis transforms unstructured text data into actionable business intelligence,
enabling data-driven decision-making.
May-Jun 2023 Q7 b) List and explain the applications of computer vision. [6]
May-Jun 2024 Q8 b) Explain the applications of computer vision. [6]
May-Jun 2023 Q8 c) Explain object detection application in Computer Vision. [4]
(Assuming this is the correct question based on context)
May-Jun 2024 Q7 b) What is object detection? Explain any one application where
in object detection is performed. [6]
Answer:
The general process of solving a computer vision problem involves several key steps:
1. Image Acquisition: Capturing raw images or video data from cameras, sensors, or
datasets.
2. Image Pre-processing: Cleaning and enhancing the raw image data to prepare it for
analysis.
Noise Reduction: Removing unwanted variations (e.g., Gaussian blur, median
filter).
Image Enhancement: Improving image quality (e.g., contrast adjustment,
sharpening).
Normalization: Scaling pixel values to a standard range.
Resizing/Cropping: Adjusting image dimensions.
3. Feature Extraction: Identifying and quantifying meaningful patterns or characteristics
from the images.
Traditional methods: Edges (Sobel, Canny), corners (Harris), blobs (LoG), SIFT,
HOG.
Deep Learning methods: Convolutional Neural Networks (CNNs) automatically learn
hierarchical features from raw pixels.
4. Applying Machine Learning Algorithms (Model Training): Using the extracted
features to train a model for a specific task.
For classification: SVMs, Random Forests, or fully connected layers of CNNs.
For detection/segmentation: Specialized deep learning architectures (e.g., R-CNN,
YOLO, U-Net).
5. Model Evaluation: Assessing the performance of the trained model using appropriate
metrics (e.g., accuracy, precision, recall, F1-score, IoU).
6. Application/Deployment: Integrating the trained model into real-world systems for
practical use.
Computer Vision is a field of artificial intelligence that enables computers to "see," interpret,
and understand the visual world. Its applications are vast and continue to grow, impacting
various industries:
Computer Vision Application: Object Detection (May-Jun 2023 Q8 c & May-Jun 2024
Q7 b)
Object Detection is a computer vision task that involves identifying and locating instances
of objects from a predefined set of classes (e.g., cars, pedestrians, traffic lights, animals)
within an image or video. It not only classifies what objects are present but also draws
bounding boxes around each detected object, indicating its precise location and size.
It's more complex than simple image classification (which classifies the entire image) or
object recognition (which might only identify if an object is present). Object detection
provides both "what" and "where" information.
How it Works (Simplified):
1. Sensors: Self-driving cars are equipped with multiple sensors (cameras, LiDAR, radar)
that continuously capture visual and spatial data about their surroundings.
2. Real-time Processing: The captured image/video data is fed into a high-performance
computer vision system.
3. Object Detection Model: An object detection model (e.g., based on YOLO or a custom
architecture optimized for automotive use) runs continuously to:
Identify Objects: Detect various classes of objects relevant to driving, such as:
Pedestrians: Crucial for safety, detecting people walking, crossing roads.
Other Vehicles: Cars, trucks, motorcycles, bicycles (to track their movement,
predict their behavior).
Traffic Signs: Stop signs, yield signs, speed limit signs.
Traffic Lights: Red, yellow, green signals.
Lane Markers: Lines on the road.
Obstacles: Cones, debris, fallen branches.
Localize Objects: Draw precise bounding boxes around each detected object.
Confidence Scoring: Assign a confidence score to each detection, indicating how
certain the model is about its prediction.
4. Tracking and Prediction: The detected objects are then tracked over time to estimate
their speed, trajectory, and predict their future movements. This information is fused with
data from other sensors (LiDAR for distance, radar for velocity).
5. Decision Making: Based on the detected objects and their predicted behavior, the
autonomous vehicle's central control system makes critical decisions:
Accelerate, brake, or steer.
Change lanes.
Obey traffic signals.
Avoid collisions.
+-------------------------------------------------------------+
| |
| Input Image/Video (From Car Cameras) |
| +------------------------------------------------+ |
| | | |
| | (Street Scene with Car, Pedestrian, Sign) | |
| | | |
| +------------------------------------------------+ |
| |
+--------------------------+----------------------------------+
|
v
[Deep Learning Object Detection Model]
| (e.g., YOLO, Faster R-CNN)
v
+-------------------------------------------------------------+
| |
| Detected Objects (with Bounding Boxes) |
| +------------------------------------------------+ |
| | | |
| | (Car - [x,y,w,h], confidence) | |
| | (Pedestrian - [x,y,w,h], confidence) | |
| | (Stop Sign - [x,y,w,h], confidence) | |
| +------------------------------------------------+ |
| |
+--------------------------+----------------------------------+
|
v
[Tracking & Fusion with Other Sensors]
|
v
[Path Planning & Control Decisions]
|
v
Autonomous Vehicle Action
Object detection is foundational for autonomous driving, enabling cars to perceive their
environment and react intelligently, making it a cornerstone for safe and efficient self-driving
technology.