syntactic formalisms for parsing natural languages · 2013. 12. 13. · lecture7.....
TRANSCRIPT
Lecture 7
.
......
Syntactic Formalisms for ParsingNatural Languages
Aleš Horák, Miloš Jakubíček, Vojtěch Kovář(based on slides by Juyeon Kang)
Autumn 2013
IA161 Syntactic Formalisms for Parsing Natural Languages 1 / 29
Lecture 7
Outline
Applicative systemCombinatorsCombinators vs. λ-expressionsApplication to natural language parsingCombinators used in CCG
IA161 Syntactic Formalisms for Parsing Natural Languages 2 / 29
Lecture 7
Applicative system
CL (Curry & Feys, 1958, 1972) as an applicative systemCL is an applicative system because the basic unique operationin CL is the application of an operator to an operand
Operator(Operand)
Operator Operand
IA161 Syntactic Formalisms for Parsing Natural Languages 3 / 29
Lecture 7
Combinators
CL defines general operators, called Combinators.Each combinator composes between them theelementary combinators and defines thecomplexe combinators.Certains combinators are considered as the basic combinatorsto define the other combinators.
IA161 Syntactic Formalisms for Parsing Natural Languages 4 / 29
Lecture 7
Elementary combinators
I =def λx.x (identificator)K =def λx.λy.x (cancellator)W =def λx.λy.xyy (duplicator)C =def λx.λy.λz.xzy (permutator)B =def λx.λy.λz.x(yz) (compositor)S =def λx.λy.λz.xz(yz) (substitution)Φ =def λx.λy.λz.λu.x(yu)(zu) (distribution)Ψ =def λx.λy.λz.λu.x(yz)(yu) (distribution)
IA161 Syntactic Formalisms for Parsing Natural Languages 5 / 29
Lecture 7
β-reductions
The combinators are associated with the β-reductions in acanonical form:
β-reduction relation between X and Y
X ≥β Y
Y was obtained from X by a β-reduction
IA161 Syntactic Formalisms for Parsing Natural Languages 6 / 29
Lecture 7
β-reductions
Ix ≥β xKxy ≥β xWxy ≥β xyyCxyz ≥β xzyBxyz ≥β x(yz)Sxyz ≥β xz(yz)Φxyzu ≥β x(yu)(zu)Ψxyzu ≥β x(yz)(yu)
.
......Each combinator is an operator which has a certain number of arguments (operands);sequences of the arguments which follow the comnator are called “the scope of
combinator”.
IA161 Syntactic Formalisms for Parsing Natural Languages 7 / 29
Lecture 7
β-reductionsIntuitive interpretations of the elementary combinators aregiven by the associated β-reductions.
The combinator I expresses the identity.The combinator K expresses the constant function.The combinator W expresses the diagonalisation or theduplication of an argument.The combinator C expresses the conversion, that is, thepermutation of two arguments of an binary operator.The combinator B expresses the functional composition of twooperators.The combinator S expresses the functional composition and theduplication of argument.The combinator Φ expresses the composition in parallel ofoperators acting on the common data.The combinator Ψ expresses the composition by distribution.IA161 Syntactic Formalisms for Parsing Natural Languages 8 / 29
Lecture 7
Introduction and elimination rules of combinators
Introduction and elimination rules of combinators can bepresented in the style of Gentzen (natural deduction).
Elim. Rules Intro. Rules
If f- - - [e-I] - - - [i-I]f If
Kfx f- - - - - [e-K] - - - - [i-K]f Kfx
IA161 Syntactic Formalisms for Parsing Natural Languages 9 / 29
Lecture 7
Introduction and elimination rules of combinators
Elim. Rules Intro. Rules
Cfx xf- - - [e-C] - - - [i-C]xf Cfx
Bfxy f(xy)- - - - - [e-B] - - - - [i-B]f(xy) Bfxy
Φfxyz f(xz)(yz)- - - - - [e-Φ] - - - - [i-Φ]f(xz)(yz) Φfxyz
IA161 Syntactic Formalisms for Parsing Natural Languages 10 / 29
Lecture 7
Combinators vs. λ -expressions
The most important difference between the CL and λ-calculusis the use of the bounded variables.
Every combinator is an λ -expression.
Bfg ≡ λx.f(gx)Tx ≡ λf.fxSfg ≡ λx.fx(gx)
IA161 Syntactic Formalisms for Parsing Natural Languages 11 / 29
Lecture 7
Application to natural language parsingJohn is brilliant
The predicate is brilliant is an operator which operate on theoperand John to construct the final proposition.The applicative representation associated to this analysis is thefollowing:
(is-brillant)John
We define the operator John* as being constructed from thelexicon John by
[John* = C* John].
1 John* (is-brillant)2 [John* = C* John]3 C*John (is-brillant)4 is-brillant (John)
IA161 Syntactic Formalisms for Parsing Natural Languages 12 / 29
Lecture 7
Application to natural language parsing
John is brilliant in λ-term
Operator John* by λ-expression
[John* = λx.x (John’)]
1 John*(λx.is-brilliant’(x))2 [John* = λx.x (John’)]3 (λx.x(John’))(λx.is-brilliant’(x))4 (λx.is-brilliant’(x))(John’)5 is-brillinat’(John’)
IA161 Syntactic Formalisms for Parsing Natural Languages 13 / 29
Lecture 7
Passivisation
Consider the following sentencesa. The man has been killed.b. One has killed him.
→ Invariant of meaning→ Relation between two sentences:a. unary passive predicate (has-been-killed):b. active transitive predicate (have-killed)
IA161 Syntactic Formalisms for Parsing Natural Languages 14 / 29
Lecture 7
Definition of the operator of passivisation ’PASS’
[PASS = B ∑ C = ∑◦ C]
where B and C are the combinator of composition and ofconversion and where∑ is the existential quantificator which,by applying to a binary predicate, transforms it into the unarypredicate.
IA161 Syntactic Formalisms for Parsing Natural Languages 15 / 29
Lecture 7
Definition of the operator of passivisation ’PASS’
.
...... [PASS = B∑ C =∑◦ C]
1/ has-been-killed (the-man) hypothesis2/ [has-been-killed=PASS(has killed)] passive lexical predicate3/ PASS (has-killed)(the-man) repl.2.,1.4/ [PASS = B∑C ] definition of ’PASS’5/ B∑C (has-killed)(the-man) repl.4.,3.6/ ∑ (C(has-killed))(the-man) [e-B]7/ (C(has-killed)) x (the-man) [e-∑]8/ (has-killed)(the-main) x [e-C]9/ [x in the agentive subject position = one] definition of ’one’10/ (has-killed)(the-man)one repl.9.,8., normal form
IA161 Syntactic Formalisms for Parsing Natural Languages 16 / 29
Lecture 7
Definition of the operator of passivisation ’PASS’
We establish the paraphrastic relation between the passivesentence with expressed agent and its active counterpart:
The man has been killed by the enemy
↓
The enemy has killed the man
IA161 Syntactic Formalisms for Parsing Natural Languages 17 / 29
Lecture 7
Definition of the operator of passivisation ’PASS’
.
......Relation between give-to and receive-from
z gives y to x
↕
x receives y from x
.
......The lexical predicate “give-to” has a predicate converse associated to “receive-from”;
[receive-from z y x = give-to x y z]
IA161 Syntactic Formalisms for Parsing Natural Languages 18 / 29
Lecture 7
Definition of the operator of passivisation ’PASS’
1/ (receive-from) z y x2/ C((receive-from) z) x y3/ BC(receive-from) z x y4/ C(BC(receive-from)) z x y5/ C(C(BC(receive-from)) x) y z6/ BC(C(BC(receive-from))) x y z7/ [give-to=BC(C(BC(receive-from)))]8/ give-to x y z
IA161 Syntactic Formalisms for Parsing Natural Languages 19 / 29
Lecture 7
Combinators used in CCG
Motivation of applying the combinatorsto natural language parsing
Linguistic: complex phenomena of natural language applicableto the various languagesInformatics: left to right parsing (LR)
ex: reduce the spurious-ambiguity
IA161 Syntactic Formalisms for Parsing Natural Languages 20 / 29
Lecture 7
Parsing a sentence in CCG
Step 1: tokenizationStep 2: tagging the concatenated lexiconStep 3: calculate on types attributed to the concatenatedlexicons by applying the adequate combinatorial rulesStep 4: eliminate the applied combinators (we will see how to doon next week)
Step 5: finding the parsing results presented in the form of anoperator/operand structure (predicate -argument structure)
IA161 Syntactic Formalisms for Parsing Natural Languages 21 / 29
Lecture 7
Parsing a sentence in CCG
Example: I requested and would prefer musicalsSTEP 1 : tokenization/lemmatization → ex) POS Tagger,tokenizer, lemmatizer
a. I-requested-and-would-prefer-musicalsb. I-request-ed-and-would-prefer-musical-s
STEP 2 : tagging the concatenated expressions → ex)Supertagger, Inventory of typed words
I NPRequested (S\NP)/NPAnd CONJWould (S\NP)/VPPrefer VP/NPmusicals NP
IA161 Syntactic Formalisms for Parsing Natural Languages 22 / 29
Lecture 7
Parsing a sentence in CCGSTEP 3 : categorial calculus
c. apply the coordination rules Coordination: (< & >)
X conj X ⇒ X
b. apply the functional composition rules Forward Composition: (> B)X/Y : f Y/Z : g ⇒ X/Z : Bfg
a. apply the type-raising rules Subject Type-raising (> T)NP : a ⇒ T/(T\NP) : Ta
7/ S6/ S/NP NP (>)5/ S/(S\NP) (S\NP)/NP NP (>B)4/ S/(S\NP) (S\NP)/NP NP (> Φ)3/ S/(S\NP) (S\NP)/NP CONJ (S\NP)/NP NP (>B)2/ S/(S\NP) (S\NP)/NP CONJ (S\NP)/VP VP/NP NP (>T)1/ NP (S\NP)/NP CONJ (S\NP)/VP VP/NP NP
I- requested- and- would- prefer- musicals
IA161 Syntactic Formalisms for Parsing Natural Languages 23 / 29
Lecture 7
Parsing a sentence in CCG
STEP 4 : semantic representation (predicate-argumentstructure)
7/S: and’(will’(prefer’ musicals’) i’)(request’ musicals’ i’)
6/ :λy.and’(would’(prefer’ musicals’)y)(request’ musicals’ y)
5/ : λxλy.and’(will’(prefer’x)y)(request’xy)
4/ : λxλy.and’(will’(prefer’x)y)(request’xy)
3/ : λx.λy.will’(prefer’x)y
2/ :λf.f I’
1/ :i’ :request’ :and’ : will’ :prefer’ : musicals’
I requested and would prefer musicals
IA161 Syntactic Formalisms for Parsing Natural Languages 24 / 29
Lecture 7
Semantic representation in term of thecombinators
I- requested and- would- prefer musicals1/ NP (S\NP)/NP CONJ (S\NP)/VP VP/NP NP2/ S/(S\NP) (S\NP)/NP CONJ (S\NP)/VP VP/NP NP (>T)
C*I requested and would prefer musicals3/ S/(S\NP) (S\NP)/NP CONJ (S\NP)/NP NP (>B)
C*I requested and B would prefer musicals4/ S/(S\NP) (S\NP)/NP NP (> Φ)
C*I Φ and requested (B would prefer) musicals5/ S/NP NP (>B)
B((C*I)(Φ and requested (B would prefer))) musicals6/ S (>)
B((C*I)(Φ and requested (B would prefer))) musicals
IA161 Syntactic Formalisms for Parsing Natural Languages 25 / 29
Lecture 7
Semantic representation in term of thecombinators
.
...... I requested and would prefer musicals
S: B((C*I)(Φ and requested (B would prefer))) musicals
1/ B((C*I)(Φ and requested (B would prefer))) musicals2/ (C*I)((Φ and requested (B would prefer))) musicals) [e-B]3/ ((Φ and requested (B would prefer))) musicals) I [e-C*]4/ (and (requested musicals) ((B would prefer) musicals)) I [e-Φ]5/ ((and (requested musicals) (would (prefer musicals))) I ) [e-B]
IA161 Syntactic Formalisms for Parsing Natural Languages 26 / 29
Lecture 7
Normal form
A normal form is a combinatory expression which is irreduciblein the sense that it contain any occurrence of a redex.If a combinatory expression X reduce to a combinatoryexpression N which is in normal form, so N is called thenormal form of X.
.Example..
......Bxyz is reducible to x(yz).x(yz) is a normal form of the combinatory expression Bxyz.
IA161 Syntactic Formalisms for Parsing Natural Languages 27 / 29
Lecture 7
Normal form
.Example..
......
Prove xyz is the normal form of BBCxyz.
BBCxyz→β xyz
1/ BBCxyz2/ C(Cx)yz [e-B]3/ Cxzy [e-C]4/ xyz [e-C]
IA161 Syntactic Formalisms for Parsing Natural Languages 28 / 29
Lecture 7
Classwork
Give the semantic representation in term of combinators.Please refer to the given paper on last lecture on CCG Parsing.
IA161 Syntactic Formalisms for Parsing Natural Languages 29 / 29