28
Algorithm Schemata Algorithm Schemata and Data Structures and Data Structures in Syntactic in Syntactic Processing Processing By Martin Kay By Martin Kay 발발발 발발발 : : 발발발 발발발 E-mail : [email protected] E-mail : [email protected]

Algorithm Schemata and Data Structures in Syntactic Processing

  • Upload
    hayes

  • View
    45

  • Download
    2

Embed Size (px)

DESCRIPTION

Algorithm Schemata and Data Structures in Syntactic Processing. By Martin Kay. 발표자 : 임성신 E-mail : [email protected]. Contents. Parsing Top-down parsing Buttom-up parsing Chart parsing CKY Bottom-up Chart Parsing Top-down Chart Parsing. What is parsing?. - PowerPoint PPT Presentation

Citation preview

Page 1: Algorithm Schemata and Data Structures in Syntactic Processing

Algorithm Schemata and Algorithm Schemata and Data Structures in Data Structures in Syntactic ProcessingSyntactic Processing

By Martin KayBy Martin Kay

발표자 발표자 : : 임성신임성신

E-mail : [email protected] : [email protected]

Page 2: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

ContentsContents

ParsingParsing Top-down parsingTop-down parsing Buttom-up parsingButtom-up parsing Chart parsingChart parsing

CKYCKYBottom-up Chart ParsingBottom-up Chart ParsingTop-down Chart ParsingTop-down Chart Parsing

Page 3: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

What is parsing?What is parsing?

parsing involves recognising an input string parsing involves recognising an input string and assigning a structure to itand assigning a structure to it

parsing involves:parsing involves:a grammar e.g. a context-free grammara grammar e.g. a context-free grammaran input stringan input stringa parsing algorithm: a set of instructions for a parsing algorithm: a set of instructions for

applying the grammar to the input stringapplying the grammar to the input stringe.g. whether to use top-down or bottom-up e.g. whether to use top-down or bottom-up methodsmethods

Page 4: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Applications of ParsingApplications of Parsing

grammar checking in word processing grammar checking in word processing systemssystems

as a basis for semantic analysisas a basis for semantic analysis to support applications of NLP such as to support applications of NLP such as

machine translationmachine translationquestion answeringquestion answeringinformation extractioninformation extraction

Page 5: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Top-down production Top-down production 예문 예문 : radio broadcasts pay: radio broadcasts pay

Page 6: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

S

NP VP

D N V NP

D N

the dog saw the cat

StartTop-down Parsing

Page 7: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Buttom-up ProductionButtom-up Production

Page 8: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

S

NP VP

D N V NP

D N

the dog chased the cat

Start

Bottom-up parsing

Page 9: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Parsed SentenceParsed Sentence

the boy hits the dog with a rod

Det NounDet Noun Det Noun

NPNP

NP

PrepVerb

PPVP

VP

S

Page 10: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Top-down ParsingTop-down Parsing

the boy hits the dog with a rod

S

NPVerb

Det Noun

NP VP

Det Noun

PPVP

NPVerb

Det Noun

NPPrep

Det Noun

Page 11: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Bottom-up ParsingBottom-up Parsing

the boy hits the dog with a rod

Det

theDet boy

Noun

Noun

NP

NP

Verb

hitsVerb the

Det

Det dog

Noun

NounNP Verb

NP

NP

VP

NP VPS

S with

Prep

Prep a

Det

Det rod

Noun

Noun

NP

S Prep NP

PP

S PP

Page 12: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Bottom-up ParsingBottom-up Parsing

with a rodthe boy hits the dog

Det NounDet Noun

NP

NP

Verb

VP

NP VP with PrepPrep a

Det

Det rod

Noun

NounNP VP Prep NPNP

PP

NP VP PP

VP

NP VP

S

S

Page 13: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Chart ParsingChart Parsing chart parsing is a form of dynamic chart parsing is a form of dynamic

programmingprogramming dynamic programming solves problems by dynamic programming solves problems by

filling in tables with solutions to sub-filling in tables with solutions to sub-problemsproblems

when complete, the tables contain all the when complete, the tables contain all the solutions to the sub-problems needed to solutions to the sub-problems needed to solve the problemsolve the problem

in chart parsing, this involves storing in chart parsing, this involves storing subtrees for constituents that are foundsubtrees for constituents that are found

once found and stored, subtrees can be once found and stored, subtrees can be looked up - this avoids reparsinglooked up - this avoids reparsing

Page 14: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

CKY(Cocke-Kasami-Younger)CKY(Cocke-Kasami-Younger)

the boy hits the dog with a rod

Det Noun Verb Det Noun Prep Det NounNP NP NP

VP PP

SVP

S

Page 15: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

예문 예문 : Failing students looked hard.: Failing students looked hard.

1.1. S S → NP → NP VPVP2.2. NP NP → A → A NN3.3. NP NP → PRP→ PRP NN4.4. VPVP → V→ V AA5.5. VPVP → V→ V AVAV6.6. AA → failing, hard, …→ failing, hard, …7.7. PRPPRP → failing, …→ failing, …8.8. NN → students, …→ students, …9.9. VV → looked, …→ looked, …10.10.AVAV → hard, …→ hard, …

Page 16: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Bottom-up Chart ParsingBottom-up Chart Parsing(1/4)(1/4)

Failing student looked hard

A

PRP

N V A

AVNP

N

NP

N

N

N

S

S

VP

VP

Page 17: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Bottom-up Chart ParsingBottom-up Chart Parsing(2/4)(2/4)

Failing student looked hard

AAV

V

VP

VAV

VP

VA

AV

A

Page 18: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Bottom-up Chart ParsingBottom-up Chart Parsing(3/4)(3/4)

Failing student looked hard

PRP

NP

NN

S

VP

PRP

NP

NN

S

VP

VP

VAV

AV

A

VP

V A

Page 19: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Bottom-up Chart ParsingBottom-up Chart Parsing(4/4)(4/4)

Failing student looked hard

ANP

NN

S

VP

ANP

NN

S

VP

VP

VAV

AV

VP

VAA

Page 20: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Parsing Graph & TableParsing Graph & Table

Page 21: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Top-down Chart Parsing Top-down Chart Parsing Initial Step Initial Step

Failing student looked hard

A N V A

AVPRP

?S

Page 22: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Top-down Chart Parsing(1/6)Top-down Chart Parsing(1/6)

Failing student looked hard

?S S

?NP

?VP

NP?

A?

N

NP?

PRP?

N

Page 23: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Top-down Chart Parsing(2/6)Top-down Chart Parsing(2/6)

Failing student looked hard

NP?

A?

N

A

S?

NP?

VP

N

NPFailing

A?

N

NPFailing

Astudent

N

NPFailing

Astudent

N?

VP S

Page 24: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Top-down Chart Parsing(3/6)Top-down Chart Parsing(3/6)

Failing student looked hard

PRP N

S?

NP

?

VP

NP?

PRP

?

NNP

Failing

PRP

?

N

NPFailing

PRP

student

N

NPFailing

PRPstudent

N?

VP S

Page 25: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Top-down Chart Parsing(4/6)Top-down Chart Parsing(4/6)

Failing student looked hard

V A

VP?

V

?

A VPlooked

V

?

AVP

looked

V

hard

A

Page 26: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Top-down Chart Parsing(5/6)Top-down Chart Parsing(5/6)

Failing student looked hard

V AV

VP?

V

?

AV VPlooked

V

?

AVVP

looked

V

hard

AV

Page 27: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Top-down Chart Parsing(6/6)Top-down Chart Parsing(6/6)

Failing student looked hard

VPlooked

V

hard

A

NPFailing

Astudent

N?

VP SNP

FailingAstudent

N SVP

lookedV

hardA

Page 28: Algorithm Schemata and Data Structures in Syntactic Processing

[email protected]@pusan.ac.kr

                                                 

Parsing Graph & TableParsing Graph & Table