Unit : 01
1) What is Natural Language Processing (NLP)? Explain its key goals with common
applications.
NLP stands for Natural Language Processing. It is a way for computers to understand and work with
human language, like the way we talk or write.
“It is a field at the intersection of computer science, artificial intelligence, and linguistics that focuses on
enabling computers to understand, interpret, and generate human language in a way that is both
meaningful and useful.”
Key Goals of NLP:
• Understanding: Parsing and making sense of human language input (like text or speech).
• Generation: Producing human-like language responses or text.
• Translation: Converting text from one language to another.
• Summarization: Creating concise summaries of long texts.
• Sentiment Analysis: Detecting emotions or opinions in text.
• Named Entity Recognition (NER): Identifying names, places, dates, etc., in text.
Common Applications:
• Chatbots and virtual assistants (e.g., Siri, Alexa, ChatGPT)
• Search engines (understanding queries)
• Machine translation (e.g., Google Translate)
• Spam detection in emails
• Voice recognition systems
2) Explain the working of NLP in detail.
1. Text Input and Data Collection
• Data Collection: Gathering text data from various sources such as websites, books, social media or
proprietary databases.
• Data Storage: Storing the collected text data in a structured format, such as a database or a collection of
documents.
2. Text Preprocessing
Preprocessing is crucial to clean and prepare the raw text data for analysis. Common preprocessing steps
include:
• Tokenization: Splitting text into smaller units like words or sentences.
• Lowercasing: Converting all text to lowercase to ensure uniformity.
• Stopword Removal: Removing common words that do not contribute significant meaning, such as
“and,” “the,” “is.”
• Punctuation Removal: Removing punctuation marks.
• Stemming and Lemmatization: Reducing words to their base or root forms. Stemming cuts off suffixes,
while lemmatization considers the context and converts words to their meaningful base form.
• Text Normalization: Standardizing text format, including correcting spelling errors, expanding
contractions and handling special characters.
3. Text Representation
• Bag of Words (BoW): Representing text as a collection of words, ignoring grammar and word order but
keeping track of word frequency.
• Term Frequency-Inverse Document Frequency (TF-IDF): A statistic that reflects the importance of a
word in a document relative to a collection of documents.
• Word Embeddings: Using dense vector representations of words where semantically similar words are
closer together in the vector space (e.g., Word2Vec, GloVe).
4. Feature Extraction
Extracting meaningful features from the text data that can be used for various NLP tasks.
• N-grams: Capturing sequences of N words to preserve some context and word order.
• Syntactic Features: Using parts of speech tags, syntactic dependencies and parse trees.
• Semantic Features: Leveraging word embedings and other representations to capture word meaning and
context.
5. Model Selection and Training
Selecting and training a machine learning or deep learning model to perform specific NLP tasks.
• Supervised Learning: Using labeled data to train models like Support Vector Machines (SVM), Random
Forests or deep learning models like Convolutional Neural Networks (CNNs) and Recurrent Neural
Networks (RNNs).
• Unsupervised Learning: Applying techniques like clustering or topic modeling (e.g., Latent Dirichlet
Allocation) on unlabeled data.
• Pre-trained Models: Utilizing pre-trained language models such as BERT, GPT or transformer-based
models that have been trained on large corpora.
6. Model Deployment and Inference
Deploying the trained model and using it to make predictions or extract insights from new text data.
• Text Classification: Categorizing text into predefined classes (e.g., spam detection, sentiment analysis).
• Named Entity Recognition (NER): Identifying and classifying entities in the text.
• Machine Translation: Translating text from one language to another.
• Question Answering: Providing answers to questions based on the context provided by text data.
7. Evaluation and Optimization
Evaluating the performance of the NLP algorithm using metrics such as accuracy, precision, recall, F1-
score and others.
• Hyperparameter Tuning: Adjusting model parameters to improve performance.
• Error Analysis: Analyzing errors to understand model weaknesses and improve robustness.
3) Why is Natural Language Processing challenging?
NLP is difficult because human language is complex, messy, and full of exceptions. Here are some
simple reasons why it's so challenging:
- Limited contextual understanding and memory: NLP models often struggle to interpret or retain the
meaning of words or phrases based on the context in which they are used. This can lead to
misinterpretations or incorrect analysis of text data.
- Ambiguity and polysemy: Many words and phrases have multiple meanings, making it difficult for
NLP models to accurately determine the intended use in a given context. This can result in inaccurate
analysis or miscommunication.
- Language variations and idioms: The vast diversity of languages and their regional variations – with
different dialects, idioms, slang and colloquialisms – make it challenging for NLP models to analyse and
interpret text accurately across different linguistic contexts. Researchers are working to continuously
update models and adapt to evolving language
Some examples that makes NLP difficult is as given below:
1. Ambiguity
Words or sentences can have multiple meanings depending on context.
Example: “I saw a man with a telescope.”
- Did you use the telescope, or did the man have one?
2. Different Ways to Say the Same Thing
People can express the same idea in many different ways.
“I’m happy,” “I feel great,” “Life is good,” all mean something similar.
3. Languages Are Very Different
Grammar, sentence order, and vocabulary vary a lot between languages.
Some languages even don’t use spaces between words!
4. Context Matters
Meaning can change based on what was said before or who is speaking.
“It’s hot.” → Is it about the weather, food, or someone’s appearance?
5. Sarcasm and Humor
Humans understand tone and emotion, but computers struggle with things like jokes or sarcasm.
“Oh great, another Monday.” ← Probably not actually excited!
6. Slang, Typos, and Informal Language
People often use incorrect grammar, emojis, abbreviations, or made-up words.
“Wanna hang 2nite?” -Harder for a computer to understand than “Would you like to hang out tonight?”
7. World Knowledge
Sometimes, understanding a sentence requires knowing facts about the world.
“The president tweeted again.”- You need to know what "president" and "tweeted" mean in today’s
context.
4) What is the history of Natural Language Processing? Explain all the advancements
in detail.
The history of Natural Language Processing (NLP) spans decades and is closely tied to the
development of computers, linguistics, and artificial intelligence. Here's a simple timeline:
1. 1950s – The Beginning
• Alan Turing (1950): Proposed the famous Turing Test to see if a machine could "think" like a human.
• First attempts at machine translation (e.g., Russian to English during the Cold War).
• Language was handled using rules, written by humans.
2. 1960s–1970s – Rule-Based Systems
• ELIZA (1966): One of the first chatbots, mimicked a therapist using pattern matching.
• SHRDLU (1970): Could understand simple English to move objects in a virtual world.
• Language processing was still based on hand-crafted rules and logic.
• These systems couldn’t scale well to real-world language.
3. 1980s – Statistical NLP
• Shift from rules to statistics: Use of probability and data instead of hand-written rules.
• NLP tasks like part-of-speech tagging were now done using models like Hidden Markov Models
• Computers could learn from language data (called corpora).
4. 1990s – Machine Learning Revolution
• Statistical machine translation became popular.
• NLP began to use machine learning (especially supervised learning).
• More data, better algorithms → improved accuracy in tasks like speech recognition and parsing.
5. 2010s – Deep Learning Era
• Big breakthrough: Word embeddings (like Word2Vec, GloVe) captured word meanings as vectors.
• Neural networks, especially Recurrent Neural Networks (RNNs) and LSTMs, became popular for
tasks like translation and speech recognition.
6. 2018–Present – Transformers and Large Language Models
• Transformers introduced (e.g., BERT, GPT). Huge leap in performance and flexibility.
• Pretrained language models trained on massive text datasets (like books, articles, websites).
• These models (like ChatGPT) can now:
• Understand and generate text
• Translate, summarize, write code, and more
• NLP becomes more conversational, flexible, and human-like.
5) What are the detailed advantages and disadvantages of Natural Language Processing
Advantages
1. Improved Human-Computer Interaction
• NLP allows machines to understand, interpret, and respond to human language, both spoken and written.
This improves how people interact with technology:
• Voice assistants (like Siri, Alexa, and Google Ass) understand spoken queries and respond accordingly.
• Chatbots can simulate conversations, helping users navigate websites or access customer service without
human agents.
• Smart devices can be controlled using natural language, making them more accessible and user-friendly.
2. Automation of Repetitive Tasks
• NLP automates tasks that would otherwise require human effort:
• Email classification (e.g., spam vs. important).
• Customer support tickets can be routed or even answered automatically.
• Document summarization allows companies to generate quick insights from long reports.
• This reduces operational costs, speeds up workflows, and increases consistency.
3. Efficient Data Analysis
• Organizations generate and collect massive amounts of unstructured text data — customer feedback,
social media, survey responses, etc. NLP helps:
• Text mining: Extracting useful information from documents.
• Topic modeling: Identifying themes in large text corpora.
• Trend analysis: Detecting what people are talking about online.
• This allows businesses and researchers to make data-driven decisions.
4. Multilingual Support
• NLP makes real-time translation and multilingual communication possible:
• Machine translation services (e.g., Google Translate) allow people to understand and produce content in
different languages.
• Businesses can serve global markets by offering content in multiple languages.
• Real-time speech translation facilitates international collaboration and tourism.
5. Personalization
• NLP enables platforms to offer personalized experiences:
• Streaming services (e.g., Netflix) analyze viewing history and preferences through NLP to recommend
content.
• E-commerce platforms personalize product suggestions based on customer reviews and queries.
• Social media platforms adjust feeds based on user interests inferred from text posts or interactions.
6. Enhanced Search Engines
• NLP improves how search engines understand user intent and deliver more relevant results:
• NLP-powered search understands semantic meaning, not just keyword matching.
• Users can ask natural questions (“What’s the weather like tomorrow in Paris?”) rather than using strict
keywords.
• This makes search experiences more intuitive and effective.
7. Sentiment and Opinion Analysis
• Businesses and organizations use NLP to understand how people feel:
• Sentiment analysis tools scan reviews, comments, or social media to determine if people are expressing
positive, negative, or neutral opinions.
• This helps brands understand customer satisfaction, public perception, and improve marketing strategies.
• Example: A company may use NLP to analyze thousands of product reviews to identify common
complaints or features customers love.
8. Information Extraction
• NLP helps convert unstructured text into structured information:
• Extracts names, dates, locations, organizations (Named Entity Recognition).
• Useful in legal and medical domains, where extracting facts from documents or records is crucial.
• Helps build knowledge graphs and databases from raw text.
9. Accessibility
• NLP tools make digital content more accessible to people with disabilities:
• Speech-to-text allows those with hearing impairments to read spoken content.
• Text-to-speech enables visually impaired users to listen to written content.
• Voice commands and natural language interfaces reduce the need for complex navigation or typing.
10. Real-Time Processing
• NLP can process language input and respond in real time, enabling:
• Live transcription of meetings and lectures.
• Real-time translation during video calls or speeches.
• Voice-controlled assistants that react instantly.
This is especially valuable in fields like journalism, legal transcription, and international collaboration.
Disadvantages
1. Ambiguity in Language
• Human language is inherently ambiguous, making it difficult for machines to always understand the
correct meaning:
• Lexical ambiguity: A word may have multiple meanings (e.g., "bank" could mean a financial institution
or the side of a river).
• Syntactic ambiguity: A sentence may be structured in a way that allows for different interpretations.
• Context dependency: Meaning often depends heavily on context, which can be difficult for NLP models
to capture accurately.
2. Sarcasm, Irony, and Figurative Language
• NLP models struggle with:
• Sarcasm: For example, “Oh great, another Monday” might be interpreted as positive without
understanding the tone.
• Idioms and metaphors: Phrases like “kick the bucket” or “break the ice” don’t mean what the words
literally suggest.
• Cultural references: NLP may not recognize or correctly interpret culturally specific expressions or
humor.
3. Dependence on Large Datasets
• Modern NLP, especially deep learning-based models like GPT or BERT, require:
• Massive amounts of data for training, which may not always be available for specialized domains or
low-resource languages.
• High computational power, which increases costs and limits accessibility for smaller organizations or
developing countries.
4. Data Privacy and Security Concerns
• Since NLP systems often require access to large text corpora:
• Sensitive information can be exposed during data collection, training, or inference.
• There’s a risk of data misuse or leakage in chatbots or AI writing assistants, especially in healthcare,
legal, or financial sectors.
5. Bias and Fairness Issues
• NLP models can reflect and even amplify biases present in training data:
• Gender bias: E.g., associating "nurse" with women and "engineer" with men.
• Racial or cultural stereotypes may be reinforced unknowingly.
• This can lead to unfair or discriminatory outcomes in applications like hiring tools, legal analysis, or
credit scoring.
6. Language and Domain Limitations
• Less effective for low-resource languages or dialects with limited digital text available.
• Domain-specific models (e.g., legal or medical NLP) require specialized training data, which may be
costly or unavailable.
7. Lack of Common Sense and World Knowledge
• Even advanced models can make basic factual or logical mistakes:
• They might lack common sense reasoning, such as knowing that people can't breathe underwater
without equipment.
• NLP systems often generate plausible-sounding but incorrect answers.
8. Real-Time and Multilingual Processing Challenges
• Real-time NLP (e.g., live transcription or translation) can have latency issues or reduced accuracy.
• Multilingual models might underperform on certain languages compared to high-resource ones like
English or Chinese.
9. Maintenance and Updates
• NLP models must be regularly updated to stay current with evolving language, slang, and terminology.
• Fine-tuning or retraining models requires expertise and can be expensive.
10. Ethical and Legal Concerns
• Deepfake text generation and spam creation can be misused for misinformation, scams, or propaganda.
• Legal accountability is unclear when AI-generated content leads to harm or misinformation.
• Transparency: Many models (especially large neural networks) act as "black boxes" with little
explainability.
6) What are the components of Natural Language Processing (NLP), and what are the
specific tasks involved in each component?
1. Lexical Analysis
Lexical analysis involves breaking up the text into units called tokens (words, phrases, or symbols).
Tasks Involved:
• Tokenization: Splits text into words, punctuation marks, numbers, etc.
• Example: "He’s going to school." → [‘He’, ‘’s’, ‘going’, ‘to’, ‘school’, ‘.’]
• Stop Word Removal: Removes common words (e.g., “the”, “is”, “in”) that don’t carry significant
meaning.
• Stemming: Reduces words to their root form.
• Example: "playing", "played", "plays" → "play"
• Lemmatization: Converts words to their base form using vocabulary and morphological analysis.
• Example: "better" → "good"
2. Syntactic Analysis (Parsing)
This analyzes the grammar of a sentence to ensure it conforms to formal rules of language.
Tasks Involved:
• Part-of-Speech (POS) Tagging: Labels each word with its grammatical role (noun, verb, adjective, etc.).
• Parsing: Generates parse trees to show hierarchical grammatical structure.
• Example: Subject → Verb → Object structure.
• Goal: Check sentence structure and identify grammatical errors.
3. Semantic Analysis
Focuses on the meaning of words and sentences.
Tasks Involved:
• Word Sense Disambiguation (WSD): Resolves ambiguity in words with multiple meanings.
• Example: "bank" (river bank vs financial bank)
• Semantic Role Labeling: Identifies predicate-argument structures (who did what to whom).
• Example: “John gave Mary a book.”
• Agent: John
• Recipient: Mary
• Theme: Book
• Goal: Extract factual information and relationships.
4. Discourse Integration
Takes into account context beyond individual sentences for coherent interpretation.
Tasks Involved:
• Anaphora Resolution: Resolves references like “he”, “she”, “it” back to the correct entity.
• Ellipsis Resolution: Fills in missing elements that are understood from context.
• Maintaining Context: Ensures coherence over paragraphs or entire documents.
5. Pragmatic Analysis
• Deals with the intended meaning and how it changes based on the context of conversation.
Tasks Involved:
• Intent Recognition: What does the user want?
• E.g., "Can you pass the salt?" → Not a question, but a request.
• Contextual Meaning: Understanding tone, sarcasm, or politeness.
• Speech Act Theory: Classifies utterances as questions, commands, requests, etc.
• Goal: Understand what is meant, not just what is said.
6. Morphological Analysis
Studies the structure of words and how they are formed.
Tasks Involved:
• Identifying Morphemes: Smallest meaningful units in language.
• Example: “unhappiness” → “un” + “happy” + “ness”
• Inflectional Morphology: Understands word changes for tense, number, etc.
• Example: “run” → “ran” or “cat” → “cats”
7. Named Entity Recognition (NER)
Recognizes and classifies proper nouns and specific terms.
Tasks Involved:
• Identifying names of people, locations, organizations, dates, monetary values, etc.
• Example: “Elon Musk founded SpaceX in 2002.”
• [Elon Musk] → Person
• [SpaceX] → Organization
• [2002] → Date
8. Sentiment Analysis
Determines the emotional tone behind a body of text.
Tasks Involved:
• Polarity Classification: Positive, Negative, Neutral.
• Emotion Detection: Happy, angry, sad, etc.
• Aspect-based Sentiment Analysis: Identifies sentiment about specific aspects.
• Example: "The camera is great, but the battery is terrible.“
9. Coreference Resolution
Finds out which words refer to the same entity in a text.
Tasks Involved:
• Resolving pronouns and entities to their antecedents.
• Example: "Sarah went to the store. She bought milk."
• “She” → “Sarah
7) What are the various applications of Natural Language Processing (NLP), and how
can each be explained in detail?
Natural Language Processing (NLP) has a wide range of applications in various industries.
1. Chatbots
• Role: Chatbots utilize NLP to engage in text-based or voice-based conversations, offering immediate and
real-time communication.
• Customer Support: They help businesses streamline customer service operations by handling queries
24/7, reducing human intervention and waiting times.
• Personalization: They can be tailored to reflect the brand's tone, creating unique experiences for
customers.
• Advancements: The technology is evolving, with chatbots becoming more sophisticated and capable of
handling complex queries.
2. Email Filtering
• Spam Detection: NLP detects and filters out spam, preventing unwanted or harmful content from
cluttering inboxes.
• Categorization: It classifies emails into specific folders (e.g., social, promotions, primary) based on
content, helping users manage their inbox efficiently.
• Productivity: By automatically sorting and categorizing emails, NLP significantly reduces manual
sorting, improving overall productivity and email organization.
3. Language Translation
• Real-Time Translation: NLP allows for real-time translation of text and speech, helping individuals and
businesses bridge language gaps.
• Contextual Understanding: NLP-based translation tools understand the context and grammar of input
language, ensuring more accurate and natural-sounding translations.
• Applications: Vital in sectors like travel, international business, and research, where cross-cultural
communication is essential.
• Expansion: Modern translation tools go beyond basic word-for-word translation, offering context-
sensitive, accurate results.
4. Sentiment Analysis
• Emotional Tone: NLP analyzes the emotional tone of text (positive, negative, neutral) to gauge opinions,
emotions, and attitudes.
• Business Insights: Businesses use sentiment analysis to monitor customer feedback, social media
mentions, and reviews to understand public perception of their brand or products.
• Proactive Response: Negative sentiments can be flagged for immediate action, while positive feedback
highlights successful strategies or products.
• Market Research: It aids in decision-making by providing insights into consumer sentiment, which
helps with product development, marketing strategies, and customer service improvements.
5. Predictive Text
• Word Suggestions: NLP-based predictive text systems suggest words or phrases based on the user’s
typing history, making typing faster and more efficient.
• Personalization: These systems learn from the user’s previous inputs, adjusting suggestions to fit their
common language patterns.
• Typos and Misspellings: Predictive text also corrects spelling errors automatically, further enhancing
user experience by reducing manual correction.
6. Text Summarization
• Key Point Extraction: NLP extracts the main ideas or key points from long texts to create concise
summaries, aiding in quick information digestion.
• Information Overload: This application is crucial in processing large volumes of information quickly,
especially in sectors like law, journalism, and academia.
• Types: There are two main approaches—extractive summarization, which selects key sentences
directly from the source, and abstractive summarization, which rephrases the content in a concise form.
7. Smart Assistants
• Voice Interaction: NLP enables smart assistants like Siri, Alexa, and Google Assistant to understand
spoken commands and interact with users naturally.
• Task Automation: These assistants perform tasks like setting reminders, controlling smart home devices,
and providing real-time information (e.g., weather updates, traffic conditions).
• Two-Way Communication: NLP allows smart assistants to hold a conversation, responding to user
queries and providing contextually appropriate answers.
• Learning and Adaptation: These systems continuously learn from user interactions, improving their
responses and functionality over time.
8. Automated Essay Scoring
• Objective Grading: NLP-based systems evaluate essays by analyzing grammar, vocabulary, coherence,
argument structure, and other aspects of writing quality.
• Efficiency: It offers instant feedback to students, enabling faster evaluation compared to manual grading,
which is especially useful for large student populations.
• Consistency: The technology provides consistent, unbiased grading, ensuring fairness and eliminating
human error or subjective influence.
• Educational Impact: Automated scoring tools can be used alongside traditional grading methods to give
both immediate feedback and detailed analysis for improvement.
8) What kinds of language knowledge does HAL need to effectively understand and
engage in dialogue?
Language processing applications differ from other data processing systems because they incorporate
knowledge of language.
• For instance, consider the Unix wc program. When used to count bytes and lines, it's a standard data
processing application. However, when it counts words, it needs to understand what constitutes a "word,"
which makes it a language processing system.
• This example highlights the distinction between simple data processing and complex language
processing.
• More sophisticated systems, such as conversational agents, machine translation systems, or robust
question-answering systems, require more advanced language knowledge.
To understand the scope of the knowledge needed, let’s break down what HAL (Heuristically
Programmed Algorithmic Computer) needs to know to engage in dialogue:
• Speech Recognition and Synthesis: HAL must recognize words from an audio signal and generate audio
from text. This requires knowledge in phonetics (how words are pronounced) and phonology (how
sounds are acoustically realized).
• Example: HAL should recognize the difference in sounds between words like “right” and “rite”,
even though they are homophones (same pronunciation, different meanings).
• Morphology: Morphology refers to understanding the structure of words, such as singular versus plural,
and handling variations in word forms.
• Example: HAL must understand that “door” is singular and “doors” is plural.
• Syntax: Syntax involves structuring words correctly to make sense. HAL must know how words are
grouped and ordered in meaningful ways.
• Example: The sequence “I’m I do, sorry that afraid Dave I’m can’t” is incorrect because HAL
needs syntax knowledge to properly reorder the words.
• Semantics: Semantics involves understanding meaning. HAL needs to understand the meanings of
individual words and how they combine to form sentences.
• Example: A question like “How much Chinese silk was exported to Western Europe by the
end of the 18th century?” requires understanding the meaning of terms like “exported”, “silk”,
and the time reference “by the end of the 18th century”.
• Pragmatics: Pragmatics involves understanding intentions and context. HAL must interpret not only the
literal meaning of words but also the goal behind the statement.
• Example: If Dave says “HAL, open the pod bay door”, HAL must recognize that this is a
request rather than a statement or question, and should respond appropriately.
• Discourse: Discourse knowledge involves understanding how different parts of a conversation or text
relate to one another.
• Example: In a conversation, HAL must track earlier utterances to properly interpret pronouns and
references like “that year”.
9) How does morphological and syntactic ambiguity create multiple interpretations in
the sentence “I made her duck”?
Ambiguity arises when multiple interpretations of the same linguistic input exist. Ambiguity can occur at
various levels of language processing:
• Morphological/Syntactic Ambiguity: Words can have multiple meanings or functions based on context.
• Example: The sentence “I made her duck” could have various interpretations:
• “I cooked waterfowl for her.”
• “I cooked waterfowl that belonged to her.”
• “I created a duck that she owns.”
• “I caused her to lower her head quickly.”
• “I transformed her into a duck.”
This ambiguity arises because:
• "Duck" can be a noun (a bird) or a verb (to lower one’s head).
• "Her" can be a possessive pronoun or a dative pronoun.
• “Make” can be a transitive verb (taking a direct object) or a ditransitive verb (taking two objects).
10) What are the different formal models used in NLP to capture linguistic
knowledge, and how do they contribute to tasks like speech recognition and semantic
analysis?
Several formal models help capture linguistic knowledge:
• State Machines: These models consist of states, transitions, and input representations. Finite-state
automata and finite-state transducers are key examples. These are used for tasks like speech
recognition and morphology.
• Example: A finite-state machine might model the transitions between phonemes in a word
during speech recognition.
• Formal Rule Systems: These systems, like context-free grammars or regular grammars, are used to
capture knowledge of syntax.
• Example: A context-free grammar might describe the structure of noun phrases in a language.
• Logic Models: First-order logic and related models are used for semantics and pragmatics.
• Example: Lambda calculus might be used to represent the meaning of a sentence, helping to
resolve ambiguity in the meaning of words.
Probabilistic Models: These models, such as Hidden Markov Models (HMMs), help resolve ambiguity by
assigning probabilities to different interpretations.
• Example: In speech recognition, an HMM might help determine the most likely transcription of
spoken words, considering the probabilities of various word sequences.
Vector-Space Models: These models represent word meanings in a continuous vector space and are used in
information retrieval and semantic analysis.
• Example: A word2vec model could map the word “king” to a vector that is closer to “queen”
than to “apple”, reflecting their semantic similarity.
11) How did ELIZA demonstrate the social nature of human-computer
communication despite lacking genuine understanding?
Turing's Turing Test (1950) proposed a way to determine if a machine can think by testing its ability to
engage in language like a human. ELIZA, an early language processing system developed by Joseph
Weizenbaum, demonstrated that a computer could convince people it understood them even though it
lacked genuine understanding. ELIZA used pattern matching to simulate the role of a Rogerian
psychotherapist.
Example interaction with ELIZA:
• User: You are like my father in some ways.
• ELIZA: WHAT RESEMBLANCE DO YOU SEE?
Despite its simplicity, many users believed ELIZA understood their issues because it mirrored human
conversational behavior. This interaction highlights the social nature of human-computer communication,
even when the computer has no real understanding.
12) What are some current state-of-the-art applications of speech and language
processing, and how do they impact everyday technology use?
The current state of the art in speech and language processing has advanced significantly, driven by
improvements in computing power, the internet, and mobile access. Some modern systems include:
• Conversational Agents: Used by companies like Amtrak and United Airlines, these agents guide
travelers through tasks like booking tickets and checking arrival times.
• Speech-Driven Systems in Cars: Many car manufacturers use speech recognition to allow drivers to
control their entertainment and navigation systems hands-free.
• Video Search Engines: Companies use speech recognition to transcribe spoken content in video files,
enabling searchability across millions of hours of video.
• Cross-Language Search and Translation: Google uses cross-language information retrieval to
translate queries into different languages, find relevant documents, and translate them back.
• Automated Essay Grading: Educational platforms like Pearson and testing services like ETS use
automated systems to grade essays, providing feedback that is indistinguishable from human grading.
• Virtual Agents for Tutoring: Interactive avatars serve as tutors for children learning to read, providing
a conversational learning experience.
• Text Analytics: Companies use text analysis to extract valuable insights from user-generated content
like blogs and forums for marketing intelligence
UNIT : 02
1. How does ambiguity in word forms affect the efficiency of morphological analysis in
NLP?
Many words in natural languages can have multiple possible morphological analyses (forms, meanings,
or grammatical roles).
A single surface form may correspond to:
o Multiple parts of speech
o Multiple inflectional features (tense, number, case, etc.)
o Multiple derivational interpretations
Example:
"flies"
o Noun (plural of fly) → "The flies are buzzing."
o Verb (3rd person singular of fly) → "She flies every summer."
How does this affect morphological analysis in NLP?
Increased computational complexity
o A morphological analyzer must generate all possible analyses for a word.
o Ambiguity means more candidates → slower processing.
Reduced efficiency in disambiguation
o The system cannot directly pick the correct form.
o It must rely on additional modules (POS tagging, syntax, semantics, or context-based models).
Error propagation
o Wrong morphological interpretation (e.g., treating flies as a verb instead of noun) can lead to
errors in parsing, machine translation, information retrieval, or sentiment analysis.
Impact on downstream NLP tasks
o Machine Translation: Wrong form → mistranslated word.
o Speech Recognition: Morphological ambiguity increases homophone confusion.
o Information Retrieval: Search engine may retrieve irrelevant documents.
Strategies to handle ambiguity
Morphological disambiguation models: Use probabilistic or neural approaches to select the most likely
analysis.
Contextual cues: Syntax and semantics help resolve ambiguity.
Hybrid approaches: Rule-based + statistical methods.
Recent trend: Large Language Models (LLMs) inherently reduce ambiguity through contextual
embeddings.
2. Write a short note on Hidden Markov Model for POS tagging.
Part-of-Speech (POS) tagging = assigning each word in a sentence its correct grammatical category
(Noun, Verb, Adjective, etc.).
Example: "I saw a cat" → [Pronoun, Verb, Determiner, Noun].
Hidden Markov Model (HMM) is one of the most widely used probabilistic models for POS tagging.
Words are observed, but tags are hidden (we don’t see them directly).
HMM models POS tagging as a sequence prediction problem.
Components of HMM
1. States: POS tags (e.g., Noun, Verb, Adj).
2. Observations: Words in the sentence.
3. Transition Probability (P(tagᵢ | tagᵢ₋₁)): Probability of one tag following another (e.g., Verb is often
followed by Noun).
4. Emission Probability (P(word | tag)): Probability of a word being generated by a tag (e.g., "cat" likely
under Noun).
Working
Given a sentence, HMM computes the most likely sequence of tags using:
o Bayes rule and
o Viterbi Algorithm (dynamic programming).
Formula:
P(T)→ transition probabilities (tag sequence likelihood).
P(W∣T) → emission probabilities (word likelihood given tag).
Example
Sentence: "Fish swim"
Possible tags: "Fish" → Noun/Verb, "swim" → Verb/Noun.
HMM uses probabilities to decide:
o "Fish (Noun)" + "swim (Verb)" is more likely than
o "Fish (Verb)" + "swim (Noun)".
Advantages
Handles ambiguity in word meanings.
Data-driven (learns from corpus).
Efficient sequence prediction with Viterbi.
3. Describe the role of a gazetteer in Named Entity Recognition.
1. What is a Gazetteer?
A gazetteer is a predefined list or dictionary of names and entities such as:
o Person names (e.g., Jack, Mary).
o Locations (e.g., London, Mumbai).
o Organizations (e.g., UN, Google).
o Time/Date expressions.
It acts as an external knowledge resource for NER systems.
2. Role in NER
1. Entity Identification
o Helps in recognizing words/phrases as named entities when they match entries in the gazetteer.
o Example: If "Paris" is in a location gazetteer, NER tags it as a Location.
2. Disambiguation
o When a word can belong to multiple categories, gazetteers assist in narrowing down possibilities.
o Example: “Amazon” → can be a river (Location) or company (Organization). A gazetteer with
context helps disambiguate.
3. Improves Accuracy
o Enhances recall (fewer entities missed).
o Useful for domain-specific NER (e.g., medical gazetteer for drug names, legal gazetteer for
laws).
4. Hybrid NER Systems
o In modern NER, gazetteers are often combined with machine learning models (like CRFs,
BiLSTMs, Transformers) to improve performance.
3. Example
Sentence: “Barack Obama visited India.”
Gazetteer: {Barack Obama → Person, India → Location}.
NER tags → Barack Obama (Person), India (Location).
UNIT : 03
1. Explore context-free grammars for English and discuss their role in parsing natural
language. Provide examples to illustrate the parsing process.
A Context-Free Grammar (CFG) is a formal system that describes the syntactic structure of a language. It
consists of:
Nonterminals (variables): Abstract symbols representing syntactic categories (e.g., S, NP, VP).
Terminals: Actual words/tokens in the language (e.g., "the", "dogs", "cried").
Productions (rules): Rewrite rules that define how nonterminals expand (e.g., NP → ART N).
Start symbol: The root category, usually S (sentence).
Formal Definition:
A CFG is a 4-tuple G = (V, Σ, R, S) where:
V = set of nonterminals
Σ = set of terminals
R = set of production rules
S = start symbol
Role of CFGs in Natural Language Parsing
Parsing = Analyzing the syntactic structure of a sentence according to a grammar.
CFGs are widely used in NLP because:
o They capture the hierarchical structure of sentences.
o They support recursive rules, which are common in natural languages.
o They are the foundation for many parsers (top-down, bottom-up, probabilistic CFGs).
Example Grammar (English Fragment)
Let’s define a small CFG:
S → NP VP
NP → ART N | ART ADJ N
VP → V | V NP
ART → the | a
N → dog | dogs | cat
ADJ → big | small
V → cried | chased
Parsing Example 1: "The dogs cried"
Step 1: Start with S
S ⇒ NP VP
NP ⇒ ART N
Step 2: Expand NP
S ⇒ ART N VP
Step 3: Expand with words
⇒ the dogs VP
VP ⇒ V
Step 4: Expand VP
S ⇒ the dogs cried
Step 5: Substitute
2. Compare and contrast lexicalized and probabilistic parsing, and evaluate their
effectiveness in syntactic analysis.
1. Lexicalized Parsing
Grammar rules are enriched with lexical heads (words) that govern phrases.
Idea: Instead of just categories (NP → ART N), rules carry information about which word is the “head” of
the phrase.
Motivation: Many syntactic choices depend on specific words, not just categories.
o Example: “depend on” requires a prepositional complement, while “eat” requires a noun phrase.
Strengths:
o Captures head–dependent relations.
o Helps resolve structural ambiguities (e.g., PP-attachment: “I saw the man with a telescope”).
Weaknesses:
o Grammars become large and sparse (many rules for different heads).
o Requires more annotated data (e.g., Treebanks with head annotations).
2. Probabilistic Parsing (PCFGs)
A parsing method where each grammar rule has a probability, learned from data (e.g., Treebanks).
Example Rule Probabilities:
o S → NP VP [0.9]
o NP → ART N [0.7]
Process:
o Multiple parse trees may exist → parser assigns probabilities and chooses the most likely one.
Strengths:
o Handles ambiguity quantitatively by ranking parses.
o Efficient algorithms exist (e.g., CKY, Earley with probabilities).
Weaknesses:
o Assumes rules are independent (context-free), which often oversimplifies natural language.
o Struggles with long-distance dependencies (e.g., subject–verb agreement).
3. Key Differences (Tabular Comparison)
Aspect Lexicalized Parsing Probabilistic Parsing
Core Idea Enrich grammar with word-level (head) information Assign probabilities to CFG rules
Focus Lexical dependencies (head–modifier) Likelihood of syntactic structures
Example VP[eat] → V[eat] NP[pizza] VP → V NP [0.6]
Ambiguity
Uses head word cues (lexical info) Uses probabilities from data
Resolution
Better disambiguation for word-specific structures; Captures global syntactic preferences;
Strengths
handles PP-attachment well robust to noisy data
Weaknesses Data sparsity (too many lexicalized rules) Independence assumptions limit accuracy
Needs large Treebanks for reliable rule
Data Requirement Needs annotated corpora with head information
probabilities
4. Evaluation of Effectiveness
Probabilistic Parsing (PCFGs):
o Effective for broad-coverage parsing of English when large corpora (like Penn Treebank) are
available.
o Good at ranking parses but often fails to capture fine-grained lexical dependencies.
Lexicalized Parsing:
o More accurate in handling structural ambiguities and head-dependent relations.
o But suffers from data sparsity — needs smoothing or back-off models.
o Often combined with probabilistic models → Lexicalized Probabilistic Parsers (e.g., Collins
Parser, Charniak Parser) which achieved state-of-the-art results before neural models.
3. Investigate the representation of meaning in NLP, emphasising the challenges and
methods involved in semantic analysis.
In Natural Language Processing (NLP), meaning representation refers to converting human language
into a formal structure that machines can interpret and reason about.
Goal: Capture the semantics (meaning) of sentences beyond their syntax.
Example:
o Sentence: “John gave Mary a book.”
o Possible meaning representation (predicate logic):
GIVE(John,Mary,Book)GIVE(John, Mary, Book)GIVE(John,Mary,Book)
2. Challenges in Semantic Analysis
1. Ambiguity
o Words and sentences can have multiple meanings.
o Lexical ambiguity: “bank” (river bank vs. financial bank).
o Syntactic ambiguity: “I saw the man with a telescope.”
2. Compositionality
o Meaning of a sentence should be built from the meaning of its parts, but idioms or metaphors
break this principle.
o Example: “Kick the bucket” ≠ literal “kick” + “bucket.”
3. Context-dependence
o Meaning depends on discourse and world knowledge.
o Example: “He is ready” → Who is “he”? Ready for what?
4. World Knowledge & Commonsense
o Machines need real-world knowledge to fully interpret meaning.
o Example: “Birds can fly” (true in general, but exceptions exist: penguins).
5. Complex Structures
o Quantifiers, negation, tense, modality complicate semantic representation.
o Example: “Every student did not pass” (scope ambiguity).
3. Methods of Semantic Representation
Different frameworks have been developed to represent meaning:
(a) Logic-Based Representations
o Example: “Every man sleeps” → ∀x (Man(x) → Sleeps(x))
First-Order Predicate Logic (FOPL): Represents entities, relations, and quantifiers.
Role: Useful for reasoning, question answering.
Challenge: Hard to scale to natural language’s ambiguity and variability.
(b) Semantic Networks
Graph structures with nodes (concepts) and edges (relations).
Example:
o Dog → isA → Animal
o Dog → hasPart → Tail
Role: Early AI systems used them for representing knowledge.
Challenge: Large networks become complex and inconsistent.
(c) Frame-Based Representations
Structures that represent stereotypical situations with slots and fillers.
Example (Frame for “Buying”):
Buyer: John
Item: Book
Seller: Mary
Role: Useful in information extraction, dialog systems.
(d) Distributional / Vector Representations
Words and sentences represented as vectors in high-dimensional space (word embeddings like
Word2Vec, GloVe, BERT).
Capture meaning based on context of usage (distributional hypothesis: “you shall know a word by the
company it keeps”).
Strength: Handles similarity and ambiguity better.
Challenge: Harder to encode logical structure and compositionality.
(e) Compositional Semantics
Uses λ-calculus and formal semantics to systematically build sentence meaning from words and syntax.
Example:
o “John runs”
o run(x) → RUN(John).
4. Methods in Semantic Analysis
1. Word Sense Disambiguation (WSD): Selecting correct sense of a word using context.
2. Semantic Role Labeling (SRL): Identifying roles like Agent, Theme, Instrument.
o Example: “Mary broke the window with a hammer.”
Agent: Mary, Theme: window, Instrument: hammer.
3. Named Entity Recognition (NER): Identifying people, places, organizations.
4. Coreference Resolution: Linking pronouns to antecedents (e.g., “John said he was tired” → he = John).
5. Question Answering & Inference: Using semantic structures to reason over text.
5. Evaluation of Method
Logic-based methods → precise but brittle, poor with ambiguity.
Frames & semantic networks → intuitive but hard to scale.
Distributional embeddings → powerful for large-scale NLP tasks, but lack explicit logical reasoning.
Hybrid methods (Neural + Symbolic) are increasingly used to combine strengths of both approaches.
4. Explore Word Sense Disambiguation (WSD) and its importance in NLP,
particularly in the context of information retrieval. Provide real-world examples.
Definition: WSD is the task of identifying the correct meaning (sense) of a word in a given context
when the word has multiple possible meanings.
Many words in natural language are polysemous (have multiple senses).
Example:
o “bank”
Sense 1: financial institution → “I deposited money in the bank.”
Sense 2: river bank → “We sat on the bank of the river.”
WSD allows NLP systems to correctly interpret such words depending on their surrounding context.
2. Approaches to WSD
1. Knowledge-based methods
o Use dictionaries, thesauri, or lexical databases (like WordNet).
o Example: Lesk algorithm (uses overlap between word definitions and context).
2. Supervised methods
o Treat WSD as a classification problem: train models on annotated corpora where word senses are
labeled.
3. Unsupervised methods
o Use clustering of contexts to group similar uses of a word.
4. Neural/Deep Learning methods
o Use embeddings (Word2Vec, BERT) to capture context-sensitive meaning.
o Example: BERT can distinguish between river bank and financial bank by looking at the
surrounding words.
3. Importance of WSD in NLP
Machine Translation: Avoids wrong word choice.
o Example: “pen” in “ink pen” vs “animal pen” should be translated differently.
Question Answering: Helps retrieve the correct answer by understanding query terms.
Text Summarization: Prevents ambiguous word usage in condensed text.
Dialogue Systems & Chatbots: Ensures system responds with correct interpretation.
4. WSD in Information Retrieval (IR)
In IR, user queries often contain ambiguous words. WSD improves retrieval by matching documents with the
intended sense of the query term.
Example 1: Searching with “java”
Query: “java programming tutorials” → Refers to programming language.
Query: “java island culture” → Refers to geographical location.
Query: “java coffee beans” → Refers to coffee.
➡️WSD ensures that search engines return relevant documents instead of mixing results from all meanings.
Example 2: Searching with “Apple”
Query: “Apple iPhone 15 price” → Refers to the tech company.
Query: “nutritional benefits of apple” → Refers to the fruit.
➡️Without WSD, search engines may show irrelevant results, reducing precision.
Example 3: Legal and Medical IR
In legal/medical databases, words often have domain-specific meanings.
Example: “charge”
o Legal sense: accusation (“The court dismissed the charge”).
o Electrical sense: physics (“The electron has a negative charge”).
➡️WSD ensures retrieval of domain-relevant results.
5. Evaluation of WSD
Performance measured against manually sense-tagged corpora (e.g., SemCor, Senseval datasets).
Metrics: Precision, Recall, F1-score.
5. Analyze the challenges associated with discourse, dialogue, and conversational
agents in pragmatic processing. How does NLP contribute to developing effective
conversational agents?
Pragmatic Processing in NLP
Pragmatics = understanding how language is used in context (beyond literal meaning).
In conversational agents (chatbots, virtual assistants), pragmatics ensures responses are:
o Contextually relevant
o Coherent across turns
o Aligned with user intent
2. Challenges in Discourse and Dialogue
Aspect Challenges Example
Identifying entities from pronouns or “I met John yesterday. He said he’s leaving.” → Who
Reference Resolution
context. is he?
Filling missing information in incomplete Q: “Want to grab coffee?” A: “Already did.” → Must
Ellipsis Handling
sentences. infer full meaning = “I already grabbed coffee.”
Maintaining logical flow across multiple
Coherence & Cohesion Chatbot shouldn’t abruptly change topic.
turns.
Remembering user’s previous queries, User: “Book me a flight.” → “Make it to Delhi, not
Context Tracking
intentions, and emotions. Mumbai.”
Words/phrases can have multiple meanings “Can you open the door?” → Is it a request or
Ambiguity in Language
(lexical, syntactic, pragmatic). question about ability?
Turn-taking & Handling overlaps, pauses, and deciding
Virtual assistant must not cut the user mid-sentence.
Interruptions when agent should speak.
Politeness & Generating responses that match tone, Saying “Shut the window” vs. “Could you please close
Pragmatic Nuances politeness, and formality. the window?”
Aspect Challenges Example
Adjusting style and knowledge to specific A health bot must interpret “I feel blue” as sadness,
Domain Adaptation
domains (medical, legal, casual). not color.
3. Challenges in Conversational Agents
1. Understanding Intent:
o Same query may have different intents.
o Example: “Can you play music?” → Request vs. asking ability.
2. Long-Term Memory:
o Difficulty in remembering facts across long conversations.
3. Error Handling:
o Misrecognition in speech input → chatbot must gracefully recover.
4. Multimodal Context:
o Handling gestures, tone, facial expressions (beyond text).
5. Human-Like Dialogue:
o Generating natural, engaging, non-repetitive responses.
4. How NLP Contributes to Effective Conversational Agents
1. Discourse Analysis
o Identifies coherence relations (cause-effect, contrast, elaboration).
2. Dialogue Management
o Uses Finite State Machines, Reinforcement Learning, or Neural Dialogue Managers to
decide the next action/response.
3. Coreference Resolution
o NLP models track entities across dialogue to maintain consistency.
4. Word Sense Disambiguation (WSD)
o Resolves ambiguous terms based on context.
5. Language Models (LMs)
o Transformers (BERT, GPT, etc.) capture contextual meaning and generate fluent, context-aware
responses.
6. Sentiment & Emotion Analysis
o Detects user emotions → adapts chatbot tone (empathetic, professional, casual).
7. Pragmatic & Politeness Models
o NLP ensures responses respect social conventions (politeness, formality).
8. Knowledge Integration
o NLP allows agents to link with external knowledge bases (Wikipedia, company FAQs, APIs) for
factually accurate answers.
6. Discuss the process of natural language generation in the context of pragmatics,
highlighting its applications and challenges.
Definition: NLG is the task of automatically generating coherent, meaningful, and contextually
appropriate text from structured data or internal representations.
In pragmatics, the focus is not just on what to say, but also on how to say it—tone, politeness, context-
awareness, and user intention matter.
2. Steps in the NLG Process (with Pragmatic Focus)
Step Description Pragmatic Role
1. Content Choosing information relevant to the user’s
Decide what information to include in the output.
Determination context and goals.
Organize content into a logical structure (ordering, Ensures coherence across sentences (discourse-
2. Document Planning
grouping). level pragmatics).
Decide sentence structure, lexical choices, and Selecting polite vs. direct wording, avoiding
3. Sentence Planning
referring expressions. ambiguity.
Convert abstract representation into
4. Surface Realization Ensures fluent, natural, human-like responses.
grammatically correct text.
5. Pragmatic Example: formal (“Please provide ID”) vs. casual
Adjust style, tone, and formality.
Adaptation (“Got your ID?”).
3. Applications of NLG with Pragmatic Considerations
1. Conversational Agents (Chatbots, Virtual Assistants)
o Must generate polite, context-aware, human-like replies.
o Example: Alexa adapting to “Turn off the light” vs. “Could you please turn off the light?”.
2. Customer Service Automation
o Automatically generating empathetic responses for complaints.
3. Healthcare
o Summarizing patient data into reports with sensitivity (tone matters for patients).
4. Data-to-Text Generation
o Weather reports, financial summaries → must adapt to audience (general public vs. experts).
5. Educational Systems
o Intelligent tutors generate explanations matching student’s understanding level.
4. Challenges in Pragmatic NLG
1. Context Sensitivity
o Difficult to track long dialogue context (who said what, when).
2. Ambiguity & Vagueness
o Generated text may confuse if referents are unclear.
o Example: “It is ready” → What is “it”?
3. Politeness and Tone Adaptation
o NLG must adapt tone to situation (customer support vs. casual chat).
4. Coherence Across Turns
o Maintaining topic consistency in multi-turn dialogues.
5. Cultural and Social Nuances
o Same phrasing may be polite in one culture, rude in another.
6. Evaluation Difficulty
o Hard to measure pragmatically “good” responses. BLEU/ROUGE may not capture politeness or
appropriateness.
5. Example: Pragmatic NLG in Action
User: “I’m really upset about my order being late.”
Bad NLG: “Your order is delayed. We apologize.” (Too cold)
Good Pragmatic NLG: “I’m really sorry to hear that your order is late. Let me check its status right
away for you.” (Empathetic, context-aware)
7. Examine the role of machine translation in pragmatic language processing,
considering the advancements and limitations of current approaches.
Machine Translation (MT): Automatic conversion of text from one language to another (e.g., English
→ Hindi).
In pragmatic language processing, MT must go beyond literal translation:
o Capture context, intent, tone, and cultural nuances.
Example:
o Literal: “Can you pass the salt?” → ability question.
o Pragmatic: It’s actually a request → “Please pass the salt.”
2. Role of MT in Pragmatic Processing
1. Preserving Context and Meaning
o MT must understand discourse-level context to avoid mistranslation.
o Example: “He went to the bank.” → decide financial vs river bank.
2. Politeness and Formality
o Different languages have varying politeness systems.
o Example: Japanese distinguishes formal vs. informal “you” → MT must adapt tone appropriately.
3. Idioms and Cultural Expressions
o Pragmatic MT requires idiomatic translation.
o Example: English “kick the bucket” → Hindi “मर गया” (died), not literal “बाल्टी को लात
मारना”.
4. Dialogue and Conversational Translation
o In chatbots or live conversation, MT must maintain coherence across turns.
5. Domain-Specific Adaptation
o Legal, medical, and business translations need pragmatic precision.
o Example: “charge” in law vs physics.
3. Advancements in Current MT Approaches
1. Statistical Machine Translation (SMT)
o Uses probability of word/phrase alignments.
o Handles common word choices well but struggles with context.
2. Neural Machine Translation (NMT)
o Uses deep learning models (RNNs, Transformers, BERT, GPT-based).
o Captures long-range context, handles word order better.
o Example: Google Translate and DeepL.
3. Context-Aware and Pragmatic Models
o Transformer-based models (e.g., mBERT, XLM-R, GPT-4) consider sentence context and
generate more natural translations.
4. Multilingual Pre-trained Models
o Transfer learning across languages improves pragmatic handling in low-resource languages.
4. Limitations of Current MT
1. Pragmatic Ambiguity
o Struggles with indirect speech acts, sarcasm, or humor.
o Example: “Yeah, right!” → sarcasm vs agreement.
2. Politeness & Tone
o MT often fails to adapt tone.
o Example: Translating English “you” into Hindi → should be “tum” (informal) or “aap” (formal).
3. Idiomatic & Cultural Expressions
o Literal translations of proverbs/idioms cause loss of meaning.
4. Discourse-Level Coherence
o Many MT systems translate sentence by sentence without tracking entire
conversation/document.
5. Bias & Errors in Low-Resource Languages
o NMT works best for high-resource languages (English, Spanish, Chinese), but weaker for African
or indigenous languages.
5. Real-World Applications
Global Communication: Google Translate, DeepL for travel, education, cross-cultural interaction.
Business & Customer Support: Multilingual chatbots that handle global customers.
Healthcare: Translating patient reports or doctor instructions pragmatically.
Legal/Official Documents: Requires high pragmatic accuracy to avoid misinterpretation.
8. What is semantic parsing in the context of natural language processing (NLP)?
Semantic Parsing = The process of converting natural language (NL) sentences into formal meaning
representations (logical forms, database queries, or structured data) that machines can execute or reason
with.
It goes beyond syntax (grammar) → focuses on meaning.
2. How It Works
Input: Natural language sentence
Output: Formal representation (logical form, SQL query, knowledge graph entry, lambda calculus
expression, etc.)
Example 1 (Database Query):
NL: “Show me all flights from Delhi to Mumbai tomorrow.”
Semantic parse:
SELECT * FROM flights
WHERE source = 'Delhi' AND destination = 'Mumbai' AND date = '2025-09-13';
Example 2 (Logic Form):
Parse: ∀x (Student(x) → Passed(x, Exam))
NL: “Every student passed the exam.”
3. Role in NLP
Bridges human language and machine-interpretable representations.
Enables NLP systems to perform reasoning, answer questions, and interact with structured data
sources.
4. Applications
1. Question Answering (QA)
o User: “Who is the president of France?”
o Semantic parse → Query knowledge base → Answer: Emmanuel Macron.
2. Task-Oriented Dialogue Systems
o User: “Book me a table for two at 7 PM.”
o Parse → Formal action: BOOK_RESTAURANT(time=7pm, people=2).
3. Information Extraction
o Convert text into structured knowledge (facts, relations).
4. Virtual Assistants
o Siri, Alexa, Google Assistant use semantic parsing to execute commands.
5. Challenges
Ambiguity: Multiple possible meanings.
o Example: “Book the flight” → reserve a flight OR read a book about flights.
Context-dependence: Must consider prior dialogue turns.
Domain adaptation: Hard to generalize across different fields (medical vs travel).
Complex sentences: Nested clauses or indirect requests are difficult.
9. Discuss the methods used in word sense disambiguation.?
Definition: Word Sense Disambiguation (WSD) is the task of determining the correct meaning (sense)
of a word in a given context when the word is ambiguous.
Example:
o “I went to the bank to deposit money.” → financial institution
o “He sat on the bank of the river.” → riverside
2. Methods of WSD
A. Knowledge-Based Methods
Use external lexical resources like dictionaries, thesauri, or WordNet.
Main techniques:
1. Lesk Algorithm
Chooses the sense with the maximum overlap between dictionary definitions and context
words.
Example: “bank” in “money” context → matches with financial institution sense.
2. Semantic Similarity
Pick sense that is most semantically similar to surrounding words.
3. Selectional Restrictions
Restrict senses based on context (e.g., “eat an apple” → apple = fruit, not company).
B. Supervised Methods
Treat WSD as a classification problem.
Requires labeled training data (corpus with words tagged by senses).
Approaches:
1. Naïve Bayes, Decision Trees, SVMs → use context words as features.
2. Neural Networks (Deep Learning) → learn context-sensitive representations.
Example: Train on sentences where “bank” is tagged → classifier learns to disambiguate.
C. Unsupervised Methods
No labeled data; rely on clustering word occurrences in large corpora.
Idea: contexts of the same sense will cluster together.
Approaches:
1. Context Clustering: Group similar word contexts.
2. Co-occurrence Graphs: Build graph of word relations and cluster them.
Example: “bank” contexts split into financial cluster vs. river cluster.
D. Semi-Supervised / Bootstrapping
Start with small labeled data, then expand training using unlabeled data.
Example: Use a few tagged “bank” sentences → find similar sentences automatically.
E. Modern Neural/Contextual Embedding Methods
Use word embeddings (Word2Vec, GloVe) or transformers (BERT, GPT, mBERT).
Contextual embeddings represent different senses of a word depending on sentence context.
Example: BERT encodes “bank” differently in “money” vs. “river” context.
3. Evaluation of WSD Methods
Benchmarked on datasets like Senseval, SemEval.
Metrics: Precision, Recall, F1-score, Accuracy.
[Link] and Explain semantic parsing [Link] is Latent Semantic Indexing
(LSI)? What is the use of this technique?
Semantic Parsing = the process of converting natural language (NL) into a machine-interpretable meaning
representation (MR) such as logic forms, SQL queries, or knowledge graph triples.
Approaches:
A. Rule-Based Approaches
How it works: Hand-crafted grammar rules + lexicons map natural language to meaning.
Example:
o Input: “Show me flights from Delhi to London”
o Rule: “Show me X from Y to Z” → SQL query
Pros: High precision, interpretable.
Cons: Not scalable (requires domain experts, brittle).
B. Statistical Approaches
How it works: Learn mappings from NL → MR using probabilistic models.
Techniques: Hidden Markov Models (HMM), Probabilistic Context-Free Grammar (PCFG).
Example: Assign probability to different parse trees and choose the most likely.
Pros: Can handle variations, data-driven.
Cons: Requires large annotated corpora, limited expressiveness.
C. Supervised Learning Approaches
How it works: Treat parsing as a supervised ML problem.
Techniques: Decision Trees, SVMs, CRFs, Neural Networks.
Example: Train on paired NL sentences and their SQL/logical forms.
Pros: High accuracy when labeled data is available.
Cons: Annotation cost is high.
D. Unsupervised/Semi-Supervised Approaches
How it works: Use unlabeled data or partially labeled data to induce structures.
Techniques: Bootstrapping, clustering, grammar induction.
Pros: Reduces reliance on costly labeled datasets.
Cons: Less accurate, harder to evaluate.
E. Neural/Deep Learning Approaches
How it works: Encode NL sentence using embeddings (RNN, LSTM, Transformer) → decode into
logical form.
Example: Seq2Seq with attention or Transformers (e.g., BERT, T5).
Pros: State-of-the-art, handles context, generalizes well.
Cons: Requires huge data and compute, black-box models.
F. Grammar-Based Neural Approaches
Hybrid models: Combine neural networks with symbolic grammar constraints to preserve structure (e.g.,
Neural Semantic Parsing with Grammar Induction).
2. Latent Semantic Indexing (LSI)
Definition
LSI (also called Latent Semantic Analysis, LSA) is a technique in information retrieval (IR) and NLP
that uncovers hidden (latent) relationships between words and documents.
Based on the idea that words with similar meanings occur in similar contexts.
How LSI Works
1. Construct term-document matrix (rows = terms, columns = documents).
2. Apply Singular Value Decomposition (SVD) → decomposes the matrix into three smaller matrices.
3. Reduce dimensions → capture the most important “concepts” (latent semantics).
4. Represent words and documents in this reduced semantic space.
Uses of LSI
1. Information Retrieval: Improves search by retrieving documents with similar meaning, not just
matching keywords.
o Example: Query “car” retrieves docs with “automobile.”
2. Document Clustering & Classification: Group documents by topic.
3. Synonym Detection: Identify semantically related words.
4. Recommender Systems: Suggest related documents/items.