parsing and syntax. syntactic formalisms: historic perspective “syntax” comes from greek word...

32
Parsing and Syntax

Upload: cecily-amberly-moore

Post on 04-Jan-2016

228 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Parsing and Syntax

Page 2: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Syntactic Formalisms: Historic Perspective

• “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

• Early grammars: 4th century BC – Panini compiled Sanskrit grammar

• Idea of constituency– Bloomfield (1914): method for breaking up sentence into a

hierarchy of units – Harris (1954): substitutability test for constituent definition

• Formal work on Syntax goes back to Chomsky’s PhD thesis in 1950s

*Some slides in this lecture are adapted from slides of Michael Collins

Page 3: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Syntactic Structure

Page 4: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

A Real Tree

Page 5: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

What can we Learn from Syntactic Tree?

• Part-of-speech for each word (N=noun, V=verb, P=preposition)• Constituent structure Noun phrase: “the apartment”

Verb phrase: “robbed the apartment”

• Relationship structure “the burglar” is the subject of “robbed”

Page 6: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Context-Free Grammars

Page 7: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

A Context-Free Grammar for English

Page 8: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Left-Most Derivation

Page 9: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Derivation Example

Page 10: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Properties of CFGs

Page 11: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Ambiguous Sentence

Page 12: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Ambiguous Sentence

Page 13: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

More Ambiguity

Page 14: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Syntactic Ambiguity

• Prepositional phrases

They cooked the beans in the pot on the stove with handles.• Particle vs preposition The puppy tore up the staircase.• Complement structure She knows you like the back of her hand.• Gerund vs. participial adjective. Visiting relatives can be boring• Modifier scope within NPs Plastic cup holder(examples are compiled by Dan Klein)

Page 15: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Human Processing

• Garden Path: The horse raced past the barn fell. The man who hunts ducks out on weekends

• Ambiguity maintenance Have the police … eaten their supper? come in and look around taken out and shot

Page 16: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

A Probabilistic Context-Free Grammar

Page 17: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Example

Page 18: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Properties of PCFGs

Page 19: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Deriving a PCFG from a Corpus

Page 20: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Algorithms for PCFG

Page 21: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Chomsky Normal Form

Page 22: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

A Dynamic Programming Algorithm for the Max

Page 23: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

A Dynamic Programming Algorithm for the Max (cont.)

Page 24: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

A Dynamic Programming Algorithm forthe Max (cont.)

Page 25: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Runtime

Page 26: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

A Dynamic Programming Algorithmfor the Sum

Page 27: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

A Dynamic Algorithm for the Sum (cont.)

Page 28: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

A Dynamic Programming Algorithm for the Sum (cont.)

Page 29: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Weaknesses of PCFGs

• Lack of sensitivity to lexical information

• Lack of sensitivity to structural frequencies

Page 30: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

PP Attachment Ambiguity

Page 31: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

PP Attachment Ambiguity

Page 32: Parsing and Syntax. Syntactic Formalisms: Historic Perspective “Syntax” comes from Greek word “syntaxis”, meaning “setting out together or arrangement”

Structural Preferences: Close Attachment