Natural Language Processing
Natural Language Processing
Natural Language Processing
• Top-Down Parser: Begin with the start symbol and apply the
grammar rules forward until the symbols at the terminals of the
tree correspond to the components of the sentence being parsed.
Consider the sentence
“The bird pecks the grains”
Grammar consists of rules with a single symbol on the left-hand
side of the rewrite rules.
Example:
Articles (DET) − a | an | the
Nouns − bird | birds | grain | grains
Noun Phrase (NP) − Article + Noun | Article + Adjective + Noun
= DET N | DET ADJ N
Verbs − pecks | pecking | pecked
Verb Phrase (VP) − NP V | V NP
Adjectives (ADJ) − beautiful | small | chirping
The parse tree breaks down the sentence into structured parts so
that the computer can easily understand and process it by following
certain rules.
As per the rules of the first order logic, if there are two strings Noun
Phrase (NP) and Verb Phrase (VP), then the string combined by NP
followed by VP is a sentence.
S → NP VP Lexocon −
Lexocon −
DET → a | the
ADJ → beautiful | perching
N → bird | birds | grain | grains
V → peck | pecks | pecking
Example 2
Semantic Analysis
• Semantic Analysis is a process of understand the meaning of
Natural Language or a given text while taking into account context,
logical structuring of sentences and grammar roles.
The most important task of semantic analysis is to get the proper
meaning of the sentence.
For example, analyze the sentence “Ram is great.” In this sentence,
the speaker is talking either about Lord Ram or about a person
whose name is Ram.
Therefore semantic analyzer is important.
Parts of Semantic Analysis
Semantic Analysis of Natural Language can be classified into two
broad parts:
1. Lexical Semantic Analysis: Lexical Semantic Analysis involves
understanding the meaning of each word of the text individually. It
basically refers to fetching the dictionary meaning that a word in the
text is deputed to carry.
2. Sentence-level Semantics Analysis: Although knowing the
meaning of each word of the text is essential, that the same time
understanding the meaning of the complete text is very important.
Importance of Sentence-level Semantics Analysis:
Consider two sentences:
1. Students loves college.
2. College loves students.
• Although both these sentences 1 and 2 use the same set of root words
they convey entirely different meanings.
• Hence, under Sentence-level Semantics Analysis, how combinations of
individual words form the meaning of the text will be analysed.
Tasks involved in Semantic
Analysis
In order to understand the meaning of a sentence, the following are
the major processes involved in Semantic Analysis:
For example if str1 = "ab", str2 = "abc" then making an insert operation of character 'c' on str1
transforms str1 into str2.