Incrementality in Compositional Distributional Semantics
SemDial 2018 joint work with M. Purver, J. Hough, R. Kempson
SYCO2, Glasgow December 2018
- M. Sadrzadeh, EECS, QMUL
Incrementality in Compositional Distributional Semantics M. - - PowerPoint PPT Presentation
Incrementality in Compositional Distributional Semantics M. Sadrzadeh, EECS, QMUL SemDial 2018 joint work with M. Purver, J. Hough, R. Kempson SYCO2, Glasgow December 2018 NLP in one slide structure preserving map Semantic Formal
SemDial 2018 joint work with M. Purver, J. Hough, R. Kempson
SYCO2, Glasgow December 2018
structure preserving map
structure preserving map
structure preserving map
preserve or jam, a pinch each of, their enjoyment. Cautiously she sampled her first pineapple and another fruit whose taste she likened well suited to programming on the digital computer. In finding the optimal R-stage policy from for the purpose of gathering data and information necessary for the study authorized in the
computer data pinch result sugar apricot 2.25 2.25 pineapple 2.25 2.25 digital 1.66 information 0.57 0.47 Figure 15.7 The PPMI matrix showing the association between words and context words,
PPMI(w,c) = max(log2 P(w,c) P(w)P(c),0)
Speech and Language Processing, Jurafsky and Martin
import spacy nlp = spacy.load('en_core_web_md') tokens = nlp(u'dog cat car') for token1 in tokens: for token2 in tokens: print(token1.text, token2.text, token1.similarity(token2))
dog dog 1.0 dog cat 0.80168545 dog car 0.35629162 cat dog 0.80168545 cat cat 1.0 cat car 0.31907532 car dog 0.35629162 car cat 0.31907532 car car 1.0
dog cat car dog 1 0.80 0.35 cat 1 0.31 car 1
blood grave dead vampire zombie butterfly
↵
structure preserving map
structure preserving map
structure preserving map
structure preserving map
T ypes Rules
A X/Y X \ Y
X/Y Y =) X Y X \ Y =) X
NP, S NP/NP, S\NP (S\NP)/NP
noun phrase adj, iTv Tv
NP/NP NP => NP NP S\NP => S
7! C ⌦ B A 7! A
7! A A = {ei}i X
A { } 3 Ti = X
i
Ciei X
Vectors
A/B 7! A ⌦ B
A 7! A A = {ei}i B = {ej}j X
7! A ⌦ B
X 3 Tij = X
ij
Cij ei ⌦ ej
Matrices
A/(B/C) 7! A ⌦ (B ⌦ C) 7! A A = {ei}i B = {ej}j C = {ek}k X
X A ⌦ B ⌦ C 3 Tijk = X
ijk
Cijk ei ⌦ ej ⌦ ek
Cubes
Higher order tensors
A ⌦ B ⌦ · · · ⌦ Z 3 Ti j···w = X
i j···w
Ci j···w ei ⌦ e j ⌦ · · · ⌦ ew
A/B B =) A 7! (A ⌦ B) B =) A
X
···
Tij T j tensor contract =) Ti
Matrix Multiplication
( X
i j
Ci jei ⌦ e j)( X
i
C je j) = X
i
Ci jC jeihe j | e ji
· · · 7! A ⌦ B ⌦ · · · ⌦ M M ⌦ N ⌦ P ⌦ · · · ⌦ W tensor contract
· · · 7! A ⌦ B ⌦ · · · ⌦ M M ⌦ N ⌦ P ⌦ · · · ⌦ W Tij···m Tmnp···w tensor contract =) Tij···np···w
Higher order tensor contraction
X X X ( X
ij···m
Cij···mei ⌦ ej ⌦ · · · ⌦ em)( X
mn···w
Cmn···wem ⌦ en ⌦ · · · ⌦ ew) X X
···
X
···
= X
ij···n···w
Cij···mCmn···wei ⌦ ej ⌦ · · · ⌦ en ⌦ · · · ⌦ ewhem | emi
Dogs Chase White Cats
NP (S \ NP)/NP NP/NP NP
N N NP
S \ NP
Dogs Chase White Cats
2 2 N 2 N N (S ⌦ N) ⌦ N N ⌦ N N 2 N ⌦ N N
S ⌦ N
N S
Dogs Chase White Cats
T ypes … Rules
XYl
YrX NPNPl NPrS N
S NPrS NPl
XYlY X Y
X YYrX X
NPNPlNP NP
NPNPrS S N
structure preserving map
monoidal functor
Categorial Grammars + Distributional Semantics
Coecke, Sadrzadeh, Clark, 2010 Grefenstette and Sadrzadeh 2011, 2015 Maillard, Clark, Grefenstette, 2014 Krishnamurti and Mitchell, 2014 Baroni and Zamparelli 2010 Wijnholds (and Moortgat) 2015-16
Complete Sentences
Naturally Occurring Dialogue
Naturally Occurring Dialogue
1) A: Ray destroyed . . . B: . . . the fuchsia. He never liked it. The roses he spared . . . A: . . . this time.
A: You are going to write the letter? B: Only if you post it! Naturally Occurring Dialogue
Howes et al, 2011, Poesio and Reiser 2010
Computational Dialogue Systems A: I want to book a ticket … B: … from where? A: London B: … to where? A: to Paris.
Purver and Kempson 2011 Purver, Eshghi, Hough 2017
Psycholinguistic Analysis A: The footballer dribbled … B (thinking) it means controlling the ball A: … the ball across the pitch A: The baby dribbled … the milk all over the floor.
Pickering and Frisson 2001
Cognitive Neuroscience Predictive Processing: agents incrementally generate expectations and judge the degree to which they are met.
Frisson and Frith 2001 Clarke 2015
Dynamic Syntax + Type Theoretic Semantics
Hough 2015, Purver et al 2014. Ruth Kempson, Wilfried Meyer-Viol, and Dov Gabbay. 2001.
Dynamic Syntax + Distributional Semantics
Sadrzadeh, Purver, Hough, Kempson SemDial 2018
O(X3, O(X1, X2)) X3 O(X1, X2) X1 X2
Trees decorated with semantic formulae and applications
and with …
(), () ?(⟨, ⟩), ♦
(), () ?(⟨, ⟩) ?(), ♦ (⟨, ⟨, ⟩⟩), (λλ.(, ))
(), () ?(⟨, ⟩), ♦ (), () (⟨, ⟨, ⟩⟩), (λλ.(, ))
(), () (⟨, ⟩), (λ.(, )) (), () (⟨, ⟨, ⟩⟩), (λλ.(, ))
“mary, . . . ” “. . . who . . . ”
?S W, T mary
i
, ♦ ?W ⊗ S ?S W, T mary
i
?W ⊗ S ?S W, T mary
i
, ♦
“. . . sleeps, . . . ”
?S W, T mary
i
?W ⊗ S, ♦ S, T mary
i
T sleep
ij
W, T mary
i
W ⊗ S, T sleep
ij
“. . . snores . . . ”
S, µ(T mary
i
T sleep
ij
, T mary
i
T snore
ij
), ♦ W, T mary
i
W ⊗ S, T snore
ij
W, T mary
i
T sleep
ij
W, T mary
i
W ⊗ S, T sleep
ij
Mary who sleeps snores.
O(X3, O(X1, X2)) X3 O(X1, X2) X1 X2
X1 → Ti1i2···in ∈ V1 ⊗ V2 ⊗ · · · Vn X2 → Tinin+1···in+k ∈ Vn ⊗ Vn+1 ⊗ · · · Vn+k X3 → Tin+kin+k+1···in+k+m ∈ Vn+k ⊗ Vn+k+1 ⊗ · · · Vn+k+m
Simple Nodes
O(X3, O(X1, X2)) X3 O(X1, X2) X1 X2
Operations Nodes
O(X1, X2) → Ti1i2···inTinin+1···in+k ∈ V1 ⊗ V2 ⊗ · · · ⊗ Vn−1 ⊗ Vn+1 ⊗ · · · ⊗ Vn+k
Extras
with semantics in X and their probabilities
? ∋
? ∋
?, ♦ ⊗ ⊗ ∋
∋
∋
“Babies …”
?S W, T mary
i
?W ⊗ S, ♦
i
ij
babies
“Babies …”
?S W, T mary
i
?W ⊗ S, ♦
ij =
babies
“Babies …”
?S W, T mary
i
?W ⊗ S, ♦
ij =
T vomit + T score + T dribble + T control baby + T control milk + T control footballer + T control ball
babies
“Babies …”
?S W, T mary
i
?W ⊗ S, ♦
i
ij
Babies …
babies
“Babies vomit”
i
ij
Babies vomit Babies …
“Babies score”
i
ij
Babies … Babies score Babies vomit
“Footballers …”
Footballers …
“Footballers vomit”
ij
Footballers … Footballers vomit
“Footballers score”
i
ij
Footballers … Footballers vomit Footballers score
composition in compositional distributional semantics.
Pickering and Frisson 2001
(footballers … , footballers dribble milk) (footballers … , footballers dribble ball)
(footballers dribble … , footballers dribble milk) (footballers dribble … , footballers dribble ball)
(footballers dribble milk , footballers dribble ball) (babies dribble milk , babies dribble ball)
Vectors: 300 Dim from Word2Vec, Tensors: the G&S EMNLP 2011 method
footballers control
0.086
footballers …
0.049
footballers drip
Just subject
footballers dribble ball
0.0046
footballers …
0.0019
footballers dribble milk
Just Subject
footballers dribble ball
0.22
footballers dribble …
0.02
footballers dribble milk
Subject + Verb
footballers drip ball
0.22
footballers dribble ball
0.36
0.22 < 0.36
footballers control ball
Complete Sentences
babies dribble milk babies drip milk
0.34
babies control milk
0.32
0.34 > 0.32 Complete Sentences
1 1.5 2 2.5 3 0.4 0.45 0.5 0.55 0.6 0.65 G&S copy-subj copy-obj add
Partiality Accuracy Subj Subj+ Verb Subj+ Verb+Obj copy-obj copy-subj add
Implement the plausibilities model of Clark 2013, Polajnar et al 2015 … under way … Extend it to experimental expectation predication … Incremental Understanding of Dialogue Content
Categorical Semantics
functor
?
A: Thank … B: … you!