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]
[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
[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
[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
[email protected]@pusan.ac.kr
Top-down production Top-down production 예문 예문 : radio broadcasts pay: radio broadcasts pay
[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
[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
[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
[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
[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
[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
[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, …
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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
[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