Date post: | 11-Jan-2016 |
Category: |
Documents |
Upload: | john-collins |
View: | 217 times |
Download: | 1 times |
04/21/23 CPSC503 Winter 2009 1
CPSC 503Computational Linguistics
Discourse and DialogLecture 15
Giuseppe Carenini
04/21/23 CPSC503 Winter 2009 2
Finish from (22/10)
• Word Sense Disambiguation (Thesaurus vs. Corpus)
• Word Similarity (Thesaurus vs. Distributional)
• Semantic Role Labeling
04/21/23 CPSC503 Winter 2009 3
WS: Distributional Methods
• Do not have any thesauri for target language
• If you have thesaurus, still– Missing domain-specific (e.g., technical words)– Poor hyponym knowledge (for V) and nothing for
Adj and Adv– Difficult to compare senses from different
hierarchies• Solution: extract similarity from corpora
• Basic idea: two words are similar if they appear in similar contexts
04/21/23 CPSC503 Winter 2009 4
WS Distributional Methods (1)
• Context: feature vector
Example: fi how many times wi appeared in the neighborhood of w
Stop list
),...,,( 21 Nfffw
04/21/23 CPSC503 Winter 2009 5
WS Distributional Methods (2)
• More informative values (referred to as weights or measure of association in the literature)
• Point-wise Mutual Information
)()(
),(log),( 2
i
iiPMI wPwP
wwPwwassoc
• t-test
)()(
)()(),(),(
i
iiitestt
wPwP
wPwPwwPwwassoct
04/21/23 CPSC503 Winter 2009 6
WS Distributional Methods (3)• Similarity between vectors
Not sensitive to extreme values
)cos(),(cos
wv
wv
w
w
v
vwvsim ine
v
w
N
iii
N
iii
Jaccard
wv
wvwvsim
1
1
),max(
),min(),(
Normalized
(weighted) number of overlapping features
04/21/23 CPSC503 Winter 2009 7
WS Distributional Methods (4)
• Best combination overall (Curan 2003)– t-test for weights– Jaccard (or Dice) for vector similarity
04/21/23 CPSC503 Winter 2009 8
Semantic Role Labeling: Example
– In 1979 , singer Nancy Wilson HIRED him to open her nightclub act .
– Castro has swallowed his doubts and HIRED Valenzuela as a cook in his small restaurant .
Employer Employee Task PositionSome roles..
04/21/23 CPSC503 Winter 2009 9
Supervised Semantic Role LabelingTypically framed as a classification problem
[Gildea, Jurfsky 2002]
• Train a classifier that for each predicate: – determine for each synt. constituent which semantic
role (if any) it plays with respect to the predicate
• Train on a corpus annotated with relevant constituent features
These include: predicate, phrase type, head word and its POS, path, voice, linear position…… and many others
04/21/23 CPSC503 Winter 2009 10
Semantic Role Labeling: Example
[issued, NP, Examiner, NNP, NPSVPVBD, active, before, …..]ARG0
predicate, phrase type, head word and its POS, path, voice, linear position……
04/21/23 CPSC503 Winter 2009 11
Supervised Semantic Role Labeling (basic) Algorithm
1. Assign parse tree to input
2. Find all predicate-bearing words (PropBank, FrameNet)
3. For each predicate.: apply classifier to each synt. constituent
Unsupervised Semantic Role Labeling: bootstrapping [Swier,
Stevenson ‘04]
04/21/23 CPSC503 Winter 2009 12
Knowledge-Formalisms Map(including probabilistic formalisms)
• Logical formalisms (First-Order Logics)• Thesaurus & corpus
based methods
Rule systems (and prob.
versions)
State Machines (and prob.
versions)
Morphology
Syntax
PragmaticsDiscourse
and Dialogue
Semantics
AI planners (MDPs Markov Decision
Processes)
Understanding
Generation
04/21/23 CPSC503 Winter 2009 13
Today 27/10
•Brief Intro Pragmatics•Discourse
– Monologue– Dialog
04/21/23 CPSC503 Winter 2009 14
“Semantic” Analysis
Syntax-driven and Lexical
Semantic Analysis
Sentence
Literal Meanin
g
Discourse
Structure
Meanings of
words
Meanings of grammatical structures
Context
Common-SenseDomain
knowledge
Intended meaning
FurtherAnalysis
INFERENCE
Pragmatics
04/21/23 CPSC503 Winter 2009 15
Pragmatics: Example
(i) A: So can you please come over here again right now
(ii) B: Well, I have to go to Edinburgh today sir(iii) A: Hmm. How about this Thursday?
What information can we infer about the context in which this (short and insignificant) exchange occurred ?
04/21/23 CPSC503 Winter 2009 16
Pragmatics: Conversational Structure
(i) A: So can you please come over here again right now
(ii) B: Well, I have to go to Edinburgh today sir(iii) A: Hmm. How about this Thursday?
Not the end of a conversation (nor the beginning)
Pragmatic knowledge: Strong expectations about the structure of conversations
• Pairs e.g., request <-> response• Closing/Opening forms
04/21/23 CPSC503 Winter 2009 17
Pragmatics: Dialog Acts
• A is requesting B to come at time of speaking,
• B implies he can’t (or would rather not) • A repeats the request for some other time.Pragmatic assumptions relying on:
• mutual knowledge (B knows that A knows that…)
• co-operation (must be a response… triggers inference)
• topical coherence (who should do what on Thur?)
(i) A: So can you please come over here again right now
(ii) B: Well, I have to go to Edinburgh today sir(iii) A: Hmm. How about this Thursday?
04/21/23 CPSC503 Winter 2009 18
Pragmatics: Specific Act (Request)
• A wants B to come over• A believes it is possible for B to come over• A believes B is not already there• A believes he is not in a position to order B
to…
Assumption: A behaving rationally and sincerely
(i) A: So can you please come over here again right now
(ii) B: Well, I have to go to Edinburgh today sir(iii) A: Hmm. How about this Thursday?
Pragmatic knowledge: speaker beliefs and intentions underlying the act of requesting
04/21/23 CPSC503 Winter 2009 19
Pragmatics: Deixis
• A assumes B knows where A is• Neither A nor B are in Edinburgh• The day in which the exchange is taking
place is not Thur., nor Wed. (or at least, so A believes)
Pragmatic knowledge: References to space and time wrt space and time of speaking
(i) A: So can you please come over here again right now
(ii) B: Well, I have to go to Edinburgh today sir(iii) A: Hmm. How about this Thursday?
04/21/23 CPSC503 Winter 2009 20
Today 28/10
•Brief Intro Pragmatics•Discourse
– Monologue– Dialog
04/21/23 CPSC503 Winter 2009 21
Discourse: Monologue• Monologues as sequences of “sentences” have structure• Tasks: Text Segmentation and Rhetorical (discourse)
parsing and generation
• Key discourse phenomenon: referring expressions (what they denote may depend on previous discourse)
Task: Coreference resolution
(like sentences as sequences of words)
04/21/23 CPSC503 Winter 2009 22
Discourse/Text Segmentation(1)• Simple approach:
– linear (unable to identify hierarchical structure)
– Subtopics, passagesUNSUPERVISED• Key idea: lexical cohesion (vs.
coherence)“There is not water on the moon.
Andromeda is covered by the moon.”• Discourse segments tend to be lexically cohesive
• Cohesion score drops on segment boundaries
04/21/23 CPSC503 Winter 2009 23
Discourse/Text Segmentation(2)SUPERVISED• Binary classifier (SVM, decision tree,
…)• : make yes-no boundary decision
between any two sentencesfeatures• Cohesion features (e.g., word
overlap, word cosine)• Presence of (domain specific)
discourse markers– News “good evening, I am.., joining us
now is…”– Real estate ads: is previous word phone
number?
04/21/23 CPSC503 Winter 2009 24
Sample Monologues: Coherence
House-A is an interesting house. It has a convenient
location. Even though house-A is somewhat far from
the park, it is close to work and to a rapid
transportation stop.
It has a convenient location. It is close to work. Even
though house-A is somewhat far from the park, house-
A is an interesting house. It is close to a rapid
transportation stop.
04/21/23 CPSC503 Winter 2009 25
Corresponding Text Structure
House-A is an
interesting house.
It has a convenient
location.
Even though house-A is
somewhat far from the park
it is close to
work
it is close to a rapid
transportation stop
EVIDENCECORE
EVIDENCE-1CONCESSION-1CORE-1
decomposition ordering rhetorical relations
04/21/23 CPSC503 Winter 2009 26
Text Relations, Parsing and Generation
• Parsing: Given a monologue, determine its rhetorical structure [Marcu, ’00 and ‘02]
• Generation: Given a communicative goal e.g., [convince user to quit smoking] generate structure – Next class
• Rhetorical (coherence) Relations: – different proposals (typically 20-30
rels)– Elaboration, Contrast, Purpose…
04/21/23 CPSC503 Winter 2009 27
• I saw him• I passed the course• I’d like the red one• I disagree with what you just
said• That caused the invasion
ReferenceLanguage contains many references
to entities mentioned in previous sentences (i.e., in the discourse context/model)
Two tasks• Anaphora/pronominal
resolution• Co-reference resolution
04/21/23 CPSC503 Winter 2009 28
Reference ResolutionTerminology
Referring expression: NL expression used to perform reference
Referent: “entity” that is referred
Types of referring expressions:
• Indefinite NP (a, some, …)• Definite NP (the, … )• Pronouns (he, she, her,...)• Demonstratives (this,
that,..)• Names
• Inferrables• Generics
04/21/23 CPSC503 Winter 2009 29
Pronominal Resolution: Simple Algorithm
• Last object mentioned (correct gender/person)– John ate an apple. He was hungry.
• He refers to John (“apple” is not a “he”)
– Google is unstoppable. They have increased..
• Selectional restrictions– John ate an apple in the store.
It was delicious. [stores cannot be delicious]It was quiet. [apples cannot be quiet]
• Binding Theory constraints– Mary bought herself a new Ferrari– Mary bought her a new Ferrari
04/21/23 CPSC503 Winter 2009 30
• Some pronouns don’t refer to anything– It rained
• must check if verb has a dummy subject
Additional Complications
• Evaluate “last object” mentioned using parse tree, not literal text position– I went to the GAP which is opposite to BR.– It is a big store.
[GAP, not BP]
04/21/23 CPSC503 Winter 2009 31
FocusJohn is a good studentHe goes to all his tutorialsHe helped Sam with CS4001He wants to do a project for Prof. Gray
He refers to John (not
Sam)
04/21/23 CPSC503 Winter 2009 32
Supervised Pronominal Resolution
Corpus annotated with co-reference relations (all antecedents of each pronoun are marked)• What features ?
(U1) John saw a nice Ferrari in the parking lot
(U2) He showed it to Bob
(U3) He bought it
04/21/23 CPSC503 Winter 2009 33
Need World Knowledge– The police prohibited the fascists from
demonstrating because they feared violence.
vs– The police prohibited the fascists from
demonstrating because they advocated violence. Exactly the same
syntax! • Not possible to resolve they without
detailed representation of world knowledge about feared violence vs. advocated violence
04/21/23 CPSC503 Winter 2009 34
Coreference resolution• Decide whether any pair of NPs co-
refer• Binary classifier again
NPj
• What features?Same as for anaphora + specific ones to
deal with definite and names. E.g.,– Edit distance– Alias (based on type – e.g., for PERSON:
Dr. or Chairman can be removed)– Appositive (“Mary, the new CEO, ….”
anaphorantecedents
04/21/23 CPSC503 Winter 2009 35
Knowledge-Formalisms Map(including probabilistic formalisms)
• Logical formalisms (First-Order Logics)• Thesaurus & corpus
based methods
Rule systems (and prob.
versions)
State Machines (and prob.
versions)
Morphology
Syntax
PragmaticsDiscourse
and Dialogue
Semantics
AI planners (MDPs Markov Decision
Processes)
Understanding
Generation
04/21/23 CPSC503 Winter 2009 36
Next Time: Natural Language Generation
• Read handout on NLG• Lecture will be about an NLG
system that I developed and tested
04/21/23 CPSC503 Winter 2009 37
Today 28/10
•Brief Intro Pragmatics•Discourse
– Monologue– Dialog
04/21/23 CPSC503 Winter 2009 38
Discourse: Dialog• Most fundamental form of language use• First kind we learn as children
Dialog can be seen as a sequence of communicative actions of different kinds (dialog acts) - (DAMSL 1997; ~20) Example:
(i) A: So can you please come over here again
right now(ii) B: Well, I have to go to Edinburgh today sir(iii) A: Hmm. How about this Thursday(vi) B: OK
ACTION-DIRECTIVE
REJECT-PART
ACCEPTACTION- DIRECTIVE
04/21/23 CPSC503 Winter 2009 39
Dialog: two key tasks
• (1) Dialog act interpretation: identify the user dialog act
• (2) Dialog management: (1) & decide what to say and when
04/21/23 CPSC503 Winter 2009 40
Dialog Act Interpretation
• What dialog act a given utterance is?
E.g., I’m having problems with the homework
• Surface form is not sufficient!
– Statement - prof. should make a note of this, perhaps make homework easier next year
– Directive - prof. should help student with the homework
– Information request - prof should give student the solution
04/21/23 CPSC503 Winter 2009 41
Automatic Interpretation of Dialog Acts
Logical formalisms (First-Order Logics)
Morphology
Syntax
PragmaticsDiscourse
and Dialogue
Semantics
AI planners
Rule systems (and prob.
versions)
State Machines (and prob.
versions)
Plan-Inferential
Cue-based
04/21/23 CPSC503 Winter 2009 42
Cue-Based: Key Idea
Words and collocations: • Please and would you -> REQUEST• are you and is it -> YES-NO-QUESTIONs
Conversational structure: • Yeah following PROPOSAL ->
AGREEMENT• Yeah following INFORM ->
BACKCHANNEL
Prosody: Loudness or stress yeah -> AGREEMENT vs. BACKCHANNEL
04/21/23 CPSC503 Winter 2009 43
Cue-Based model (1)Each dialog act type (d) has its own micro-grammar
which can be captured by N-gram models
Lexical: given an utterance W= w1 … wn for each dialog act (d) we can compute P(W|d)
Prosodic: given an utterance F= f1 … fn for each dialog act (d) we can compute P(F|d)
AnnotatedCorpus
Corpus for d1……
Corpus for dm
……
Split N-gram models1
N-gram modelsm
04/21/23 CPSC503 Winter 2009 44
Cue-Based model (2)Conversational structure: Markov chain
AnnotatedCorpus
d1
d2
d3
d4
d5
.8.3
.7 .5
1
1 .2.3
1
.2
Combine all info sources: HMM
di-1 di
Fi , WiFi , Wi
)|( 1ii ddP
)|,( iii dFWP)|()|(
)|,(
iiii
iii
dFPdWP
dFWP
N-gram models!
…
Fi , Wi
04/21/23 CPSC503 Winter 2009 45
Cue-Based model Summary• Start form annotated corpus (each
utterance labeled with appropriate dialog act)
• For each dialog act type (e.g., REQUEST), build lexical and phonological N-grams • Build Markov chain for dialog acts (to express conversational structure)
• Combine Markov Chain and N-grams into an HMM• Now ),|(maxarg FWDP
D
PP Sequences of sequences
..can be computed with ……
04/21/23 CPSC503 Winter 2009 46
Dialog Managers in Conversational Agents
• Examples: Airline travel info system, restaurant/movie guide, email access by phone
• Tasks– Control flow of dialogue (turn-
taking)– What to say/ask and when
04/21/23 CPSC503 Winter 2009 47
Dialog Managers
Logical formalisms (First-Order Logics)
Morphology
Syntax
PragmaticsDiscourse
and Dialogue
Semantics
AI planners(and prob.
versions)
Rule systems (and prob.
versions)
State Machines (and prob.
versions)FSA
Template-Based
BDIMDP
27/10: Probably stop here
04/21/23 CPSC503 Winter 2009 48
04/21/23 CPSC503 Winter 2009 49
Plan Inferential (BDI) Pros/Cons
• Powerful: uses rich and sound knowledge structures -> should enable modeling of subtle indirect uses of dialog acts
• Time-consuming:– To develop– To execute
• Ties discourse processing with non-linguistic reasoning -> AI complete
• Dialog acts are expressed as plan operators involving belief, desire, intentions
04/21/23 CPSC503 Winter 2009 50
FSA Dialog Manager: system initiative
• xxx
04/21/23 CPSC503 Winter 2009 51
Template-based Dialog Manager (1)
• GOAL: to allow more complex sentences that provide more than one info item at a time
S: How may I help you?U: I want to go from Boston to Baltimore on the 8th. Slot Optional questions
From_Airport “From what city are you leaving?”To_Airport “Where are you going?”Dept-Time “When do you want to leave?”Dept-Day …………… ………… • Interpretation: Semantic Grammars,
semi-HMM, Hidden-Understanding-Models (HUM)
04/21/23 CPSC503 Winter 2009 52
Template-based Dialog Manager (2)
• More than one template: e.g., car or hotel reservation
• User may provide information to fill slots in different templates
• A set of production rules fill slots depending on input and determines what questions should be asked next
E.g., IF user mention car slot and “most” of
air slot are filled THEN ask about remaining car slots.
04/21/23 CPSC503 Winter 2009 53
Markov Decision Processes [’02]
• Common formalism in AI to model an agent interacting with its environment.
• States / Actions / Rewards• Application to dialog:– States: slot in frame currently worked
on, ASR confidence value, number of questions about slot,..
– Actions: questions types, confirmation types
– Rewards: user feedback, task completion rate
04/21/23 CPSC503 Winter 2009 54
BDI Dialog Manager
Sys to understand U2 needs model of preconditions, effects, decomposition of:– meeting event (precon: be “there”)- fly-to plan (decomp: book-flight, take-flight)- Take-flight plan (effect: be “there”)
S1: How may I help you?
U1: I want to go to Pittsburgh in April.
S2: And, what date in April do you want to travel?
U2: Uh hmm I have a mtg. there on the 12th.
REQUEST ACKNOWLEDGE
INFORMREQUEST
04/21/23 CPSC503 Winter 2009 55
BDI Dialog Manager
Sys to generate S2 needs model preconditions of:- Book-flight action (agent knows departure date and
time)
S1: How may I help you?U1: I want to go to Pittsburgh in April.
S2: And, what date in April do you want to travel?
U2: Uh hmm I have a mtg. there on the 12th.
REQUEST ACKNOWLEDGE
INFORMREQUEST
Integrated with logic-based planning system
• Understanding an utterance: plan recognition (recognize multiple goals)
• Generating an utterance: plan generation (possibly) satisfying multiple goals
04/21/23 CPSC503 Winter 2009 56
Designing Dialog Systems: User-Centered Design
• Early Focus on User and Task: e.g., interview the users
• Build Prototypes: Wizard-of-Oz (WOZ) studies
Iterative Design
• Evaluation
04/21/23 CPSC503 Winter 2009 57
Next Time: Natural Language Generation
• Read handout on NLG• Lecture will be about an NLG
system that I developed and tested