CS 626 449 Speech Natural Language Processing and

  • Slides: 30
Download presentation
CS 626 -449: Speech, Natural Language Processing and the Web/Topics in Artificial Intelligence Pushpak

CS 626 -449: Speech, Natural Language Processing and the Web/Topics in Artificial Intelligence Pushpak Bhattacharyya CSE Dept. , IIT Bombay Lecture 12: Deeper Verb Structure; Different Parsing Algorithms

Types of Languages: n Head Initial n n n Indian Languages Japanese (with a

Types of Languages: n Head Initial n n n Indian Languages Japanese (with a bit of exception) Head Final n English

Head Initial & Head Final HEAD INITIAL HEAD FINAL NP eats rice ����� ��

Head Initial & Head Final HEAD INITIAL HEAD FINAL NP eats rice ����� �� VP president of India ����������� PP of India ���� �� ADJP very intelligent ���������

Deeper trees needed for capturing sentence structure This wont do! Flat structure! NP PP

Deeper trees needed for capturing sentence structure This wont do! Flat structure! NP PP The AP PP book big with the blue cover of poems [The big book of poems with the Blue cover] is on the table.

“Constituency test of Replacement” runs into problems n One-replacement: n n n I bought

“Constituency test of Replacement” runs into problems n One-replacement: n n n I bought the big [book of poems with the blue cover] not the small [one] One-replacement targets book of poems with the blue cover Another one-replacement: n n I bought the big [book of poems] with the blue cover not the small [one] with the red cover One-replacement targets book of poems

More deeply embedded structure NP N’ 1 The AP N’ 2 N’ 3 big

More deeply embedded structure NP N’ 1 The AP N’ 2 N’ 3 big N book PP PP of poems with the blue cover

To target N 1’ n I want [NPthis [N’big book of poems with the

To target N 1’ n I want [NPthis [N’big book of poems with the red cover] and not [Nthat [None]]

V-bar n n What is the element in verbs corresponding to one-replacement for nouns

V-bar n n What is the element in verbs corresponding to one-replacement for nouns do-so or did-so

I [eat beans with a fork] VP PP eat NP with a fork beans

I [eat beans with a fork] VP PP eat NP with a fork beans No constituent that groups together V and NP and excludes PP

Need for intermediate constituents n I [eat beans] with a fork but Ram [does

Need for intermediate constituents n I [eat beans] with a fork but Ram [does so] with a spoon. VP V 1’ VP V’ V’ V’ (PP) V’ V (NP) V 2’ PP V NP with a fork eat beans

How to target V 1’ n I [eat beans with a fork], and Ram

How to target V 1’ n I [eat beans with a fork], and Ram [does so] too. VP V 1’ VP V’ V’ V’ (PP) V’ V (NP) V 2’ PP V NP with a fork eat beans

Parsing Algorithm

Parsing Algorithm

A simplified grammar n S NP VP n NP DT N | N n

A simplified grammar n S NP VP n NP DT N | N n VP V ADV | V

A segment of English Grammar n n n S’ (C) S S {NP/S’} VP

A segment of English Grammar n n n S’ (C) S S {NP/S’} VP VP (AP+) (VAUX) V (AP+) ({NP/S’}) (AP+) (PP+) (AP+) NP (D) (AP+) N (PP+) PP P NP AP (AP) A

Example Sentence People 1 laugh 2 Lexicon: People - N, V Laugh - N,

Example Sentence People 1 laugh 2 Lexicon: People - N, V Laugh - N, V 3 These are positions This indicate that both Noun and Verb is possible for the word “People”

Top-Down Parsing State Backup State Action --------------------------------------------------1. ((S) 1) Position of input pointer 2.

Top-Down Parsing State Backup State Action --------------------------------------------------1. ((S) 1) Position of input pointer 2. ((NP VP)1) 3 a. ((DT N VP)1) 3 b. ((N VP)1) 4. ((VP)2) 5 a. ((V ADV)2) 6. ((ADV)3) 5 b. ((V)2) 6. ((. )3) ((N VP) 1) ((V)2) - Termination Condition : All inputs over. No symbols remaining. Note: Input symbols can be pushed back. Consume “People” Consume “laugh”

Discussion for Top-Down Parsing n n n This kind of searching is goal driven.

Discussion for Top-Down Parsing n n n This kind of searching is goal driven. Gives importance to textual precedence (rule precedence). No regard for data, a priori (useless expansions made).

Bottom-Up Parsing Some conventions: N 12 Represents positions S 1? -> NP 12 °

Bottom-Up Parsing Some conventions: N 12 Represents positions S 1? -> NP 12 ° VP 2? End position unknown Work on the LHS done, while the work on RHS remaining

Bottom-Up Parsing (pictorial representation) S -> NP 12 VP 23 ° People 1 Laugh

Bottom-Up Parsing (pictorial representation) S -> NP 12 VP 23 ° People 1 Laugh 2 N 12 V 12 NP 12 -> N 12 ° VP 12 -> V 12 ° S 1? -> NP 12 ° VP 2? 3 N 23 V 23 NP 23 -> N 23 ° VP 23 -> V 23 °

Problem with Top-Down Parsing • Left Recursion • Suppose you have A-> AB rule.

Problem with Top-Down Parsing • Left Recursion • Suppose you have A-> AB rule. Then we will have the expansion as follows: • ((A)K) -> ((ABB)K) ……. .

Combining top-down and bottom-up strategies

Combining top-down and bottom-up strategies

Top-Down Bottom-Up Chart Parsing n n Combines advantages of top-down & bottomup parsing. Does

Top-Down Bottom-Up Chart Parsing n n Combines advantages of top-down & bottomup parsing. Does not work in case of left recursion. n n e. g. – “People laugh” n People – noun, verb n Laugh – noun, verb Grammar – S NP VP NP DT N | N VP V ADV | V

Transitive Closure People 1 S NP VP NP DT N NP N laugh 2

Transitive Closure People 1 S NP VP NP DT N NP N laugh 2 NP N S NP VP VP V ADV VP V 3 VP V S NP VP success

Arcs in Parsing n Each arc represents a chart which records n n Completed

Arcs in Parsing n Each arc represents a chart which records n n Completed work (left of ) Expected work (right of )

Example People 1 S NP VP NP DT N NP N laugh 2 NP

Example People 1 S NP VP NP DT N NP N laugh 2 NP N S NP VP VP V ADV VP V loudly 3 VP V ADV S NP VP 4 VP V ADV S NP VP

Dealing With Structural Ambiguity n Multiple parses for a sentence n n n The

Dealing With Structural Ambiguity n Multiple parses for a sentence n n n The man saw the boy with a telescope. The man saw the mountain with a telescope. The man saw the boy with the ponytail. At the level of syntax, all these sentences are ambiguous. But semantics can disambiguate 2 nd & 3 rd sentence.

Prepositional Phrase (PP) Attachment Problem V – NP 1 – P – NP 2

Prepositional Phrase (PP) Attachment Problem V – NP 1 – P – NP 2 (Here P means preposition) NP 2 attaches to NP 1 ? or NP 2 attaches to V ?

Parse Trees for a Structurally Ambiguous Sentence Let the grammar be – S NP

Parse Trees for a Structurally Ambiguous Sentence Let the grammar be – S NP VP NP DT N | DT N PP PP P NP VP V NP PP | V NP For the sentence, “I saw a boy with a telescope”

Parse Tree -S 1 NP N I VP V NP saw Det N PP

Parse Tree -S 1 NP N I VP V NP saw Det N PP a boy P NP with Det N a telescope

Parse Tree -2 S NP N I VP V NP saw Det N PP

Parse Tree -2 S NP N I VP V NP saw Det N PP P NP a boy with Det N a telescope