38
LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Embed Size (px)

Citation preview

Page 1: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

LING 581: Advanced Computational Linguistics

Lecture NotesMarch 23rd

Page 2: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Administrivia

• Welcome back!• Task 3 is due

Page 3: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Homework Task

Treebank• There are 180487 VPs in the

Wall Street Journal section• Q: what kinds of verb

frames are attested?EVCA Project• Pick verbs that exist in EVCA

(evca93.index) and also in the PTB

• Produce a report that compares EVCA with what is present in the corpus

Page 4: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Minimalist Syntax

From stochastic parsing to the (near) latest in syntax• Paper:

– Derivation by Phase (DbP) (Chomsky) – (manuscript 1999, published 2001)

• 4 files on usb drive– Reading Homework over Spring Break– dpb.pdf (the unlocked published version)

you may find the following notes very useful– JU_DbP_1.pdf (DbyP with inline notes from Juan Uriagereka)– JU_DbP_2.pdf (part 2)– Yoon_DbP.pdf (notes from James Yoon, UIUC)

Page 5: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Software

• Code– GUI: (Tcl/Tk side) treeserver.tcl– GUI: (Prolog side) prolog_client.pl– Grammar: (GUI version) grammar8.pl

• What you need– Tcl/Tk wish

interpreter– Prolog SWI

Prolog– Command line (some) shell

Page 6: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Processes

• Process #1run treeserver.tcl

under wish interpreter

– example:bash-3.2$ wish treeserver.tclConnection from 127.0.0.1channel closed

• Process #2run SWI-Prolog

– example:bash-3.2$ swiplWelcome to SWI-Prolog (Multi-threaded, 64 bits, Version

5.8.3)

?- [prolog_client, grammar8].% library(error) compiled into error 0.00 sec, 17,480 bytes% library(lists) compiled into lists 0.01 sec, 39,256 bytes% library(shlib) compiled into shlib 0.01 sec, 59,552 bytes% library(unix) compiled into unix 0.01 sec, 65,968 bytes% prolog_client compiled 0.01 sec, 134,368 bytes% grammar8 compiled 0.00 sec, 46,816 bytestrue.

chatter: uses sockets to communicate with Prolog side

Page 7: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Example 1

• John likes Mary• Run in SWI Prolog window?- parse([john,like,mary]).Probe [v*] agrees with goal

[n mary]Probe [t] agrees with goal

[n john][c[c][t[n john][t[t][v[n john]

[v[v*][V[V like][n mary]]]]]]]

true ;false.

Click to see derivation steps

Tree display zoom slider

Agree(P,G) computationsdisplayedterminal parse output: same

as last step of GUI output

Page 8: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Current Limitations• John likes Mary• Run in SWI Prolog window?- parse([john,like,mary]).Probe [v*] agrees with goal

[n mary]Probe [t] agrees with goal

[n john][c[c][t[n john][t[t][v[n

john][v[v*][V[V like][n mary]]]]]]]

true ;false.

Implementation limitations:1. No Spell-Out implemented (just

narrow syntax)T + v* f(phi,3-sg-f)+ V(like) = likes

2. No head movement/affix-hopping implemented (part of Spell-Out)input: awarded -> [ed,award]

3. No undo of displacement implemented(displacement is computed from base position)input:[be,ed,award,several,prizes]Several prizes are awarded

Note: not inflected

Spell-Out: implementation of simple inflectional morphology would be straightforwardParsing from final landing sites would require an additional computational mechanism

Page 9: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Interacting with the Grammar• parse(List).

– Prolog List = input sentence1. Opens a socket connection to

display server2. Calls the definite clause grammar

(DCG) rule for a clause: c(Parse,List,[]).

3. Closes socket connection

• resetDisplay.1. Opens a socket connection to

display server2. Clears the display history for a

derivation3. Closes socket connection

• Components of parse(List) can be called separately– open_connection.– close_connection.– X(Parse,List,[]).

• X = grammar rule name

– useful when other DCG rules need to be called directly

• Implementation (prolog_client.pl)

parse(List) :-open_connection,c(Parse,List,[]),format('~p~n',[Parse]),close_connection.

use after each derivation

Page 10: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Four Examples

Page 11: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Example 1• There are likely to be awarded several

prizes• (note input lexme order)?-

parse([be,likely,there,be,ed,award,several,prizes]).

Probe [a!case ed] agrees with goal [n!case several prizes]

Probe [tdef] agrees with goal [n!case several prizes]

Probe [t!phi] agrees with goal [n!phi there]

Probe [t] agrees with goal [n several prizes]

[c[c][t[n there][t[t][v[v be][a[a likely][t[n there][t[tdef][v[v be][a[a ed][V[V award][n several prizes]]]]]]]]]]]

true ;false.

Page 12: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Example 2• Several prizes are likely to be awarded• (note input lexeme order)?- resetDisplay.true.

?- parse([be,likely,be,ed,award,several,prizes]).

Probe [a!case ed] agrees with goal [n!case several prizes]

Probe [tdef] agrees with goal [n!case several prizes]

Probe [t] agrees with goal [n several prizes][c[c][t[n several prizes][t[t][v[v be][a[a

likely][t[n several prizes][t[tdef][v[v be][a[a ed][V[V award][n several prizes]]]]]]]]]]]

true ;false.

Page 13: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Example 3• we expect there to be awarded several prizes

(note input lexeme order)

?- parse([we,expect,there,be,ed,award,several,prizes]).

Probe [a!case ed] agrees with goal [n!case several prizes]

Probe [tdef] agrees with goal [n!case several prizes]

Probe [v*!phi] agrees with goal [n!phi there]Probe [v*] agrees with goal [n several prizes]Probe [t] agrees with goal [n we][c[c][t[n we][t[t][v[n we][v[v*][V[V expect]

[t[n there][t[tdef][v[v be][a[a ed][V[V award][n several prizes]]]]]]]]]]]]

true ;false.

Page 14: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Example 4• we expect several prizes to be awarded

(note input lexeme order)

?- parse([we,expect,be,ed,award,several,prizes]).

Probe [a!case ed] agrees with goal [n!case several prizes]

Probe [tdef] agrees with goal [n!case several prizes]

Probe [v*] agrees with goal [n several prizes]

Probe [t] agrees with goal [n we][c[c][t[n we][t[t][v[n we][v[v*][V[V expect]

[t[n several prizes][t[tdef][v[v be][a[a ed][V[V award][n several prizes]]]]]]]]]]]]

true ;false.

Page 15: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Basic Computation• start with lexical array of syntactic

objects: {α,..,ω}• Merge “an indispensible operation of a

recursive system”• (external)

– two syntactic objects (SOs): α, β– create merged SO: {α, β}– label({α, β})=label(α) or label(β)

• (internal), implements Displacement– SOs: α and γ, γ properly contained in α – create SO: {α, γ}– label({α, γ})=label(α)

• Agree– active probe SO: α (active =

uninterpretable features), goal SO: β– match and delete uninterpretable features

of probe and goal• Convergent derivation: uninterpretable

features must be eliminated

copy

v*: φ, accN: φ, Case

Page 16: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Basic Implementation (1)Definite clause grammar (DCG) (simplified)

V([V V N]) --> V(V), n(N).

V([V Verb]) --> [Verb].

features (V) features (N)– phonetic matrix: f(pmatrix,like) f(pmatrix,john)

– (takes an) argument: f(arg,+) f(arg,+)

– uninterpretable Case: f(case,_)

% (big V) verb classesbV(n('V',[],[V,N])) --> bV0(V), n0(N), {theta(V),theta(N)} report 'theta merge V & N'.bV0(n('V',[f(pmatrix,Verb),f(arg,+)],[])) --> [Verb], {transitive(Verb)}.bV0(n('V',[f(pmatrix,Verb),f(arg,+)],[])) --> [Verb], {unaccusative(Verb)}.bV0(n('V',[f(pmatrix,Verb)],[])) --> [Verb], {unergative(Verb)}.

transitive(like). transitive(expect).unergative(run). unaccusative(arrive).

n0(n(n,[f(pmatrix,BNoun)|Fs],[])) --> [BNoun], {bareNoun(BNoun,Fs)}.bareNoun(john,[f(phi,3-sg-m),f(case,_),f(arg,+)]).

variable

Page 17: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Basic Implementation (2)

Definite clause grammar (DCG) (simplified)v([v N v]) --> n(N), v(v).

v([v v V]) --> v(v), V(V).

v([v*]) --> [].

– features (v*)• uninterpretable φ-features: f(phi,_-_-_)

• can value accusative Case: f(case,acc)

% v*/vPv(n(v,[],[N,V])) --> n0(N), {theta(N)}, v1(V) report 'theta merge N & v'.v1(n(v,[],[V,BV])) --> v0(V), bV(BV), {goals(BV,Goals),agree(V,Goals)} report 'merge v & V'.v0(n('v*',[f(phi,_-_-_),f(case,acc)],[])) --> [].

triggers Agree

f(phi,_-_-_)f(case,acc)

f(phi,3-sg-f)f(case,_)

Page 18: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Basic Implementation (2)

f(phi,_-_-_)f(case,acc)

f(phi,3-sg-f)f(case,_)

• Agree(v*,N)

Operation: unification (Robinson, 1965)(match and instantiate unvalued features)Probe Goalf(phi,_-_-_) f(phi,3-sg-f)f(case,acc) f(case,_)

Uninterpretable/unvalued features (represented by variables) are eliminated

Page 19: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Basic Implementation (3)

Definite clause grammar (DCG)T([T N v]) --> n(N), v(v).

T([T N v]) --> v(v), {N a goal}

T([T]) --> [].

– features (φ-complete T)• uninterpretable φ-features: f(phi,_-_-_)

• can value nominative Case: f(case,nom)

• EPP

t(n(t,[],[N,T])) --> n0(N), {nonarg(N)}, t1(T,_) report 'merge expl & T'. % EPP: (1) merget(n(t,[],[Goal,T])) --> t1(T,Goal) report 'move to spec-T’. % EPP: (2) move with maximize matching

t1(n(t,[],[T,V]),G) --> t0(T), v(V), {goals(V,Goals),agree(T,Goals), Goals = [G|_]} report 'merge T & v’.t0(n(t,[f(phi,_-_-_),f(case,nom)],[])) --> [].

triggers Agree

defective Tφ-incompletee.g. infinitivals

Page 20: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Putting it all together (1)

Page 21: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Putting it all together (2)

Page 22: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Putting it all together (3)

Page 23: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Putting it all together (4)

Page 24: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Putting it all together (5)

(EPP requirement)

Page 25: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Putting it all together (6)Operation: Spell-Out (not currently implemented)“John likes Mary”only one copy of John is pronouncedbundleT + v* f(phi,3-sg-f)+ V (like) = likes

Page 26: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

A Worked Example

Consider the derivation of• several prizes are likely to be awarded (= 4(b)(ii))

awarded = award + -ed (adjectival participle)

?- parse([be,likely,be,ed,award,several,prizes]).Probe [a!case ed] agrees with goal [n!case several prizes]Probe [tdef] agrees with goal [n!case several prizes]Probe [t] agrees with goal [n several prizes][c[c][t[n several prizes][t[t][v[v be][a[a likely][t[n several prizes][t[tdef][v[v be][a[a ed][V[V award][n several prizes]]]]]]]]]]]

ϕ-incomplete: uninterpretable Number and Gender onlyuninterpretable Casemorphologically unrealized in English (cf. Icelandic)

-ed

Agree(a,N)-ed: φ, CaseN: φ, Case

Page 27: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

A Worked Example

Page 28: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

A Worked Example

Agree(a,N)-ed: φ, CaseN: φ, Case

Notation: !case means feature is unvalued

Page 29: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

A Worked Example

Agree(Tdef,N)Tdef: φN: φ, Case

Page 30: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

A Worked Example

(several prizes raises to subject position of embedded infinitival)

Page 31: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

A Worked Example

Agree(T,N)T: φ, NominativeN: φ, Case

Case for –ed also valuedbecause of earlier unification stepAgree(a,N)-ed: φ, CaseN: φ, Case

Matrix T

Unification presents an possible advantage: computation is more local

Page 32: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Probing with multiple goals

(Chomsky 2001)compare with…

Page 33: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

A Worked Example

Spell-OutSeveral prizes are likely to be awarded

Page 34: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Another Example

?- parse([be,likely,there,be,ed,award,several,prizes]).Probe [a!case ed] agrees with goal [n!case several prizes]Probe [tdef] agrees with goal [n!case several prizes]Probe [t!phi] agrees with goal [n!phi there]Probe [t] agrees with goal [n several prizes][c[c][t[n there][t[t][v[v be][a[a likely][t[n there][t[tdef][v[v be]

[a[a ed][V[V award][n several prizes]]]]]]]]]]]

Consider also the derivation of• There are likely to be awarded several prizes(= 4(b)(i))

pleonastic there: φ-incomplete (Person only)

Agree(a,N)-ed: φ, CaseN: φ, Case

Agree(T,N)T: φN: φ

Page 35: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Another Example

Agree(a,N)-ed: φ, CaseN: φ, Case

Page 36: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Examples

(Chomsky 2001)

• Examples (ECM):– (i) we expect there to be awarded several prizes– (ii) we expect several prizes to be awarded

Page 37: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Example: we expect several prizes to be awarded

Prior Unification: locality advantage

Case

Page 38: LING 581: Advanced Computational Linguistics Lecture Notes March 23rd

Example: we expect several prizes to be awarded

Spell-OutWe expect several prizes to be awarded