0% found this document useful (0 votes)
5 views18 pages

NLP Notes Unit I

The document provides an overview of Natural Language Processing (NLP), detailing its applications, benefits, and various use cases such as search engines, chatbots, and sentiment analysis. It explains different levels of language analysis including phonological, morphological, and semantic, which help machines interpret human language. Additionally, it discusses the significance of NLP in enhancing customer service, automating processes, and improving data analytics.

Uploaded by

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

NLP Notes Unit I

The document provides an overview of Natural Language Processing (NLP), detailing its applications, benefits, and various use cases such as search engines, chatbots, and sentiment analysis. It explains different levels of language analysis including phonological, morphological, and semantic, which help machines interpret human language. Additionally, it discusses the significance of NLP in enhancing customer service, automating processes, and improving data analytics.

Uploaded by

Ramdas Kapila
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Unit I: Introduction to Natural Language Processing

The study of Language, Applications of NLP, Evaluating Language


Understanding Systems, Different levels of Language Analysis, NLP
Phases, Difficulty of NLP including ambiguity; Detecting and Correcting
Spelling Errors and Noisy Channel Model; Minimum Edit Distance, Formal
Grammar of Natural Grammar of English.

Some of the top benefits of NLP include:

 Being able to perform large-scale data analytics

 Cost reduction and streamlining of various processes (otherwise


performed by humans)

 Increasing customer satisfaction

 In-depth marketing understanding

Let’s look at some of the most common use cases, starting with online
search capabilities:

Search Engine Results

An example of NLP in action is search engine functionality. Search engines


leverage NLP to suggest relevant results based on previous search history
behavior and user intent.

When using Google, for example, the search engine predicts what you will
continue typing based on popular searches, while also looking at the
context and recognizing the meaning behind what you want to say (as
opposed to the literal words being typed). It might feel like your thought is
being finished before you get the chance to finish typing.

This could look like putting in a math equation and having a calculator
come up, or even typing a flight number and receiving the flight status
breakdown.
Google Search of 'What is NLP?'

Smart Search and Predictive Text

Features like autocorrect, autocomplete, and predictive text are so


embedded in social media platforms and applications that we often forget
they exist. Autocomplete and predictive text predict what you might say
based on what you've typed, finish your words, and even suggest more
relevant ones, similar to search engine results.

Autocorrect can even change words based on typos so that the overall
sentence's meaning makes sense. These functionalities have the ability to
learn and change based on your behavior. For example, over time
predictive text will learn your personal jargon and customize itself.

Language Translation

One of the most common NLP examples is translation. In the 1950s,


Georgetown and IBM presented the first NLP-based translation machine,
which had the ability to translate 60 Russian sentences to English
automatically.
Translation applications available today use NLP and Machine Learning to
accurately translate both text and voice formats for most global
languages.

Survey Analytics

Data analysis has come a long way in interpreting survey results, although
the final challenge is making sense of open-ended responses
and unstructured text. NLP, with the support of other AI disciplines, is
working towards making these advanced analyses possible.

Thanks to NLP, you can analyse your survey responses accurately and
effectively without needing to invest human resources in this process.

SpaCy and Gensim are examples of code-based libraries that are


simplifying the process of drawing insights from raw text.

Semantic Search

An NLP customer service-oriented example would be using semantic


search to improve customer experience. Semantic search is a search
method that understands the context of a search query and suggests
appropriate responses.

For example, if you're on an eCommerce website and search for a specific


product description, the semantic search engine will understand your
intent and show you other products that you might be looking for.

There are many eCommerce websites and online retailers that leverage
NLP-powered semantic search engines. They aim to understand the
shopper's intent when searching for long-tail keywords (e.g. women's
straight leg denim size 4) and improve product visibility.

On average, retailers with a semantic search bar experience a 2% cart


abandonment rate, which is significantly lower than the 40% rate found on
websites with a non-semantic search bar.

Sentiment Analysis
Oftentimes, when businesses need help understanding their customer
needs, they turn to sentiment analysis.

Sentiment analysis (also known as opinion mining) is an NLP strategy that


can determine whether the meaning behind data is positive, negative, or
neutral. For instance, if an unhappy client sends an email which mentions
the terms “error” and “not worth the price”, then their opinion would be
automatically tagged as one with negative sentiment.

Example of sentiment analysis workflow in Levity

By performing sentiment analysis, companies can better understand


textual data and monitor brand and product feedback in a systematic
way.

Let’s look at an example of NLP in advertising to better illustrate just how


powerful it can be for business. If a marketing team leveraged findings
from their sentiment analysis to create more user-centered campaigns,
they could filter positive customer opinions to know which advantages are
worth focussing on in any upcoming ad campaigns.
Sentiment Analysis is also widely used on Social Listening processes, on
platforms such as Twitter. This helps organisations discover what the
brand image of their company really looks like through analysis the
sentiment of their users’ feedback on social media platforms.

Autocomplete & Autocorrect

The saviors for students and professionals alike – autocomplete and


autocorrect – are prime NLP application examples. Autocomplete (or
sentence completion) integrates NLP with specific Machine learning
algorithms to predict what words or sentences will come next, in an effort
to complete the meaning of the text.

NPL cross-checks text to a list of words in the dictionary (used as a


training set) and then identifies any spelling errors. The misspelled word is
then added to a Machine Learning algorithm that conducts calculations
and adds, removes, or replaces letters from the word, before matching it
to a word that fits the overall sentence meaning. Then, the user has the
option to correct the word automatically, or manually through spell check.

Spellcheck

Wondering what are the best NLP usage examples that apply to your life?
Spellcheck is one of many, and it is so common today that it's often taken
for granted. This feature essentially notifies the user of any spelling errors
they have made, for example, when setting a delivery address for an
online order.

From a corporate perspective, spellcheck helps to filter out any inaccurate


information in databases by removing typo variations.

Email Filters

Email filters are common NLP examples you can find online across most
servers.

Spam filters are where it all started – they uncovered patterns of words or
phrases that were linked to spam messages. Since then, filters have been
continuously upgraded to cover more use cases.
Email Classification

An NLP case study we can look at is Gmail's new classification system.


This upgraded system categorizes emails into one of three groups
(primary, social, or promotions) based on the email content. This is a
convenient application of NLP that keeps Gmail users' inboxes under
control while highlighting relevant and high-priority emails.

Levity offers its own version of email classification through using NLP. This
way, you can set up custom tags for your inbox and every incoming email
that meets the set requirements will be sent through the correct route
depending on its content.

Chatbots

Chatbots are an NLP customer service application example. They are


beneficial for eCommerce store owners in that they allow customers to
receive fast, on-demand responses to their inquiries. This is important,
particularly for smaller companies that don't have the resources to
dedicate a full-time customer support agent.
Statista reports on a study from 2019, which mentioned that 65% of
decision-makers in customer service believed that chatbots could
understand customers' context well. What’s more, another 52% believed
that chatbots could take a step further, and automate decision-making
based on customer responses!

Among others, chatbots can be used to:

 Respond to pre-determined FAQs

 Schedule meetings and appointments

 Book tickets

 Process and track orders

 Cross and upsell

 Onboard new users or members

Smart Assistants

Smart assistants such as Google's Alexa use voice recognition to


understand everyday phrases and inquiries.

They then use a subfield of NLP called natural language generation (to be
discussed later) to respond to queries. As NLP evolves, smart assistants
are now being trained to provide more than just one-way answers. They
are capable of being shopping assistants that can finalize and even
process order payments.

Siri, Alexa, or Google Assistant?

In the Western market, smart assistant household names include Apple's


Siri, Amazon's Alexa, and Google Assistant. In Asia, Alibaba's Tmall is the
current leader.

In terms of NLP capabilities, these smart assistants:

 Are able to create and edit shopping lists in online stores


 Can understand nuance (for example, the smart assistant will know
what shopping list to add the item to)

 Can finalize purchases simply by hearing a single sentence.

These devices are trained by their owners and learn more as time
progresses to provide even better and specialized assistance, much like
other applications of NLP.

Social Media Monitoring

To better understand the applications of this technology for businesses,


let's look at an NLP example.

Owners of larger social media accounts know how easy it is to be


bombarded with hundreds of comments on a single post. It can be hard to
understand the consensus and overall reaction to your posts without
spending hours analyzing the comment section one by one.

Social media monitoring uses NLP to filter the overwhelming number of


comments and queries that companies might receive under a given post,
or even across all social channels. These monitoring tools leverage the
previously discussed sentiment analysis and spot emotions like irritation,
frustration, happiness, or satisfaction.

The tools will notify you of any patterns and trends, for example, a
glowing review, which would be a positive sentiment that can be used as
a customer testimonial.

This powerful NLP-powered technology makes it easier to monitor and


manage your brand's reputation and get an overall idea of how your
customers view you, helping you to improve your products or services
over time.

Customer Service Automation

NLP customer service implementations are being valued more and more
by organizations.
Customer service support centers and help desks tend to receive more
inquiries than they can handle, and NLP solves this gap by automating
responses to simple questions, allowing employees to focus on more
complex tasks that require human interaction. NLP can also help you
route the customer support tickets to the right person according to their
content and topic. This way, you can save lots of valuable time by making
sure that everyone in your customer service team is only receiving
relevant support tickets.

Analyzing Converted Text

Certain subsets of AI are used to convert text to image, whereas NLP


supports in making sense through text analysis. An example of this
capability is OCR.

Optical Character Recognition

Optical Character Recognition (OCR) automates data extraction from text,


either from a scanned document or image file to a machine-readable text.
For example, an application that allows you to scan a paper copy and
turns this into a PDF document. After the text is converted, it can be used
for other NLP applications like sentiment analysis and language
translation.

Google Translate is a basic example of OCR, whereby you can upload a


file or even ‘write’ a word, and receive a text version back.
Optical Character Recognition on Google Translate

Speech Recognition

Voice Recognition, or Automatic Speech Recognition (ASR) and Speech-to-


Text (STT), is a software capable of converting human speech to its
analog form (acoustic sound waves), and from there to a digital form
recognized by the machine. ASR works by:

 Breaking down the audio of a speech into individual sounds (called


tokens)

 Analyzing each token

 Using algorithms to find the most likely word to fit in that particular
language

 Converting the sounds into text.

A widespread example of speech recognition is the smartphone's voice


search integration. This feature allows a user to speak directly into the
search engine, and it will convert the sound into text, before conducting a
search.

Natural Language Generation

Smart Assistants, customer service bots, and other customer-facing


software all use a subset of NLP called natural language generation. As
the name suggests, this technology uses data to produce narratives
(either written or spoken). This is made possible through:

 Content analysis – data is filtered and from there the technology


determines what should be included in the content. This stage
identifies the main topics in the source document and any
relationships between them.

 Data understanding – the data is then interpreted, patterns are


identified and the context is formed. In this stage Machine Learning
is usually used.

 Document structuring – based on the type of data that was


interpreted, a documented plan is made and narrative structure is
decided on.

 Sentence aggregation – Certain parts of sentences are combined in


a method that summarizes the topic.

 Grammatical structuring – As a finishing touch, grammatical rules


are applied to ensure the text sounds natural, and the sentences are
written in a grammatically correct manner.

 Language presentation – Finally, the output is generated based on


the format. For voice-powered assistants, the output would be
audio.

The different levels of language analysis in Natural Language Processing


(NLP) are:

 Phonological: Focuses on pronunciation


 Morphological: Focuses on the smallest parts of words that carry
meaning

 Lexical: Focuses on the meaning of words

 Syntactic: Focuses on the structure and grammar of sentences

 Semantic: Focuses on the meaning of words and sentences

 Discourse: Focuses on the structure of different types of text

 Pragmatic: Focuses on the effects of context on meaning

These levels help machines interpret human language.

Explanation

 Lexical analysis: Converts a sequence of characters into a


sequence of tokens.

 Syntactic analysis: Analyzes a string of symbols, like natural


language, to conform to the rules of formal grammar.

 Semantic analysis: Looks for meaning in a sentence and combines


words into phrases.

 Pragmatic analysis: Studies the effects of context on meaning.

 Discourse analysis: Studies written and spoken language in


relation to its social context.
1. Lexical analysis

Lexicon describes the understandable vocabulary that makes up a


language. Lexical analysis deciphers and segments language into units—
or lexemes—like paragraphs, sentences, phrases, and words. NLP
algorithms categorize words into parts of speech (POS) and split lexemes
into morphemes—meaningful language units that you can’t further divide.
There are 2 types of morphemes:

 Free morphemes function independently as words (like “cow” and


“house”).

 Bound morphemes make up larger words. The word


“unimaginable” contains the morphemes “un-” (a bound morpheme
signifying a negative context), “imagine” (the free morpheme root
of the whole word), and “-able” (a bound morpheme denoting the
root morpheme’s ability to end).

For instance, when performing a lexical analysis on the previous


paragraph, the analysis isolates and divides the first sentence into lexeme
phrases, like “the understandable vocabulary that makes up a language.”
This analysis further divides the phrase into word lexemes, like
“vocabulary” and “language,” categorizing both as noun POS. Then, the
analysis derives free morphemes, like “words,” “vocabulary,” and
“understand-,” and bound morphemes, like “-able.”

2. Syntactic analysis

Syntax describes how a language’s words and phrases arrange to form


sentences. Syntactic analysis checks word arrangements for proper
grammar.

For instance, the sentence “Dave wrote the paper” passes a syntactic
analysis check because it’s grammatically correct. Conversely, a syntactic
analysis categorizes a sentence like “Dave do jumps” as syntactically
incorrect.

3. Semantic analysis

Semantics describe the meaning of words, phrases, sentences, and


paragraphs. Semantic analysis attempts to understand the literal meaning
of individual language selections, not syntactic correctness. However, a
semantic analysis doesn’t check language data before and after a
selection to clarify its meaning.

For instance, “Manhattan calls out to Dave” passes a syntactic analysis


because it’s a grammatically correct sentence. However, it fails a
semantic analysis. Because Manhattan is a place (and can’t literally call
out to people), the sentence’s meaning doesn’t make sense.

4. Discourse integration

Discourse describes communication between 2 or more individuals.


Discourse integration analyzes prior words and sentences to understand
the meaning of ambiguous language.

For instance, if one sentence reads, “Manhattan speaks to all its people,”
and the following sentence reads, “It calls out to Dave,” discourse
integration checks the first sentence for context to understand that “It” in
the latter sentence refers to Manhattan.

5. Pragmatic analysis
Pragmatism describes the interpretation of language’s intended meaning.
Pragmatic analysis attempts to derive the intended—not literal—meaning
of language.

For instance, a pragmatic analysis can uncover the intended meaning of


“Manhattan speaks to all its people.” Methods like neural networks assess
the context to understand that the sentence isn’t literal, and most people
won’t interpret it as such. A pragmatic analysis deduces that this sentence
is a metaphor for how people emotionally connect with places.

All types of ambiguities in NLP

Since Natural language can be open to multiple interpretations at times,


this would pass on to the computers who will try to understand the natural
language input given to them. Often, it can be difficult to fully understand
a sentence when we are not given enough context or if there is poor
grammar.

In this article we will be going over many different types of ambiguities


that are found in NLP.

Part Of Speech (POS) Tagging Ambiguity

POS tagging refers to the process of classifying words in a text to a part of


speech - whether the word is a verb, noun, etc. Often, you will find that
the same word can take on multiple classifications for its part of speech
depending on how the sentence is constructed. For example, it is quite
common to see words that can be used both as a verb or a noun −

 I need to mail my friend the files. (Verb)

 I need to find the mail that was sent to me. (Noun)

Structural Ambiguity

This ambiguity arises because the same exact sentence can be


interpreted differently based on how the sentence is parsed. Take the
following sentence
The boy kicked the ball in his jeans.

This sentence can be construed as the boy either kicking the ball while
wearing his jeans, or kicking the ball while the ball was in the jeans. This
depends on how the sentence is parsed.

Scope Ambiguity

Here we look at ambiguities that occur due to quantifiers. Taking a look


back at some math logic terminology, or just basic grammar, we know
that words like ‘every’ and ‘any’ would come to mind.

Take the following sentence −

All students learn a programming language.

This sentence, due to the scope created with the sequential use of
quantifiers ‘all’ followed by ‘a’, can have two different meanings. The two
meanings are that −

 The first is that all students learn the same programming language.

 They all learn a language that doesn’t have to be the same one.

Lexical Ambiguity

Certain words have the property that they can have multiple different
meanings. There are two forms of lexical ambiguity that exist: Polysemy
and Homonymy.

Polysemy − This is when two words are the same but have a different
meaning depending on the usage, i.e the word Foot. Foot can describe the
body part, or the foot of the building. Essentially, you are describing the
base of something with the word foot.

Homonym − This occurs when a word has the same spelling or


pronunciation, but has different meanings overall. While superficially the
same they are completely different in meaning. The word bass for
example can be referring to the musical instrument, or a type of fish.
Another example, which is given here to clarify that not just spelling but
pronunciation is important too, is horse and hoarse. These two have
similar pronunciations, but horse refers to the animal and hoarse refers to
a sore throat.

Semantic Ambiguity

Now, instead of a word having multiple meanings, sentences can have


multiple meanings depending on the context. For example, the sentence
“He ate the burnt lasagna and pie” could mean one of two things −

 That the lasagna was burnt and the pie wasn’t.

 That both were burnt.

Lexical ambiguity can be deemed a subtype of semantic ambiguity.

Referential Ambiguity

Referential ambiguity occurs when a phrase can have multiple


interpretations due to the use of multiple objects and the referencing not
being clear. For example, take the sentence −

I looked at Michelle with the telescope.

This can mean two things depending on who has the telescope.

 Michelle herself was carrying the telescope.

 The person saying the sentence was using a telescope to see


Michelle.

Anaphoric Ambiguity

Here we have a loosely similar ambiguity to referential ambiguity, but


more fixated on pronouns . The use of pronouns can cause some
confusion if there are multiple people being mentioned in a sentence.
Take the following sentence −

Michelle told Romany that she ate the cake.


Now, from the sentence alone it is not exactly clear whether ‘she’ is
referring to Michelle or Romany.

Ambiguity poses risks for companies applying NLP:

 It can lead to misunderstandings by AI assistants conversing with


customers.

 It makes accurately interpreting customer sentiment and intent


more difficult.

 Generative systems can output incorrect or nonsensical text if they


mishandle ambiguity.

 There are risks when using AI for content moderation or review


processes.

 Improperly handled ambiguity hurts model robustness.

You might also like