NL21Material.pptx

Download Report

Transcript NL21Material.pptx

‫بسم هللا الرحمن الرحيم‬
ICS 482 Natural Language
Processing
Lecture 21: Semantic Analysis: Material
For the pop-Quiz 2
Husni Al-Muhtaseb
1
7/17/2016
Semantic Analysis
 Semantic analysis is the process of taking in some linguistic
input and assigning a meaning representation to it.
 Different ways
 make use of syntax
 We’re going to start with the idea that syntax does matter
 The compositional rule-to-rule approach
2
Sunday, July 17, 2016
Compositional Analysis
 Principle of Compositionality
 The meaning of a whole is derived from the meanings of the
parts
 What parts?
 Account for the meaning not solely for the words, but also
Syntactic Components and Relations
 Ordering
 Grouping
 Relations among the words
 The constituents of the syntactic parse of the input
3
Sunday, July 17, 2016
Example
 AyCaramba serves meat
e Serving (e)^ Server(e, AyCaramba)^ Served (e, Meat )
4
Sunday, July 17, 2016
Compositional Analysis
5
Sunday, July 17, 2016
Augmented Rules
 We’ll accomplish this by attaching semantic formation
rules to our syntactic CFG rules
 Abstractly
A   1... n
{f ( 1.sem ,... n.sem )}
 This should be read as the semantics we attach to A can be
computed from some function applied to the semantics of
A’s parts.
6
Sunday, July 17, 2016
Example
 Easy parts…
 NP  PropNoun
 Attachments
 NP  MassNoun
 PropNoun  AyCaramba
 MassMoun  meat
{PropNoun.sem}
{MassNoun.sem}
{AyCaramba}
{meat}
 These attachments consist of
assigning constants and copying
from daughters up to mothers.
7
Sunday, July 17, 2016

Example
S  NP VP
 VP  Verb NP
 {VP.sem (NP.sem)}
 {Verb.sem (NP.sem)}
 Verb  serves
 x  y e Serving (e ) ^ Server (e , y ) ^ Served (e , x )
These consist of taking the semantics attached
to one daughter and applying it as a function to
the semantics of the other daughters.
8
Sunday, July 17, 2016
Lambda Forms
 A simple addition to FOPC
 Take an FOPC sentence
with variables in it that are
to be bound.
 Allow those variables to be
bound by treating the
lambda form as a function
with formal arguments
9
xP(x )
xP( x )( Sally )
P ( Sally )
Sunday, July 17, 2016
Lambda Forms
 x  yIn (x , y )  Country ( y )
 x  yIn (x , y )  Country ( y )(BC )
 yIn (BC , y )  Country ( y )
 yIn (BC , y )  Country ( y )
 yIn (BC , y )  Country ( y )(CANADA )
In (BC ,CANADA )  Country (CANADA )
10
Sunday, July 17, 2016
Example
11
Sunday, July 17, 2016
Example
 x  y e Serving (e ) ^ Server (e , y ) ^ Served (e , x )
AyCaramba
Meat
Sunday, July 17, 2016
12
Example
AyCaramba
 y e Serving (e ) ^ Server (e , y ) ^ Served (e , Meat )
 x  y e Serving (e ) ^ Server (e , y ) ^ Served (e , x )
AyCaramba
Meat
Meat
Sunday, July 17, 2016
13
Example
e Serving (e ) ^ Server (e , AyCaramba ) ^ Served (e , Meat )
 y e Serving (e ) ^ Server (e , y ) ^ Served (e , Meat )
AyCaramba
 x  y e Serving (e ) ^ Server (e , y ) ^ Served (e , x )
Meat
AyCaramba
Meat
Sunday, July 17, 2016
14
e Serving (e ) ^ Server (e , AyCaramba ) ^ Served (e , Meat )
AyCaramba
 y e Serving (e ) ^ Server (e , y ) ^ Served (e , Meat )
Meat
 x  y e Serving (e ) ^ Server (e , y ) ^ Served (e , x )
Meat
AyCaramba







S  NP VP
{VP.sem(NP.sem)}
 {Verb.sem(NP.sem)}
VP  Verb NP
 x  y e Serving (e ) ^ Server (e , y ) ^ Served (e , x )
Verb  serves
 {PropNoun.sem}
NP  PropNoun
 {MassNoun.sem}
NP  MassNoun
 {AyCaramba}
PropNoun  AyCaramba
 {MEAT}
MassNoun  meat

Sunday, July 17, 2016
15
Which FOPC representation is better?
e Serving (e)^ Server(e, AyCaramba)^ Served (e, Meat )
e Isa (e , Serving ) ^ Server (e , AyCaramba ) ^ Served (e , Meat )
Possible pop-quiz: Redo previous
example using second representation
16
Sunday, July 17, 2016