AI - Natural Language Processing
AI - Natural Language Processing
Processing of Natural Language is required when you want an intelligent system like robot to
perform as per your instructions, when you want to hear decision from a dialogue based clinical
expert system, etc.
The field of NLP involves making computers to perform useful tasks with the natural languages
humans use. The input and output of an NLP system can be −
• Speech
• Written Text
Components of NLP
There are two components of NLP as given −
It involves −
• Text planning − It includes retrieving the relevant content from knowledge base.
Difficulties in NLU
1 of 6 11/15/2021, 13:02
AI - Natural Language Processing https://www.tutorialspoint.com/artificial_intelligence/artificial_intelligen...
• For example, “He lifted the beetle with red cap.” − Did he use cap to lift the beetle or he
lifted a beetle that had red cap?
NLP Terminology
• Phonology − It is study of organizing sound systematically.
• Semantics − It is concerned with the meaning of words and how to combine words into
meaningful phrases and sentences.
• Discourse − It deals with how the immediately preceding sentence can affect the
interpretation of the next sentence.
Steps in NLP
There are general five steps −
• Lexical Analysis − It involves identifying and analyzing the structure of words. Lexicon
of a language means the collection of words and phrases in a language. Lexical
analysis is dividing the whole chunk of txt into paragraphs, sentences, and words.
2 of 6 11/15/2021, 13:02
AI - Natural Language Processing https://www.tutorialspoint.com/artificial_intelligence/artificial_intelligen...
words. The sentence such as “The school goes to boy” is rejected by English syntactic
analyzer.
• Semantic Analysis − It draws the exact meaning or the dictionary meaning from the
text. The text is checked for meaningfulness. It is done by mapping syntactic structures
and objects in the task domain. The semantic analyzer disregards sentence such as
“hot ice-cream”.
• Discourse Integration − The meaning of any sentence depends upon the meaning of
the sentence just before it. In addition, it also brings about the meaning of immediately
succeeding sentence.
• Pragmatic Analysis − During this, what was said is re-interpreted on what it actually
meant. It involves deriving those aspects of language which require real world
knowledge.
3 of 6 11/15/2021, 13:02
AI - Natural Language Processing https://www.tutorialspoint.com/artificial_intelligence/artificial_intelligen...
• Context-Free Grammar
• Top-Down Parser
Let us see them in detail −
Context-Free Grammar
It is the grammar that consists rules with a single symbol on the left-hand side of the rewrite
rules. Let us create grammar to parse a sentence −
The parse tree breaks down the sentence into structured parts so that the computer can easily
understand and process it. In order for the parsing algorithm to construct this parse tree, a set of
rewrite rules, which describe what tree structures are legal, need to be constructed.
These rules say that a certain symbol may be expanded in the tree by a sequence of other
symbols. According to first order logic rule, if there are two strings Noun Phrase (NP) and Verb
Phrase (VP), then the string combined by NP followed by VP is a sentence. The rewrite rules for
the sentence are as follows −
S → NP VP
VP → V NP
Lexocon −
DET → a | the
4 of 6 11/15/2021, 13:02
AI - Natural Language Processing https://www.tutorialspoint.com/artificial_intelligence/artificial_intelligen...
Now consider the above rewrite rules. Since V can be replaced by both, "peck" or "pecks",
sentences such as "The bird peck the grains" can be wrongly permitted. i. e. the subject-verb
agreement error is approved as correct.
Demerits −
• They are not highly precise. For example, “The grains peck the bird”, is a syntactically
correct according to parser, but even if it makes no sense, parser takes it as a correct
sentence.
• To bring out high precision, multiple sets of grammar need to be prepared. It may
require a completely different sets of rules for parsing singular and plural variations,
passive sentences, etc., which can lead to creation of huge set of rules that are
unmanageable.
Top-Down Parser
Here, the parser starts with the S symbol and attempts to rewrite it into a sequence of terminal
symbols that matches the classes of the words in the input sentence until it consists entirely of
terminal symbols.
5 of 6 11/15/2021, 13:02
AI - Natural Language Processing https://www.tutorialspoint.com/artificial_intelligence/artificial_intelligen...
These are then checked with the input sentence to see if it matched. If not, the process is
started over again with a different set of rules. This is repeated until a specific rule is found
which describes the structure of the sentence.
Demerits −
6 of 6 11/15/2021, 13:02