0% found this document useful (0 votes)
29 views8 pages

NLP CH 1

Natural Language Processing (NLP) is a subfield of AI focused on enabling machines to understand and respond to human language. It encompasses various tasks such as tokenization, sentiment analysis, and machine translation, and involves techniques like rule-based methods and deep learning. NLP faces challenges like ambiguity and context understanding, which are crucial for applications such as chatbots, translation tools, and sentiment analysis.

Uploaded by

mhatredeep27
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views8 pages

NLP CH 1

Natural Language Processing (NLP) is a subfield of AI focused on enabling machines to understand and respond to human language. It encompasses various tasks such as tokenization, sentiment analysis, and machine translation, and involves techniques like rule-based methods and deep learning. NLP faces challenges like ambiguity and context understanding, which are crucial for applications such as chatbots, translation tools, and sentiment analysis.

Uploaded by

mhatredeep27
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

1. Explain NLP in detail.

ANS: Natural Language Processing (NLP) is a subfield of artificial intelligence (AI) and linguistics that
focuses on enabling machines to understand, interpret, generate, and respond to human language in a
meaningful way.

Definition

NLP (Natural Language Processing) is the technology used to help computers understand, analyze, and
generate human (natural) languages such as English, Hindi, or any other spoken/written language.

Goals of NLP:

1. Understand human language input (speech or text)


2. Interpret the context and meaning
3. Respond appropriately in human language
4. Translate between languages (e.g., English to Hindi)
5. Summarize, classify, extract information from text

Main Tasks in NLP:

Task Description
Tokenization Splitting text into words or sentences.
Part-of-Speech (POS) Tagging Identifying nouns, verbs, adjectives, etc.
Named Entity Recognition (NER) Detecting proper names, dates, locations, etc.
Parsing Analysing grammatical structure (syntax).
Lemmatization/Stemming Reducing words to their root forms.
Sentiment Analysis Detecting emotion or attitude (positive, negative, neutral).
Machine Translation Translating one language into another (e.g., Google Translate).
Text Classification Categorizing text into predefined labels (e.g., spam or not spam).
Speech Recognition Converting spoken language into text (used in virtual assistants).
Question Answering Responding to questions based on text or a database.

Levels of NLP:

1. Phonology – Understanding sounds of words.


2. Morphology – Understanding the structure of words.
3. Syntax – Grammatical structure of sentences.
4. Semantics – Meaning of words and sentences.
5. Pragmatics – Understanding context, tone, and implied meanings.
6. Discourse – Understanding how previous sentences affect the current one.

Applications of NLP:

Application Examples
Chatbots & Virtual Assistants Siri, Alexa, Google Assistant
Translation Tools Google Translate, DeepL
Search Engines Google’s auto-suggestions and result ranking
Application Examples
Email Filtering Spam detection, categorization
Social Media Monitoring Sentiment analysis of tweets, brand tracking
Text Summarization Tools to shorten long documents while retaining key info
Medical NLP Extracting information from clinical reports or research papers

Techniques Used in NLP:

1. Rule-Based Methods

• Linguistic rules are written by experts.


• Example: Regular expressions to extract email addresses.

2. Machine Learning-Based Methods

• Uses statistical models trained on large datasets.


• Examples: Naive Bayes, Decision Trees, SVM.

3. Deep Learning-Based Methods

• Uses neural networks like RNN, LSTM, Transformers (e.g., BERT, GPT).
• Handles context and meaning more accurately.

Challenges in NLP:

Challenge Why it’s difficult


Words or sentences can have multiple meanings (e.g., “bank” – river or
Ambiguity
financial).
Sarcasm & Irony Hard to detect using just text.
Language Variety Dialects, slang, and informal expressions.
Contextual
Requires knowledge beyond the words (world knowledge).
Understanding
Multilingual Processing Supporting many languages and scripts.

Example: Sentiment Analysis

Input:
"I loved the movie. It was fantastic!"

Process:

1. Tokenize sentence.
2. Identify emotion words like "loved", "fantastic".
3. Use a model to classify the overall sentiment as positive.
2. Explain different application of NLP

ANS:1. Machine Translation

Goal: Convert text from one language to another.

Examples:

• Google Translate
• Microsoft Translator
• DeepL
NLP Techniques Used:
• Tokenization
• Language modeling
• Neural machine translation using models like Transformer, BERT, or GPT
2. Chatbots and Virtual Assistants
Goal: Enable computers to interact with users via natural language.
Examples:
• Siri, Alexa, Google Assistant
• Customer support bots on websites
• WhatsApp or Facebook Messenger bots NLP Tasks Involved:
• Speech recognition (for voice)
• Intent recognition (understanding what the user wants)
• Entity recognition (e.g., date, location)
• Dialogue management
Benefits:
• 24x7 customer service
• Reduces human workload
• Instant responses
3. Sentiment Analysis
Goal: Identify emotions (positive, negative, neutral) from text.
Examples:
• Analyzing product reviews on Amazon
• Monitoring social media opinions (e.g., Twitter)
• Stock market mood analysis
NLP Tasks Used:
• Text preprocessing (removing stopwords, stemming)
• Feature extraction (TF-IDF, word embeddings)
• Classification using ML or deep learning
Use Cases:
• Brand monitoring
• Political sentiment tracking
• Customer satisfaction analysis
4. Information Extraction
Goal: Automatically extract structured information from unstructured text.
Examples:
• Extracting patient info from medical reports
• Extracting company names from news articles
Applications:
• Legal document analysis
• Journalism and news curation
• Fraud detection in finance
5. Text Summarization
Goal: Reduce long documents to a short, informative summary.
Types:
• Extractive Summarization: Pulls key sentences.
• Abstractive Summarization: Rewrites text to create new summaries.
Applications:
• News article summaries (e.g., Inshorts)
• Legal or scientific document compression
• Meeting note generation
6. Text Classification
Goal: Automatically assign categories to text data.
Examples:
• Email spam detection
• News topic categorization
• Document tagging
Applications:
• Content moderation on social media
• Email filtering
• Organizing large document datasets
7. Speech Recognition & Voice Assistants
Goal: Convert spoken language to text and understand it.
Examples:
• Google Dictation
• Transcription services (Otter.ai)
• Virtual meeting captions (Zoom, Google Meet)
8. Question Answering (QA)
Goal: Answer a question based on a text or database.
Examples:
• Google Search snippets
• Quora bots
• AI systems like ChatGPT answering user questions
9. Autocorrect and Autocomplete
Goal: Predict or correct what the user types.
Examples:
• Google Search autocomplete
• Text editors (MS Word) grammar suggestions
• Smartphones’ predictive text
10. Plagiarism Detection
Goal: Check if a text is copied or rephrased from other sources.
Examples:
• Turnitin
• Grammarly plagiarism checker
Techniques:
• Semantic similarity
• N-gram comparison
• Paraphrase detection
11. Healthcare and Medical NLP
Goal: Extract insights from clinical text or health records.
Applications:
• Analyzing doctor’s notes
• Medical coding (ICD classification)
• Drug interaction analysis
• Radiology report summarization
12. Legal Document Analysis
Goal: Make legal texts easier to process and understand.
Use Cases:
• Contract review
• Legal research
• Case prediction using past court decisions

3. Explain Stages of NLP

ANS : 1. Lexical and Morphological Analysis


Lexical Analysis
It focuses on identifying and processing words (or lexemes) in a text. It breaks down the input text into
individual tokens that are meaningful units of language such as words or phrases.
Key tasks in Lexical analysis:
1. Tokenization: Process of dividing a text into smaller chunks called tokens. For example the sentence
"I love programming" would be tokenized into ["I", "love", "programming"].
2. Part-of-Speech Tagging: Assigning parts of speech such as noun, verb, adjective to each token in the
sentence. This helps us to understand grammatical roles of words in the context.
Example: Consider the sentence: "I am reading a book."
• Tokenization: Sentence is broken down into individual tokens or words: ["I", "am", "reading", "a",
"book"]
• Part-of-Speech Tagging: Each token is assigned a part of speech: ["I" → Pronoun (PRP), "am" →
Verb (VBP), "reading" → Verb (VBG), "a" → Article (DT), "book" → Noun (NN)]
Morphological Analysis
It deals with morphemes which are the smallest units of meaning in a word. It is important for
understanding structure of words and their parts by identifying free morphemes (independent words like
"cat") and bound morphemes (like prefixes or suffixes e.g. "un-" or "-ing").
Key tasks in morphological analysis:
1. Stemming: Reducing words to their root form like "running" to "run".
2. Lemmatization: Converting words to their base or dictionary form considering the context like
"better" becomes "good".

2. Syntactic Analysis (Parsing)


Syntactic Analysis helps in understanding how words in a sentence are arranged according to grammar
rules. It ensures that the sentence follows correct grammar which makes the meaning clearer. The goal is to
create a parse tree which is a diagram showing the structure of sentence. It breaks the sentence into parts
like the subject, verb and object and shows how these parts are connected. This helps machines understand
the relationships between words in the sentence.
Key components of syntactic analysis include:
• POS Tagging: Assigning parts of speech (noun, verb, adjective) to words in a sentence as discussed
earlier.
• Ambiguity Resolution: Handling words that have multiple meanings (e.g "book" can be a noun or a
verb).
Examples
Consider the following sentences:
• Correct Syntax: "John eats an apple."
• Incorrect Syntax: "Apple eats John an."

3. Semantic Analysis
Semantic Analysis focuses on understanding meaning behind words and sentences. It ensures that the text
is not only grammatically correct but also logically coherent and contextually relevant. It aims to understand
dictionary definitions of words and their usage in context and also find whether the arrangement of words
in a sentence makes logical sense.
Key Tasks in Semantic Analysis
1. Named Entity Recognition (NER): It identifies and classifies entities such as names of people,
locations, organizations, dates and more. These entities provide important meaning in the text and help
in understanding the context. For example in the sentence "Tesla announced its new electric vehicle in
California," NER would identify "Tesla" as an organization and "California" as a location.
2. Word Sense Disambiguation (WSD): Many words have multiple meanings depending on the context
in which they are used. It identifies the correct meaning of a word based on its surrounding text. For
example word "bank" can refer to a financial institution or the side of a river. It uses context to identify
which meaning applies in a given sentence which ensures that interpretation is accurate.
Example of Semantic Analysis
"Apple eats a John." while grammatically correct this sentence doesn’t make sense semantically because an
apple cannot "eat" a person. Semantic analysis ensures that the meaning is logically sound and contextually
appropriate. It is important for various NLP applications including machine translation, information
retrieval and question answering.

4. Discourse Integration
It is the process of understanding how individual sentences or segments of text connect and relate to each
other within a broader context. This phase ensures that the meaning of a text is consistent and coherent
across multiple sentences or paragraphs. It is important for understanding long or complex texts where
meaning focuses on previous statements.
Key aspects of discourse integration:
• Anaphora Resolution: Anaphora refers to the use of pronouns or other references that depend on
earlier parts of the text. For example in the sentence "Taylor went to the store. She bought groceries"
pronoun "She" refers back to "Taylor." It ensures that references like these are correctly understood by
linking them to their antecedents.
• Contextual References: Many words or phrases can only be fully understood when considered in the
context of following sentences. It helps in interpreting how certain words or phrases focuses on context.
For example "It was a great day" is clearer when you know what event or situation is being discussed.
Example of Discourse Integration
1. "Taylor went to the store to buy some groceries. She realized she forgot her wallet." Understanding
that "Taylor" is the antecedent of "she" is important for understanding sentence's meaning.
5. Pragmatic Analysis
Pragmatic analysis helps in understanding the deeper meaning behind words and sentences by looking
beyond their literal meanings. While semantic analysis looks at the direct meaning it considers the speaker's
or writer's intentions, tone and context of the communication.
Key tasks in pragmatic analysis:
• Understanding Intentions: Sometimes language doesn’t mean what it says literally. For example
when someone asks "Can you pass the salt?" it's not about ability but a polite request. It helps to
understand true intention behind such expressions.
• Figurative Meaning: Language often uses idioms or metaphors that can’t be taken literally.
Examples of Pragmatic Analysis
• "Hello! What time is it?" here it might be a straightforward request for the current time but it could
also imply concern about being late.

4. Explain ambiguity and its Type in detail

ANS: Ambiguity in Natural Language Processing (NLP) happens because human language can have
multiple meanings. Computers sometimes confuse to understand exactly what we mean unlike humans,
who can use intuition and background knowledge to infer meaning, computers rely on precise algorithms
and statistical patterns.
Dual meaning arises from the structure of the sentence, which does not clarify the subject's role (the eater
or the one being eaten). Resolving such ambiguities is essential for accurate NLP applications like chatbots,
translation, and sentiment analysis.
This article explores types of ambiguity in NLP and methods to address them effectively.
Types of Ambiguity in NLP
The meaning of an ambiguous expression often depends on the situation, prior knowledge, or surrounding
words. For example: He is cool. This could mean he is calm under pressure or he is
fashionable depending on the context.

1. Lexical Ambiguity
Lexical ambiguity occurs when a single word has multiple meanings, making it unclear which meaning is
intended in a particular context. This is a common challenge in language.
For example, the word "bat" can have two different meanings. It could refer to a flying mammal; like the
kind you might see at night. Alternatively, "bat" could also refer to a piece of sports equipment used in
games like baseball or cricket.
For computers, determining the correct meaning of such a word requires looking at the surrounding context
to decide which interpretation makes sense.

2. Syntactic Ambiguity
Syntactic ambiguity occurs when the structure or grammar of a sentence allows for more than one
interpretation. This happens because the sentence can be understood in different ways depending on how it
is put together.
For example, take the sentence, “The boy kicked the ball in his jeans.” This sentence can be interpreted
in two different ways: one possibility is that the boy was wearing jeans and he kicked the ball while he
was wearing them. Another possibility is that the ball was inside the boy’s jeans, and he kicked the ball
out of his jeans.
A computer or NLP system must carefully analyze the structure to figure out which interpretation is correct,
based on the context.
3. Semantic Ambiguity
Semantic ambiguity occurs when a sentence has more than one possible meaning because of how the words
are combined. This type of ambiguity makes it unclear what the sentence is truly trying to say.
For example, take the sentence, “Visiting relatives can be annoying.” This sentence could be understood
in two different ways. One meaning could be that relatives who are visiting you are annoying, implying
that the relatives themselves cause annoyance. Another meaning could be that the act of visiting relatives
is what is annoying, suggesting that the experience of going to see relatives is unpleasant.
The confusion comes from how the words "visiting relatives" can be interpreted: is it about the relatives
who are visiting, or is it about the action of visiting? In cases like this, semantic ambiguity makes it hard to
immediately understand the exact meaning of the sentence, and the context is needed to clarify it.

4. Pragmatic Ambiguity
Pragmatic ambiguity occurs when the meaning of a sentence depends on the speaker’s intent, tone, or
the situation in which it is said. This type of ambiguity is common in everyday conversations, and it can be
tricky for computers to understand because it often requires knowing the broader context.
For example, consider the sentence, “Can you open the window?” In one situation, it could be understood
as a literal question asking if the person is physically able to open the window. However, in another context,
it could be a polite request, where the speaker is asking the listener to open the window, even though
they’re not directly giving an order.
The meaning changes based on the tone of voice or social context, which is something that is difficult for
NLP systems to capture without understanding the surrounding situation

5. Referential Ambiguity
Referential ambiguity occurs when a pronoun (like "he," "she," "it," or "they") or a phrase is unclear about
what or who it is referring to. This type of ambiguity happens when the sentence doesn’t provide enough
information to determine which person, object, or idea the pronoun is referring to.
For example, consider the sentence, “Alice told Jane that she would win the prize.” In this case, it’s
unclear whether the pronoun "she" refers to Alice or Jane. Both could be possible interpretations, and
without further context, we can’t be sure. If the sentence was about a competition, "she" could be referring
to Alice, meaning Alice is telling Jane that she would win the prize. However, it could also mean that Alice
is telling Jane that Jane would win the prize.

6. Ellipsis Ambiguity
Ellipsis ambiguity happens when part of a sentence is left out, making it unclear what the missing
information is. This often occurs in everyday conversation or writing when people try to be brief and omit
words that are understood from the context.
For example, consider the sentence, "John likes apples, and Mary does too." The word "does" is a
shortened form of "likes apples," but it’s not explicitly stated. This creates two possible interpretations:
1. Mary likes apples just like John, meaning both John and Mary enjoy apples.

You might also like