110 likes | 281 Views
CS460/IT632 Natural Language Processing/Language Technology for the Web Lecture 17 (14/03/06) Prof. Pushpak Bhattacharyya IIT Bombay. Formulation of Grammar And Parsing. Formulation of Grammar. Form a grammar which accepts - Joe is reading the book. Joe has won a letter. Joe has to win.
E N D
CS460/IT632 Natural Language Processing/Language Technology for the Web Lecture 17 (14/03/06)Prof. Pushpak BhattacharyyaIIT Bombay Formulation of Grammar And Parsing
Prof. Pushpak Bhattacharyya, IIT Bombay Formulation of Grammar Form a grammar which accepts - • Joe is reading the book. • Joe has won a letter. • Joe has to win. • Joe will have the letter. • The letter in the book was red. • Joe could have had one.
Prof. Pushpak Bhattacharyya, IIT Bombay Formulation of Grammar (Contd.1) And rejects – 1*. Joe has reading the book. 2*. Joe had win. 3*. Joe winning. 4*. Joe will had the letter. 5*. The book was won by Joe. 6*. Joe can have having one.
Prof. Pushpak Bhattacharyya, IIT Bombay Solution (Considering NP) S NP VP NP Joe | the letter in the box | a letter | one NP PN (proper noun) | DT N | NP PP | NQ (quantitative noun) PP prep NP N letter | box
Prof. Pushpak Bhattacharyya, IIT Bombay Solution (Contd.) But the production rule NP NP PP is left recursion. So we make it NP DT N PP
Prof. Pushpak Bhattacharyya, IIT Bombay Verb Forms Forming VP production rules require insight into verb forms – • VB – base form (bathe, go) • VBS – S form (bathes, goes) • VBD – D form, past tense (bathed, went) • VBG – -ing form, present participle (bathing, going) • VBN – N form, past participle (bathed, gone)
Prof. Pushpak Bhattacharyya, IIT Bombay Solution (Considering VP) VP is VBG NP | has VBN NP | has to VB | will VB NP | was AP (adjective phrase) | could have VBN NP AP JJ (adjective)
Prof. Pushpak Bhattacharyya, IIT Bombay Solution (Contd. 1) Introducing new non-terminals – AM_IS_WAS am | is | was HAS_HAD has | had MODAL will | would | shall | should | can | could | may | might | must | ought to IS_WAS is | was
Prof. Pushpak Bhattacharyya, IIT Bombay Solution (Contd. 2) The VP rules are now changed as follows – VP AM_IS_WAS VBG NP | HAS_HAD VBN NP | HAS_HAD to VB | MODAL VB NP | IS_WAS AP | MODAL have VBN NP Some more rules of VP can be – VP HAS_HAD been VBG NP | MODAL have been VBG NP
Prof. Pushpak Bhattacharyya, IIT Bombay Top-down Parsing for Sentence 1 1 Joe 2 is 3 reading 4 the 5 book 6 Topdown backup Action • ((S) 1) - - • ((NP VP) 1) - - • ((PN VP) 1) bkup exists - • ((VP) 2) - Joe • ((IS_WAS VBG NP) 2) bkup exists - • ((VBG NP) 3) - is • ((NP) 4) - reading • ((PN) 4) bkup exists -
Prof. Pushpak Bhattacharyya, IIT Bombay Bottom-up Chart Parsing for Sentence 3 Joe has to win 1 2 3 4 5 NPPN VPHAS_HADVBN NP VPHAS_HAD toVB VPHAS_HAD to VB S NP VP VPHAS_HADto VB