AI 양식 하얀색 바탕

Download Report

Transcript AI 양식 하얀색 바탕

Context-Free Grammars
for English
인공지능 연구실
허희근
Context-Free Grammars for English
1
Contents








Introduce
What is a CFG (Context-Free Grammar)
Context-Free Rules and Trees
Sentence-Level Constructions
The Noun Phrase
Coordination
Agreement
The Verb Phrase and Subcategorization
Context-Free Grammars for English
2
Introduce(1)
 Introduce a number of more complex notion of syntax and
grammar.
– Three main new ideas
• Constituency : 단일 unit 또는 phrase를 가지는 word group
– Ex) noun pharse
• Grammatical relations : SUBJECTS와 OBJECTS에 대한 전통문법
형식화
– Ex) She ate a mammoth breakfast.
» she (SUBJECT), a mammoth breakfast (OBJECT)
• Subcategorization and dependencies : words와 phrase사이의 relation
Context-Free Grammars for English
3
Introduce(2)
 Introduce the use of Context-Free Grammars.
– All of these kinds of syntactic knowledge can be modeled by various
kinds of grammars that are based on CFG.
– CFG are backbone of many models of the syntax of natural language
(of computer languages).
– Powerful enough to express sophisticated relations among the words
in a sentence.
– CFG are integral to most models of natural language understanding,
of grammar checking.
Context-Free Grammars for English
4
What is a CFG (Context-Free Grammar) (1)
 영문에서 문장은 phrase가 모여 이루어진 것이므로 문
장의 구조를 명확히 하기 위해서는 구의 구성을 아는
것이 기본이라는 것으로 출발
 문장의 처음부터 끝까지 rewriting rule을 적용함으로써
그 문장을 표현하는 parse tree를 구성해 나가는 것
Context-Free Grammars for English
5
What is a CFG (Context-Free Grammar) (2)
 Rewriting rule
(a) S
NP·VP·PP
(b) VP
V·NP
(c) NP
DET·N
(d) NP
N
(e) PP
PREP·NP
(f) N
boy, window, hammer
(g) DET
the, a
(h) V
broke
(i) PREP
with
– 이러한 법칙을 문장의 처음부터 끝까지 적용하여 tree를 만듦
Context-Free Grammars for English
6
What is a CFG (Context-Free Grammar) (3)
 CFG parse tree (The boy broke the window with a hammer.)
Context-Free Grammars for English
7
Context-Free Rules and Trees(1)
 CFG는 일반적으로 영문이나 다른 자연어에서 그것을
구성하는 구조를 모델화할 때 가장 많이 쓰이는 수학적
시스템
 CFG는 rules 또는 productions 의 set을 구성
– 이것들은 Language symbols이 그룹화하고 순서를 정할 수 있
는 방법을 표현
– Symbols는 CFG가 두 개의 클래스로 나눌 때 사용
• Terminal symbols : word에 해당하는 symbols (“the”, “nightclub”)
• Non-terminals : terminal symbols의 clusters 또는 generalization을 표
현하는 symbols
Context-Free Grammars for English
8
Context-Free Rules and Trees(2)
 CFG는 보통 두 가지의 방법으로 생각함
– 문장을 일반화 시키기 위한 방법
– 주어진 문장의 구조의 정하기 위한 방법
– Generator :
(arrow)
• Rewrite the symbol on the left with the string of symbols on the right.
– CFG는 랜덤하게 연속된 string을 일반화시킬 때 사용
• This sequence of rule expansions is called a derivation of the string of
words.
• Represent a derivation by a parse tree
Context-Free Grammars for English
9
Context-Free Rules and Trees(3)
Sample lexicon
Context-Free Grammars for English
Grammar rule
10
Context-Free Rules and Trees(3)
Parse tree
Context-Free Grammars for English
11
Sentence-Level Constructions
 There are a great number of possible overall sentence
structures.
– But four are particularly common and important.
•
•
•
•
Declarative structure
Imperative structure
Yes-no-question structure
Wh-question structure
Context-Free Grammars for English
12
The Noun Phrase(1)
 The syntax of English allows for both prenominal (pre-head)
modifiers and post-nominal (post-head) modifiers.
– Before the Head Noun
• Noun phrases can begin with a determiner
– Ex) a stop, the flights, that fare, this flight, those flights…
– Noun이 복수형일 때는 determiner 생략할 수 있음
• Predeterminers : word class appear in the NP before the determiner.
– Common predeterminer is all
– Ex) all the flights, all flight
• Word class appear in the NP between the determiner and the head noun.
– Cardinal numbers, ordinal numbers, quantifiers
• rule of prenominal modifiers
– NP
(Det) (Card) (Ord) (Quant) (AP) Nominal
Context-Free Grammars for English
13
The Noun Phrase(2)
– After the Noun
• A head noun can be followed by postmodifiers.
– Prepositional phrases, relative clauses
• brackets inserted to show the boundaries of each PP.
– Ex) a reservation [on flight six oh six] [form Tampa] [to Montreal]
– Nominal
Nominal PP (PP) (PP)
Context-Free Grammars for English
14
Coordination
 Noun phrases and other units can be conjoined with
conjunctions like and, or, and but.
– NP
– VP
– S
NP and NP
VP and VP
S and S
Context-Free Grammars for English
15
Agreement
 Rule of 3sg subjects and non-3sg subjects
– S
S
S
Aux NP VP
3sgAux : does | has | can | …
3sgAux 3sgNP VP
Non3sgAux Non3sgNP VP Non3sgAux : do | have | can | …
– 3SgNP
(Det) (Card) (Ord) (Quant) (AP) SgNominal
– Non3SgNP
(Det) (Card) (Ord) (Quant) (AP) PlNominal
Context-Free Grammars for English
16
The Verb Phrase and Subcategorization
Some subcategorization frames and example verbs
Context-Free Grammars for English
17