NLP Module2
NLP Module2
Trantqennakion —
Known at Brill tagging a an -exca mple of hyla'd
Tee te machine Learnt ny metus d joke duced
wy EF eiw Cin iaas)-2 Tran formation - bated envr-driven Leatutuy
Bean applied tea) number of natural lunguage
“protlunn, rincluedrang pasta - of - Speech fogging j sp
Qenerahin , aud Syntache peam'ag -
2 The below drone Mushy fe TRL proce spa
(A elo & Anepavizcd Lean tng see nc eyue.
Unann i
stent !
|
Annotated atk
Cinthat state
Figure 1) TRL Lenanes
pthe i|y te Bet TAL bogs Ng aligentam Maa taysed
compu aud lo eric ;
ify
/
Te PLL Ung ins oolyor'hun
IMpeT | Tagged corpus and Lextton Costlu most frayed
5. | BAfpematven) .
Steel babe wer word usikty, mo edly fas (gomn 7m
Pebrerety
Step | Chews ener POM ELE trantforniain aud AO
Me welica, mopk Improve tagging aan
Skeet. Rectas carpus Goring tee nila
RepeehQins (ont come | stopping criteaton 14 reacted
‘Rewer /
Puted Stay of tramhwmabion rule -
> The Inthe Stele annotater user tasleriion teauign
S te cath werd ar duc staat state: An ovdecdSet tre
tay off mt doemalion ruber aXe apelied €
L The presses A Hevaded until Aegine)
e Atopping
evident
om
ja reacted, fuck ot 10 ne
IA ccudered over tie previo ; a
Ak each iteration, due tran femahion od results }
he bighak Kore 1 Acecttd. The off bee cyoitom
Ree eed eh oo) Leasned ctranfermehon ana
Rrrteter tagging clopeto ee borrett— ba5 ging -
In ton
Head of the Department
pt of Computer Sine & Eoeutta Da Senet)
‘SJB Institute of Technology
No. 67, BGS Health & Education, city,
No. S74 Road, Kengo Bongalry S00, 060Syntactic Ai
Context-Free Grammar,
Constituency,
‘Top-down and Bottom-up Parsing,
CYK Parsing.
Context-Free Grammar,
Context-free grammar (CFG) was first defined for natural language by Chomsky(1957) and used
for the Algol programming language by Backus(1959) and Naur(1960).
A CFG is also called phrase structure grammar, consists of four components:
. Asset of non-terminal symbols, N
. A set of terminal symbols, T
. A designated start symbol, S, that is one of the symbols from N.
A set of production, P, of the form: A >a.
Where A € N and a is a string consisting of terminal and non-terminal symbols. The rule A —a says that
constituent A can be rewritten as a.. This is also called the phrase structure rule.
For example: the rule S NP VP. states that S consists of NP followed by VP,
consists of noun phrase followed by verb phrase.
‘A language is usually defined through. the’concept of derivation. The basic operation is that of]
rewriting a symbol appearing on the left hand side of production by its right hand side,
‘A CFG can be used to generate a sentence or to assign a structure to a given sentence. Consider a|
Toy grammar
SNP VP.
NP =N.
NP Det N
‘VP VNP
vP—V
N —Hena|She R6 (edt
ir Head of tho Department
Wade single sens Dept of Canute Science & Engineering (ata Senee)
SB intiute of Technology
No. 67, BGS Health & Education City,
(Uttarahall Road, Kengori, Bengaturu-S60 060
_——_—
VISemester, CSE (D5) Professor Page 13Syntactic Analysi
Figure (a): Toy CFG and Sample parse tree
The symbol S can be rewritten as NP VP using Rule 1, then using rule Rule 2 and R4, NP and VP}
are rewritten as N and V NP respectively. NP is then rewritten as Det N (R3). Finally’ using the|
rules R6 and R7. we get the sentence: Hena reads a boOK......+4(1)
The sentence (1) can be derived from S. The representation of the derivation is shown in figure(a).
‘The parse tree in figure(a) can be represented using this notation as follows:
Islvely Henal]fvrly reads|{vrl pe a} { book}
The set of all the strings containing terminal symbols which can derived from the start symbol of
the grammar, defines the language generated by grammar.
The parse tree shown in figure(a) essentially represents. a mapping of a string to tits parse tree.
This mapping process is called parsing:
Constituency
+ Constituency parsing is an important) concept in Natural Language Processing that involves
analyzing the structure of a sentence grammatically by identifying the constituents or phrases in the
sentence and their hierarchical relationships.
Working of Constituency Parsing
For understanding natural language, the key is to understand the grammatical pattem of the sentences|
involved. The first step in understanding grammar is to segregate a sentence into groups of words or|
tokens called constituents based on their grammatical role in the sentence,
Let’s understand this process with an example sentence:
“The lion ate the deer.”
+ Here, “The lion” represents a noun phrase, “ate” represents a verb phrase, and “the deer” is
another noun phrase.
VI Semester, CSE (DS) Dr. Murali G, Professor: Syntactic Analysis
fe
Phrase Level constructions:
+ Phrase types are named after their head, which is the lexical category that determines the propertics|
of the phrase, Thus, if the head is a noun, the phrase is called a noun phrase, if the head is a verb,
the phrase is called a verb phrase, and so on for other lexical categories such as adjective and
preposition. The below figure shows a sentence with a noun phrase, verb phrase and preposition.
“The gir vo NP
plucked the flower IN
with plongstick
Figure (b): A sentence with NP, VP, and PP
Noun Phrase
+ Anoun phrase is a phrase whose héad is an noun’or a pronoun, of
modifiers it can function as subject, object, or complement. The modifiers of a noun phrase can be|
determinesor adjective phrases: These structures can be represented using the phrase structure rule, The|
phrase structure rules are of the form’A BC , which states that constituent A can be rewritten as two]
constituents B and C. These rules specify which elements can occur in a phrase and in what order. Using
this notation, we can represent the phrase structure rule for a noun phrase as follows:
NP —+ Pronoun
NP Det Noun
NP Noun
NP —Adj Noun
NP Det Adj Noun
We can combine all these rules ina single phrase structure rule as follows:
NP + (Det) (Adj) Noun | Pronoun
‘The constituents in parentheses are optional. This rule state that a noun phrase consists of a noun, preceded by’ a]
determiner and adjective . A noun phrase may include post- modifiers and more than one adjective.
‘Vi Semester, CSE (DS) Dr. Murali G, Professorsyntactic Analysis
een
For example: it may include a prepositional phrase(PP), More than one adjective is handled by allowing and
adjective phrase (AP) for the adjective in the rule, After incorporating PP and AP in the phrase structure rule, we get
the following
NP —+ (Det)(AP) Noun (PI
‘The following are the some of the examples of noun phrase:
They
The foggy morning,
Chilled water
A beautiful lake in Kashmir
Cold banana shake
VI Semester, CSE (DS) Dr. Murali G, Professorae
; 7
dN
Verb]
vom As Jere mow, Phare, ja
PrPere rome oda treodted ay WeAb « There ly
starry horde Lali ar oh) phrates decob Can med ity
Overt. THA Males iments) phyaset a loth mowe Com
F wicteu tay +
ST vere ilo phrore organics various alert 4
£ He Aentence pulit! clepend syntactealy 611 Heo vers
Py Ts ‘fottoveing Che ome examples 4 wade pres
Kruhbu “Step. ee ee
Ths boy reeled * pba. 4 ®
, erurbbu oUipt iin tee ganden -©
a SN Te bey 4 game, ton gil & bovleé +@ j)
; “rede poy, gare | ey aint a book wily blue Coves 5
From pie ad “Seow ple ats yet pov ER lraue a
Vere Evp vere In Oa nek foltored, ‘by cuNP
Lvp 9 wea) MP in Gd) a vat followed by
- wh pe LVRS meth pp in @ly