7b_Semantics_Pragmatics.dvi
COMP9414 Semantics and Pragmatics 1
This Lecture
� Semantics
◮ Features and Augmented Grammars
◮ Semantic Interpretation
� Pragmatics
◮ Discourse Structure
◮ Speech Act Theory
◮ Dialogue Management
UNSW ©W. Wobcke et al. 2019–2021
COMP9414: Artificial Intelligence
Lecture 7b: Semantics and Pragmatics
Wayne Wobcke
e-mail:w. .au
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 3
Noun Features
Pronoun Person Number Gender Case
I first sing nom
you second sing/plural nom/acc
we first plural nom
us first plural acc
he third sing masculine nom
she third sing feminine nom
it third sing neuter nom/acc
him third sing masculine acc
her third sing feminine acc
they third plural nom
them third plural acc
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 2
Agreement
� Number agreement
◮ Which country borders France?
◮ Which countries border France?
◮
∗Which country border France?
◮
∗Which countries borders France?
� Case
◮ I saw him
◮
∗Him saw I
� To capture these facts, need lexical knowledge
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 5
Verb Forms
Progressive Verb sequence Example
present is + present participle He is crying
past was + present participle He was crying
future will + be + past participle He will be crying
present perfect has + been + pres participle He has been crying
future perfect will + have + been + past participle He will have been crying
past perfect had + been + pres participle He had been crying
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 4
Verb Forms
Verb Form Example
cry base
cries simple present He cries
cried simple past He cried
crying present participle He is crying
cried past participle He has cried
Tense Verb sequence Example
future will + infinitive He will cry
present perfect has + past participle He has cried
future perfect will + have + past participle He will have cried
past perfect had + past participle He had cried
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 7
Augmented Context Free Grammars
� Each symbol has a collection of features
� Grammar rules constrain feature values
◮ Use unification to enforce constraints, as in Prolog
� Features (mainly) derived from lexical items
� Some also from grammar rules (e.g. Case)
� Simple example
◮ S(number: N) → NP(number: N) VP(number: N)
◮ Enforce number agreement by unification (matching)
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 6
Subcategorization
[] Jack laughed
[NP] Jack found a key
[NP, NP] Jack gave Sue the paper
[VP(inf)] Jack wants to fly
[NP, VP(inf)] Jack told the man to go
[VP(ing)] Jack keeps hoping for the best
[NP, VP(ing)] Jack caught Sam looking at his desk
[NP, VP(base)] Jack watched Sam look at his desk
Determines mandatory sentence constituents
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 9
Example
Note: Not all arguments are specified on tree nodes
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 8
Typical (Small) Grammar
S(Agr) → NP(Agr), VP(VForm, Agr)
NP(Agr) → Det(Agr), N(Agr)
NP(Agr) → PRO(Agr)
VP(VForm, Agr) → V(VForm, Agr, []) # subcat feature
VP(VForm, Agr) → V(VForm, Agr, [NP]), NP(Agr)
VP(VForm, Agr) → V(VForm, Agr, [VP(inf)]), VP(inf, )
VP(VForm, Agr) → V(VForm, Agr, [ADJP]), ADJP
VP(inf, Agr) → to, VP(base, Agr)
ADJP → ADJ([])
ADJP → ADJ([VP(inf)], VP(inf, )
Convention is to unify (match) arguments in rule with same name
Note: is a variable that matches anything
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 11
Thematic Roles
� Agent (intentional actor)
� Object/Theme (object on which action performed)
� Patient (animate object affected psychologically)
� Co-agent
� Instrument
� Beneficiary
� Location
� Source
� Destination
Often hard to distinguish!
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 10
Semantic Interpretation
� Logical form (LF) captures underlying “meaning”
◮ Depends on purpose – no one “true” meaning
� Logical form should resolve semantic ambiguity
� Compute LF of sentence from LF of constituents
� Treat logical form as another feature
� Example: John sold a car to Mary
event(e, Sell) ∧ occur(e, past) ∧ agent(e, John) ∧ co-agent(e, Mary)
∧ object(e, {c: car})
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 13
Logical Form (Chat-80)
� Logical Form (LF) is just another feature
◮ Formulae of the form XˆF where X is a variable and F is a formula
◮ Read “the X such that F”
� May need more than matching to compute logical forms
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 12
Assigning Thematic Roles
� (Semantic) selection restrictions given by verb
◮ e.g. agent of ‘break’ is animate
� Prepositions indicate likely role
◮ e.g. ‘with’ implies instrument or co-agent
◮ e.g. ‘by’ implies location or agent
� Problem examples
◮ The window broke
◮ My car drinks petrol
Simple method but doesn’t always work ⇒ probabilities
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 15
Example Grammar
S(Xˆ(VPForm ∧ NPForm)) → NP(XˆNPForm), VP(XˆVPForm)
NP(Form) → N(Form)
NP(Xˆ(PPForm ∧ NForm)) → Det, N(YˆXˆNForm), PP(YˆPPForm)
N(Xˆtrue) → what
N(Xˆ(X = france)) → france
N(XˆYˆ(capital(X,Y))) → capital
VP(Form) → V(be), NP(Form)
PP(Form) → P(of), NP(Form)
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 14
Example Logical Form
What is the capital of France?
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 17
Pragmatics
� Discourse Processing
◮ Reference Resolution
◮ Discourse Structure
� Speech as Rational Action
◮ Speech Act Theory
◮ Spoken Dialogue Systems
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 16
Summary
� Disambiguation is central problem in NLP
� Use logical form language to resolve semantic ambiguity
� Augmented grammars can capture agreement and logical form
◮ Focus on lexical knowledge
� No one “right” logical form language
◮ Case frames, First-order logic, · · ·
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 19
Reference Resolution
We bought a desk.
The drawer was broken.
Reserve a flight to Brisbane for me.
Reserve one for Norman too.
John gave Mary five dollars.
It was more than he gave Sue. One of them was counterfeit.
Each girl took a handout.
Then she threw it away.
John didn’t marry a Swedish blonde.
She was Danish/She had brown hair/She’s living with him.
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 18
Reference Resolution
Jack lost his wallet in his car.
He looked for it for several hours.
Jack forgot his wallet.
Sam did too.
Jack forgot his wallet.
He looked for someone to borrow money from.
Sam did too.
I found a red pen and a pencil.
The pen didn’t work.
I saw two bears.
Bill saw some too.
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 21
Focus Hypothesis
� At any time, there is a discourse entity that is the preferred antecedent
for pronouns in the current local context – the discourse focus
1. If any object in the local context is referred to by a pronoun in the
current sentence, then the focus of the current sentence must also
be pronominalized
2. The focus is the most preferred discourse entity in the local
context that is referred to by a pronoun
3. Maintaining the focus is preferred to changing the focus
� Order possible antecedents subject > object > rest
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 20
Discourse Entities
� The possible antecedents of pronouns
◮ Noun phrases explicitly mentioned in recent discourse
◮ A set of (implied) discourse entities
• e.g. the handouts each girl took, the set of girls
◮ An object related to (evoked by) a discourse entity
• e.g. the drawer of the desk
◮ Fillers of roles in stereotypical scenarios
• e.g. waiters in restaurants
� Assume discourse is divided into “local contexts”
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 23
Discourse Structure
E: So you have the engine assembly finished.
Now attach the rope to the top of the engine.
By the way, did you buy petrol today?
A: Yes. I got some when I bought the new lawnmower wheel.
I forgot to take my can with me, so I bought a new one.
E: Did it cost much?
A: No, and I could use another anyway.
E: OK. Have you got it attached yet?
Tracking focus isn’t enough
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 22
Example
Jack left for the party late. (focus = Jack)
When he arrived, Sam met him at the door. (focus = he/Jack)
He decided to leave early. (focus = he/Jack)
Jack saw him in the park. (focus = him)
He was riding a bike. (focus = he/him)
While Jack was walking in the park, he met Sam. (focus = he/Jack)
He invited him to the party. (focus = Jack or Sam)
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 25
Hierarchical Structure
SEG1
Jack and Sue went to buy a new lawnmower since their old one
was stolen.
SEG2
Sue had seen the man who took it and she had chased
them down the street, but they’d driven away in a
truck.
After looking in the store, they realized they couldn’t afford one.
SEG3
By the way, Jack lost his job last month so he’s been
short of cash recently. He has been looking for a new
one, but so far hasn’t had any luck.
Anyway, they finally found a used one at a garage sale.
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 24
Discourse Segments
� Recency-based technique for reference resolution
� Fixed time and location or simple progression
� Fixed set of speakers/hearers
� Fixed set of background assumptions
� Intentional view
◮ Segment elements contribute to same discourse purpose
� Informational view
◮ Segment elements are related temporally, causally, etc.
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 27
Managing the Attentional Stack
� Extending a segment
◮ All references can be resolved in current segment
◮ Same tense or same tense without perfect aspect
� Creating a new segment
◮ Change in tense (progression of discourse)
◮ Cue phrase indicating digression
� Closing a segment
◮ Discourse purpose of new segment part of immediate parent
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 26
Attentional Stack
� Stack corresponding to segment hierarchy at point in time
◮ e.g. [SEG1, SEG2] or [SEG1, SEG3]
� Stack update on starting SEG3
◮ Either push new segment
• giving [SEG1, SEG2, SEG3]
◮ Or close current segment and push new segment
• giving [SEG1, SEG3]
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 29
Actions Involved in Speech Acts
� Locutionary act
◮ Physical act of saying something
� Illocutionary act
◮ Speech act performed in making utterance
� Perlocutionary act
◮ Effect on hearers’ actions thoughts, beliefs, etc.
Communication involves intention recognition
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 28
Speech Acts
� Speech as goal-directed rational activity
◮ e.g. promise, threaten, warn, order, advise, state request, inform,
assert, deny, apologize, thank, greet, criticize, dare, hope,
congratulate, welcome, bless, curse, toast, challenge, announce,
declare, question, . . .
� Sometimes explicit in utterances, use of so-called performative verbs
Speech act type is utterance’s illocutionary force
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 31
Indirect Speech Acts
� Use of one kind of illocutionary act to perform another
◮ Can you pass the salt?
◮ Do you know the time?
◮ You are standing on my foot
◮ Why don’t you leave now?
◮ Would you like a game of tennis?
◮ If I were you, I’d sell that car
◮ Now would you mind getting off my foot!
� Even harder to recognize speaker’s intention
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 30
Characterizing Illocutionary Acts
request warn
propositional
content
Future act A of H Future event or state E
preparatory
conditions
H able to do A
S believes H able to do A
Not obvious to both S, H
that H will do A anyway
S has reason to believe E will oc-
cur and is not in H’s interest
Not obvious to both S, H that E
will occur
sincerity con-
ditions
S wants H to do A S believes E not in H’s best inter-
est
essential con-
ditons
Counts as an attempt to
get H to do A
Counts as undertaking to the ef-
fect that E not in H’s best interest
Heavily oriented towards speaker’s intentions
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 33
Initiative
� System Initiative
◮ System “controls” dialogue by prompting user for information
◮ Useful for specific tasks
• Booking flights, ordering pizza, placing bets
� User Initiative
◮ User “controls” dialogue by questions, commands
◮ Useful for simple tasks, e.g. web search, training and simulation
� Mixed Initiative
◮ Mixture of system initiative and user initiative
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 32
Spoken Dialogue Systems
� Feasible now with good speech recognition
◮ Speaker dependent or domain specific
� Based on limiting possible dialogue structure
◮ Frames with slots that need filling
◮ Graphs representing possible transitions
◮ Rules for defining actions based on prior context
◮ Limited range of subdialogues (e.g. clarification)
Aim is to perform as little reasoning as possible
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 35
System Architecture
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 34
Smart Personal Assistant
� Integrated collection of personal (task) assistants
� Each assistant specializes in a task domain
◮ E-mail and calendar management
� Users interact through a range of devices
◮ PDAs, desktops, iPhone?
� Focus on usability
◮ Multi-modal natural language dialogue
◮ Adapt to user’s device, context, preferences
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 37
BDI Agent Architecture
� Beliefs, desires, intentions explicit
◮ Predefined plans for achieving goals
� Interpreter cycle – PRS (Procedural Reasoning System)
◮ Event-driven selection and execution of plans
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 36
Partial Parsing
� Full parsing is inappropriate
◮ Limited accuracy of speech recognition
◮ Regular use of short-form expressions
◮ Unconstrained language vocabulary
• e.g. “Are there any new messages from . . . ”
� Shallow syntactic frame
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 39
Dialogue Manager Plans
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 38
Dialogue Manager Beliefs
� Dialogue model
◮ Discourse history (stack of conversational acts)
◮ Salient list (ranked list of recently mentioned objects)
� Domain knowledge
◮ Supported tasks (for each task assistant)
◮ Domain-specific vocabularies for task interpretation
� User model
◮ User context information (device, modalities, . . .)
UNSW ©W. Wobcke et al. 2019–2021
COMP9414 Semantics and Pragmatics 40
Summary
� Dialogue systems are current “hot” topic
� Feasible because of high-quality speech recognition
◮ Questions over accuracy, usability of Siri, Alexa, etc.
� Industry impetus is automation of routine interactions to reduce costs
◮ Lot of hype compared to actual deployed systems
� Simple dialogue management techniques include graphs of dialogue
actions and rules based on dialogue context
◮ Current possible interactions not very sophisticated
UNSW ©W. Wobcke et al. 2019–2021