combinatory categorial grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · i variants of categorial...

35
Combinatory Categorial Grammar Weiwei Sun Institute of Computer Science and Technology Peking University June 9, 2015

Upload: others

Post on 11-Mar-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Combinatory Categorial Grammar

Weiwei Sun

Institute of Computer Science and TechnologyPeking University

June 9, 2015

Page 2: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Three traditions

Phrase Structure Grammar

S

VP

NP

Mary

V

likes

NP

John

Dependency Grammar

John likes Mary

subj obj

root

Today’s lecture: Categorial Grammar

John likes Mary

NP (S\NP)/NP NP>

S\NP<

S

Weiwei Sun Combinatory Categorial Grammar 2/29

Page 3: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Categories and the lexicon

I In a categorial grammar, all constituents—and in particularthe lexical elements—are associated with a very specificcategory which define their syntactic behaviour.

I A set of universal rules defines how words and otherconstituents can be combined according to their categories.

I Variants of categorial grammar differ in the rules they allow.

I Syntactic and semantic descriptions are tightly connected ⇒CG is popular amongst logicians and semanticists.

Example

(S\NP)/NP for transitive verbs encodes the information:

I the verb takes a noun phrase to its right, and

I another noun phrase to its left to form a sentence.

Weiwei Sun Combinatory Categorial Grammar 3/29

Page 4: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Categories and the lexicon

I In a categorial grammar, all constituents—and in particularthe lexical elements—are associated with a very specificcategory which define their syntactic behaviour.

I A set of universal rules defines how words and otherconstituents can be combined according to their categories.

I Variants of categorial grammar differ in the rules they allow.

I Syntactic and semantic descriptions are tightly connected ⇒CG is popular amongst logicians and semanticists.

Example

(S\NP)/NP for transitive verbs encodes the information:

I the verb takes a noun phrase to its right, and

I another noun phrase to its left to form a sentence.

Weiwei Sun Combinatory Categorial Grammar 3/29

Page 5: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Categories and the lexicon

I In a categorial grammar, all constituents—and in particularthe lexical elements—are associated with a very specificcategory which define their syntactic behaviour.

I A set of universal rules defines how words and otherconstituents can be combined according to their categories.

I Variants of categorial grammar differ in the rules they allow.

I Syntactic and semantic descriptions are tightly connected ⇒CG is popular amongst logicians and semanticists.

Example

(S\NP)/NP for transitive verbs encodes the information:

I the verb takes a noun phrase to its right, and

I another noun phrase to its left to form a sentence.

Weiwei Sun Combinatory Categorial Grammar 3/29

Page 6: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Categories

Definition

The set of syntactic categories C is defined recursively:

I Atomic categories: the grammar for each language isassumed to define a finite set of atomic categories, usuallyS,NP,N,PP, ... ∈ C

I Complex categories: if X and Y ∈ C, then X/Y,X\Y ∈ C

Complex categories X/Y or X\Y are functors

I X: a result

I Y: an argument

I /: arguments to the right of the functor

I \: arguments to the left of the functor

Weiwei Sun Combinatory Categorial Grammar 4/29

Page 7: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Lexical categories

Complex categories encode subcategorisation information

I intransitive verb: S\NP � walked

I transitive verb: (S\NP)/NP � respected

I ditransitive verb: ((S\NP)/NP)/NP � gave

Complex categories can encode modification

I PP nominal: (NP\NP)/NP

I PP verbal: ((S\NP)\(S\NP))/NP

There is no explicit difference made between phrases and words:An intransitive verb is described in the same way as a verb phrasewith an object: S\NP.

Weiwei Sun Combinatory Categorial Grammar 5/29

Page 8: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Lexicalization

The Principle of Lexical Head Government

Both bounded and unbounded syntactic dependencies are spec-ified by the lexical syntactic type of their head.

Lexical entries do most of the grammatical work of mapping thestrings of the language to their interpretations.

Example

(1) a. John ` NP � John is a noun phrase.

b. shares ` NP � shares is a noun phrase.

c. buys ` (S\NP)/NP � buy is a transitive verb.

d. sleeps ` S\NP � sleeps is an intransitive verb.

e. well ` (S\NP)/(S\NP) � well can modify aS\NP-like thing.

Weiwei Sun Combinatory Categorial Grammar 6/29

Page 9: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Lexicalization

The Principle of Head Categorial Uniqueness

A single nondisjunctive lexical category for the head ofa given construction specifies both the bounded dependenciesthat arise when its complements are in canonical positionand the unbounded dependencies that arise when those comple-ments are displaced under relativization, coordination, and thelike.

admire ` (S\NP)/NP

(2) a. John admires Mary.

b. the man that I believe that John admires.

c. I believe that John admires and you believe that hedislikes, the woman in the skinny skirt.

Weiwei Sun Combinatory Categorial Grammar 7/29

Page 10: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

AB Categorial Grammar

I The system defined by Ajdukiewicz (1935) and Bar-Hillel(1953) forms the basis for CCG and all other variants ofcategorial grammar.

I In AB categorial grammar, categories can only combinethrough function application.

Forward application

X/Y Y ⇒ X (>)

Backward application

Y X\Y ⇒ X (<)

Weiwei Sun Combinatory Categorial Grammar 8/29

Page 11: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

AB categorial grammar

I A string α is grammatical if each word in the string can beassigned a category (as defined by the lexicon) so that thelexical categories of the words in α can be combined(according to the grammar rules) to form a constituent.

I The process of combining constituents in this manner is calleda derivation.

Example

John buys shares

NP (S\NP)/NP NP>

S\NP<

S

Weiwei Sun Combinatory Categorial Grammar 9/29

Page 12: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Categories as complex objects

The basic categories like S and NP can, and in fact must, beregarded as complex objects that include both major syntacticfeatures.

married ` (S\NP3s)/NP

Anna married Manny

NP3sf (S\NP3s)/NP NP>

S\NP3s<

S

Weiwei Sun Combinatory Categorial Grammar 10/29

Page 13: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

More examples

我 病 了

NP S\NP (S\NP)\(S\NP)>

S\NP<

S

我们 参观 了 北京大学

NP (S\NP)/NP ((S\NP)/NP)\((S\NP)/NP) NP>

(S\NP)/NP>

S\NP<

S

Weiwei Sun Combinatory Categorial Grammar 11/29

Page 14: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Adjuncts

Modification

In Categorial Grammar, adjuncts have the following general form:X\X or X/X.

The small cat chased Mary quickly round the garden

np/n n/n n (s\np)/np np (s\np)/(s\np) ((s\np)/(s\np))/np np/n n> > >

n s\np np> < >

np s\np (s\np)\(s\np)<

s\np<s

Weiwei Sun Combinatory Categorial Grammar 12/29

Page 15: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Lexicalization (cont)

L. Bloomfield, Language

The lexicon is really an appendix of the grammar, alist of basic irregularities. This is all the more evident ifmeanings are taken into consideration, since the mean-ing of each morpheme belongs to it by an arbitrarytradition.

CG’s view

I If this is the case, nothing in the lexicon is predictable,hence we do not need a theory of the lexicon.

I CG argues that this dichotomy gets in the way of ourunderstanding of how syntax can shape possible lexicons.

* Any combinatory difference must be lexically specifiable.

Weiwei Sun Combinatory Categorial Grammar 13/29

Page 16: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Interpretation and Predicate-Argument Structure

Architecture

Syntactic structure (CCG derivation) + Lexical interpretation⇓

Meaning representation

Using a Dependency Interpretation

John buys shares

NP

: john

(S\NP1)/NP2

: buy→ NP1 ∧ buy→ NP2

NP

: shares

>S\NP

: buy→1 NP1 ∧ buy→2 shares

<S

: buy→1 john ∧ buy→2 shares

buy ` (S\NP1)/NP2 : buy→ NP1 ∧ buy→ NP2

I Syntactic category: (N\N)/NPI Semantic type (intuitive idea): the NP indexed with “2” is the

Patient of buy; the NP indexed with “1” is the Agent of buy.

Weiwei Sun Combinatory Categorial Grammar 14/29

Page 17: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Interpretation and Predicate-Argument Structure

Architecture

Syntactic structure (CCG derivation) + Lexical interpretation⇓

Meaning representation

Using a Dependency Interpretation

John buys shares

NP : john (S\NP1)/NP2 : buy→ NP1 ∧ buy→ NP2 NP : shares>

S\NP

: buy→1 NP1 ∧ buy→2 shares

<S

: buy→1 john ∧ buy→2 shares

buy ` (S\NP1)/NP2 : buy→ NP1 ∧ buy→ NP2

I Syntactic category: (N\N)/NPI Semantic type (intuitive idea): the NP indexed with “2” is the

Patient of buy; the NP indexed with “1” is the Agent of buy.

Weiwei Sun Combinatory Categorial Grammar 14/29

Page 18: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Interpretation and Predicate-Argument Structure

Architecture

Syntactic structure (CCG derivation) + Lexical interpretation⇓

Meaning representation

Using a Dependency Interpretation

John buys shares

NP : john (S\NP1)/NP2 : buy→ NP1 ∧ buy→ NP2 NP : shares>

S\NP : buy→1 NP1 ∧ buy→2 shares<

S

: buy→1 john ∧ buy→2 shares

buy ` (S\NP1)/NP2 : buy→ NP1 ∧ buy→ NP2

I Syntactic category: (N\N)/NPI Semantic type (intuitive idea): the NP indexed with “2” is the

Patient of buy; the NP indexed with “1” is the Agent of buy.

Weiwei Sun Combinatory Categorial Grammar 14/29

Page 19: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Interpretation and Predicate-Argument Structure

Architecture

Syntactic structure (CCG derivation) + Lexical interpretation⇓

Meaning representation

Using a Dependency Interpretation

John buys shares

NP : john (S\NP1)/NP2 : buy→ NP1 ∧ buy→ NP2 NP : shares>

S\NP : buy→1 NP1 ∧ buy→2 shares<

S : buy→1 john ∧ buy→2 shares

buy ` (S\NP1)/NP2 : buy→ NP1 ∧ buy→ NP2

I Syntactic category: (N\N)/NPI Semantic type (intuitive idea): the NP indexed with “2” is the

Patient of buy; the NP indexed with “1” is the Agent of buy.

Weiwei Sun Combinatory Categorial Grammar 14/29

Page 20: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Interpretation and Predicate-Argument Structure

Architecture

Syntactic structure (CCG derivation) + Lexical interpretation⇓

Meaning representation

Using a Dependency Interpretation

John buys shares

NP : john (S\NP1)/NP2 : buy→ NP1 ∧ buy→ NP2 NP : shares>

S\NP : buy→1 NP1 ∧ buy→2 shares<

S : buy→1 john ∧ buy→2 shares

buy ` (S\NP1)/NP2 : buy→ NP1 ∧ buy→ NP2

I Syntactic category: (N\N)/NPI Semantic type (intuitive idea): the NP indexed with “2” is the

Patient of buy; the NP indexed with “1” is the Agent of buy.

Weiwei Sun Combinatory Categorial Grammar 14/29

Page 21: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

The principle of type transparency

The principle of Categorial Type Transparency

For a given language, the semantic type of the interpretation to-gether with a number of language-specific directional parametersettings uniquely determines the syntactic category of a category.

The inverse of Type Transparency

For any category, the semantic type is a function of the syntactictype.

The Principle of Combinatory Type Transparency

All syntactic combinatory rules are type-transparent versions ofone of a small number simple semantic operations over functions.

Weiwei Sun Combinatory Categorial Grammar 15/29

Page 22: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Combinatory Categorial Grammar: Overview

Transparency

I Combinatory Categorial Grammar (CCG) is a grammaticaltheory which provides a completely transparent interfacebetween surface syntax and underlying semantics.

I Each (complete or partial) syntactic derivation correspondsdirectly to an interpretable structure.

Pioneer: Mark Steedman

I Surface Structure andInterpretation

I The Syntactic Process

Weiwei Sun Combinatory Categorial Grammar 16/29

Page 23: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Combinatory Categorial Grammar: Overview

Extending AB Grammar

I CCG extends AB categorial grammar by a set of ruleschemata based on the combinators of combinatory logic.

I CCG facilitates the recovery of the non-local dependenciesI Syntactically, they allow analyses of extraction and

coordinate constructions which use the same lexicalcategories for the heads of such constructions as in thecanonical case.

I Semantically, they guarantee that non-local dependenciesfill the same argument slots as local dependencies.

I The weak generative power of AB Grammar and CFG areis equivalent.

I Extra combinatory rules increase the weak generativepower to mild context-sensitivity.

Weiwei Sun Combinatory Categorial Grammar 17/29

Page 24: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Coordination

Simplified coordination rule

X CONJ X′ ⇒ X′′ (Φ)

I X, X′ and X′′ are categories of the same type but differentinterpretations.

Example

Anna met and married Manny

NP (S\NP)/NP CONJ (S\NP)/NP NP<Φ>

(S\NP)/NP>

S\NP<

S

Weiwei Sun Combinatory Categorial Grammar 18/29

Page 25: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Composition

Forward composition

X/Y Y/Z ⇒B X/Z (> B)

Example

Anna met and might marry Manny

NP (S\NP)/NP CONJ (S\NP)/VP VP/NP NP>B

(S\NP)/NP<Φ>

(S\NP)/NP>

S\NP<

S

Abbreviation

I VP: S\NP

Weiwei Sun Combinatory Categorial Grammar 19/29

Page 26: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Composition

Generalized forward composition

X/Y (Y/Z)/$1 ⇒Bn (X/Z)/$1 (> Bn)

Example

I offered, and may give, a flower to Mary

NP ((S\NP)/PP)/NP CONJ (S\NP)/VP ((S\NP)/PP)/VP NP PP>B2

((S\NP)/PP)/NP

Weiwei Sun Combinatory Categorial Grammar 20/29

Page 27: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Type raising

Forward type raising

X ⇒T T/(T\X) (> T)

I T/(T\X) is a parametrically licensed category for thelanguage.

Extraction out of a relative clause

The company which Google bought

NP/N N (NP\NP)/(S/NP) NP (S\NP)/NP> >T

NP S/(S\NP)>B

S/NP>

NP\NP<

NP

Weiwei Sun Combinatory Categorial Grammar 21/29

Page 28: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Forward composition and type-raising

Right-node raising

Mary ordered and John ate the tapas

NP (S\NP)/NP CONJ NP (S\NP)/NP NP>T >T

S/(S\NP) S/(S\NP)>B >B

S/NP S/NP<Φ>

S/NP>

S

Weiwei Sun Combinatory Categorial Grammar 22/29

Page 29: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Backward composition and type-raising

Backward composition

Y\Z X\Y ⇒B X\Z (< B)

Backward type raising

X ⇒T T\(T/X) (< T)

I T\(T/X) is a parametrically licensed category for thelanguage.

Weiwei Sun Combinatory Categorial Grammar 23/29

Page 30: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Backward composition and type-raising

Abbreviation

I TV: VP/NP

I DTV: (VP/NP)/NP

Example

give John an apple and Mary a flower<T <T <T <T

DTV TV\DTV VP\TV CONJ TV\DTV VP\TV<B <B

VP\DTV VP\DTV<Φ>

VP\DTV<

VP

Weiwei Sun Combinatory Categorial Grammar 24/29

Page 31: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Backward crossed substitution

Forward crossing composition

Y/Z (X\Y)/Z ⇒S X/Z (< S×)

Example

which I will file without reading

(N\N)/(S/NP) S/VP VP/NP (VP\VP)/VPing VPing/NP>B

(VP\VP)/NP<S×

VP/NP>B

S/NP>

N\N

Weiwei Sun Combinatory Categorial Grammar 25/29

Page 32: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

CG vs. CFG

I Categorial grammars put into the lexicon most of theinformation that is captured in CFG rules.

I In categorial grammars, all constituents and lexical elementsare associated with a syntactic “category.”

Example

S → NP VPVP → TV NPTV → married|finds|...

married := (S\NP)/NP.

Weiwei Sun Combinatory Categorial Grammar 26/29

Page 33: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

LTAG vs. CCG

Lexicalized TAGs are similar to CCGs

For each lexical item the elementary tree(s) which is (are) an-chored on that lexical item can be regarded as the (structured)category (categories) associated with that item.

Example

D

a

NP

N

cookies

NP

N

John

NP

N

book

D↓

N

N∗ADJ

tall

VP

ADV

quickly

VP∗

D NP NP NP\D N/N VP\VP

Weiwei Sun Combinatory Categorial Grammar 27/29

Page 34: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

LTAG vs. CCG (cont)

Lexicalized TAGs are similar to CCGs

For each lexical item the elementary tree(s) which is (are) an-chored on that lexical item can be regarded as the (structured)category (categories) associated with that item.

Example

S

VP

NP↓NP↓V

gave

NP↓

S

VP

NP↓V

eats

NP↓

S

VP

S∗V

thinks

NP↓

((S/NP)/NP)\NP (S/NP)\NP (S/S)\NP

Weiwei Sun Combinatory Categorial Grammar 28/29

Page 35: Combinatory Categorial Grammar59.108.48.12/lcwm/course/fs/lec/ccg.pdf · I Variants of categorial grammar di er in the rules they allow. I Syntactic and semantic descriptions are

Reading

I Chpt. 3 The Syntactic Process

Weiwei Sun Combinatory Categorial Grammar 29/29