Computational Linguistics
Natural
Language
◦ Languages
that are
spoken
naturally in
human being
Languages
◦ Human to
Human
◦ Machine to
machine
Perspective on NLP:Areas of AI and their inter-
dependencies.
Layer 1
A. Search
Search algorithms try to find out the best possible strategy, the optimal
strategy for computer.
B. Logic
Logic is a vehicle for reasoning and inferencing. In logic we are concerned
with several constructs like if x is true then y is true.
C. Knowledge Representation
knowledge must be extracted and embedded in the Machine.
Layer 2
A. Machine Learning
NLP is using lots of Statistical Techniques. Statistical Techniques are Machine Learning
techniques; they make use of the knowledge content in the data.
B. Planning
Already done in AI
Perspective on NLP:Areas of AI and their
inter-dependencies.
• NLP-concerned with computer being able to process human language
like Hindi, Marathi,Gujrathi,French,English , and understand .
• Computer Vision-NLP is followed by Computer Vision where machine
processes seen and understand how to operate in seen.
• Robotics-there is an embedded software inside robots that asking it
to perform certain actions like navigating etc.
Perspective on NLP:Areas of AI and their inter-dependencies
• Expert System-Expert System is concerned with ,the expert level performance of
the software on a specific task.
• For example –The task could be diagnosis of diseases and curing it.
• A doctor is known to operate with number of rules ,a very large no of
rules obtained by years of education and practice on patience .
• So, the expert system is concerned with emulating this behavior of the expert.
2 nd layer :feeding Layer
• Machine Learning and planning feed into a number of layers in the outer
most category.
• For example, Natural Language Processing is fed by Machine Learning and
Natural Language Processing is also fed by Knowledge Representation.
• The reason for this is that in current world, Natural Language Processing is
using lots of Statistical Techniques.
• Statistical Techniques are Machine Learning techniques; they make use of
the knowledge content in the data.
Introduction to Natural Language Processing
• Natural language processing (NLP) is a branch of artificial intelligence that helps
computers understand, interpret and manipulate human language.
• Natural Language Processing, usually shortened as NLP, is a branch of artificial
intelligence that deals with the interaction between computers and humans using the
natural language.
• The ultimate objective of NLP is to read, decipher, understand, and make sense of the
human languages in a manner that is valuable.
Natural language processing
• It refers to the branch of computer science—and more specifically, the
branch of artificial intelligence or AI
• concerned with giving computers the ability to understand text and
spoken words in much the same way human beings can.
• is an interdisciplinary subfield of linguistics, computer
science, and artificial intelligence concerned with the interactions
between computers and human language
INPUT Text OUTPUT
(Text/
(Documen Rating
t /
/Paragraph Graph
/Sentense /
/word} Audio)
NLP
System
Speech
Audio
Processing Text
(Documen OUTPUT
t (Text/
/Paragraph Rating
/Sen tense /Graph)
/word}
◦ NLP
System
Speech
Audio
Processing Text
(Documen OUTPUT
t (Text/
/Paragraph Rating
OCR /Sen tense /Graph)
Image Processing /word}
NLP
System
Stages of Natural language Processing
• To converse with human a program must understand the
syntax(grammar),semantics(word meaning) and morphology (word
level analysis),and pragmatics(conversation).
• There are certain phases in which Natural language processing is
performed .
Steps in
NLP
Morphological Analysis
Word-Level Analysis
Syntactic analysis
Sentence-Level Analysis
Semantic Analysis Sentence-Level Analysis
Discourse Analysis Sentence-Level Analysis
Pragmatic Analysis Sentence-Level Analysis
Morphological Analysis
studies the structure of words or formation of the words.
How words are built from smaller pieces
Identification ,analysis of root words , affixes (suffixes and prefixes)
Example
• Washing – wash+ ing
• Browser – Browse + er
• Incomplete- In+ Complete
Morphological Analysis
1. Tokenization
John ate the pizza ! !
2. Stop Word Removal (removing the words that occur commonly across all the documents ,typically, articles and
pronouns are generally classified as stop words )
Morphological Analysis
3.
Stemming
Stemming is a process of reducing words into its base form (Root form/stem
form).
Syntactic analysis
Process of converting infected word to their word stem.
Semantic Analysis
John->John
Ate -> eat
Pizza-
>Pizza
Discourse Analysis
Pragmatic Analysis
Lemmatization
• text normalization technique used for Natural Language Processing
(NLP).
• It can convert any word's inflections to the base root form.
• For example:
• Playing, Plays, Played ------- Play (Common root form "play")
Stemming vs Lemmatization
Stemming vs Stemming
S.N
o Lemmatization Lemmatization
Stemming is faster because it chops words Lemmatization is slower as compared to
1 without knowing the context of the word in stemming but it knows the context of the
given sentences. word before proceeding.
2 It is a rule-based approach. It is a dictionary-based approach.
3 Accuracy is less. Accuracy is more as compared to
Stemming.
When we convert any word into root-form then Lemmatization always gives the dictionary
4 stemming may create the non-existence meaning word while converting into root-
meaning of a word. form.
Stemming is preferred when the meaning of the Lemmatization would be recommended
5 word is not important for analysis. when the meaning of the word is
Example: Spam Detection important for analysis.
Example: Question Answer
6
For Example: For Example:
“Studies” => “Studi” “Studies” => “Study”
Morphological Analysis
4. N-Gram Language Model
Continuous sequence of N-Items from a given sample text.
1- John Ate the Pizza
gram-Syntactic analysis
Bigram John Ate the Pizza
-
Semantic Analysis
Trigram John Ate the Pizza
-
Discourse Analysis
4-Gram - John Ate the Pizza
Pragmatic Analysis
John Ate
the ?
Syntactic analysis
analyzing the grammatical syntax of a sentence to understand its meaning
John Ate the
Apple
Ate the Apple
John
Syntactic analysis
set of rules needed to ensure a sentence is grammatically correct
John Ate the
Apple
Ate the Apple
John
Semantic Analysis
semantics refers to meaning
Morphological Analysis
a computer understands the meaning of a text by analyzing the text as a whole and not just looking
at individual words
context in which a word is used is very important
Example 1 Example 2
She drank Some “Does it all sound like a joke to
Milk Discourse Analysis
you?”
She drank Some
booksPragmatic Analysis
Discourse Analysis
Resolving the reference as per the context .
Morphological Analysis
• Monkeys Eat
Banana, when they
Syntactic
Wake up. analysis
Who is they
here?
Semantic Analysis
-Monkey
• Monkeys eat Banana,
when they are ripe.
Who is they
Pragmatic
here? Analysis
-Banana
Pragmatic Analysis
knowledge of the relationship of meaning to the goals and intentions of the speaker.
Morphological Analysis
Close the
Syntactic analysis
Door
-Order
PleaseSemantic
Close the Analysis
Door
-
Request ,affirmation
Discourse Analysis
Ambiguity in Natural language
• input is ambiguous if there are multiple alternative Ambiguous linguistic
structures that can be built for it
• situation where a word or a sentence may have more than one meaning.
• There are different types of ambiguities
• Lexical
• Syntactical
• Semantic
• Discourse Ambiguity
• Pragmatic Ambiguity
Lexical Ambiguity
•is the ambiguity of a single word
•It can be resolved by parts of speech tagging
•Word has more than one meaning/category
•E.g.
•Book – Noun –Textbook/Novel
•Book – Verb - Book ticket/seat
•Bank-Noun –Financial institute
•Bank-Noun - River Bank
•Bank- Verb- Banking Transaction
Syntactical Ambiguity(Grammar or rules are
ambiguous)
• Syntactic Ambiguity exists in the
presence of two or more possible
meanings within the sentence.
• Specify the possible arrangements
of words in sentence used
• Example
I saw the girl with the binocular.
• In the above example, did I have
the binoculars? Or did the girl
have the binoculars?
• Semantic Ambiguity
• When a sentence has more than one meaning then it is called as
semantic ambiguity
• Rahul loves his cat and Dipesh does too.
• Whether Dipesh loves his cat or Rahul's cat
Anaphoric Ambiguity
This kind of ambiguity occurs in the sentence due to use of Anaphoric entities in
discourse.
Anaphora-When same beginning of sentence is repeated in the sentence several
times , we makes the pronoun instead of noun .
For example, My mother liked the house very much , but she couldn't purchase it
Example:-
•Monkeys Eat Banana, when they Wake up. -Who is they here? Monkey
•Monkeys eat Banana, when they are ripe.-Who is they here?-Banana
Identify When, Where, by whom occurrence was said
• Pragmatic Ambiguity
• Understanding speaker's intention.
• Eg. You are Late
Challenges in
NLP
◦ Elongated words
◦ I am sooooo sorry.
◦ It was toooo
yummy.
◦ Shortcuts
◦ Pls Please
- By the
◦ BTW way What
- OK
◦ Wat
-
◦ K-
Challenges in
NLP
◦ Emoji
s
Challenges in
NLP
◦ Mix Use of Languages
◦ I liked that movie. Salman khan ka acting
was Lajabab. Too good. जबरदस्त.
Challenges in
NLP
◦ Ellipsis
◦ Peter worked hard and passed exam, Kevin
too.
◦ Interpretation
◦ Kevin worked hard
◦ Kevin passed exam
◦ Kevin worked hard also he passed exam
Challenges in
NLP
◦ Punctuational Ambiguity
◦ Women, without her man, is
nothing.
◦ Women! without her, man is
nothing.
Applications
of NLP
•1. Question Answering
Question Answering focuses
on building systems that
automatically answer the
questions asked by humans in
a natural language.
Application
s of NLP
•2. Spam Detection
•Spam detection is used
to detect unwanted e-
mails getting to a user's
inbox.
3. Sentiment Analysis
• This application is implemented through a combination of NLP (Natural Language
Processing) and statistics by assigning the values to the text (positive, negative, or
natural), identify the mood of the context (happy, sad, angry, etc.)
This application is implemented through a combination of NLP (Natural
Language Processing) and statistics by assigning the values to the text (positive,
negative, or natural), identify the mood of the context (happy, sad, angry, etc.)
4. Machine Translation (Example: Google
Translator)
• Machine translation is used to translate text or speech from one
natural language to another natural language.
5. Spelling correction
• Microsoft Corporation provides word processor software like MS-
word, PowerPoint for the spelling correction.
• Chek's the spelling while typing.
• Example Wrong Speling will be underlined with the red color as
done in this sentence
6. Chatbot
Implementing the Chatbot is one of the important applications of NLP. It is used
by many companies to provide the customer's chat services.