650 likes | 656 Views
CPSC 503 Computational Linguistics. Intro to Pragmatics Lecture 13 Giuseppe Carenini. Knowledge-Formalisms Map (including probabilistic formalisms). Understanding. Generation. State Machines (prob . versions ) Neural Models. Logical formalisms (First-Order Logics)
E N D
CPSC 503Computational Linguistics Intro to Pragmatics Lecture 13 Giuseppe Carenini CPSC503 Winter 2016
Knowledge-Formalisms Map(including probabilistic formalisms) Understanding Generation State Machines (prob. versions) Neural Models • Logical formalisms (First-Order Logics) • Thesaurus & corpus based methods & Neural models Morphology Syntax Rule systems (and prob. versions) Semantics Pragmatics Discourse: Monolog and Dialogue AI planners (HTN, MDPs+RL) CPSC503 Winter 2016
Today Feb 25 • Brief Intro Pragmatics • Discourse • Monologue • Dialog CPSC503 Winter 2016
Sentence “Semantic” Analysis Meanings of grammatical structures Syntax-driven and Lexical Semantic Analysis Meanings of words Literal Meaning I N F E R E N C E Common-Sense Domain knowledge Further Analysis Discourse Structure Intended meaning Context Pragmatics CPSC503 Winter 2016
Semantic Analysis I am going to SFU on Tue Sentence Meanings of grammatical structures The garbage truck just left Syntax-driven Semantic Analysis Meanings of words Literal Meaning I N F E R E N C E Common-Sense Domain knowledge Further Analysis Discourse Structure Intended meaning Context Shall we meet on Tue? CPSC503 Winter 2016 What time is it?
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 ? CPSC503 Winter 2016
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 CPSC503 Winter 2016
Pragmatics: Dialog Acts (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? • 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?) CPSC503 Winter 2016
Pragmatics: Specific Act (Request) (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? • 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… Pragmatic knowledge: speaker beliefs and intentions underlying the act of requesting Assumption: A behaving rationally and sincerely CPSC503 Winter 2016
Pragmatics: Deixis (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? • 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 CPSC503 Winter 2016
Today Feb 25 • Brief Intro Pragmatics • Discourse • Monologue • Dialog CPSC503 Winter 2016
Discourse: Monologue (like sentences as sequences of words) • Monologues as sequences of “sentences” havestructure • Tasks: Rhetorical (discourse) parsing and generation • Key discourse phenomenon: referring expressions (what they denote may depend on previous discourse) • Task: Coreference resolution CPSC503 Winter 2016
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. CPSC503 Winter 2016
CORE EVIDENCE Corresponding Text Structure House-A is an interesting house. CORE-1 CONCESSION-1 EVIDENCE-1 It has a convenient location. it is close to a rapid transportation stop it is close to work Even though house-A is somewhat far from the park CPSC503 Winter 2016 decomposition ordering rhetorical relations
CORE EVIDENCE Parsing 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. House-A is an interesting house. CORE-1 CONCESSION-1 EVIDENCE-1 It has a convenient location. it is close to a rapid transportation stop it is close to work Even though house-A is somewhat far from the park CPSC503 Winter 2016 decomposition ordering rhetorical relations
CORE EVIDENCE Generation GOAL: Convince hearer that she/he should look at House-A 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. House-A is an interesting house. CORE-1 CONCESSION-1 EVIDENCE-1 It has a convenient location. it is close to a rapid transportation stop it is close to work Even though house-A is somewhat far from the park CPSC503 Winter 2016 decomposition ordering rhetorical relations
Text Relations, Parsing and Generation • Rhetorical (coherence) Relations: • different proposals (typically 20-30 rels) • Elaboration, Contrast, Purpose… • Parsing: Given a monologue, determine its rhetorical structure (semi-sup. [Marcu, ’00 and ‘02]) (sup. [Duverle & Prendinger ‘09])…. Our own work [CL,2015] • Generation: Given a communicative goale.g.,[convince user to quit smoking]generate structure, content, text [Reiter et al. AIJ ‘03]. Generation of textual summaries from neonatal intensive care data [Portet et al. AIJ ‘09]. CPSC503 Winter 2016
Reference Language contains many references to entities mentioned in previous sentences (i.e., in the discourse context/model) • I saw him • I passed the course • I’d like the red one • I disagree with what you just said • That caused the invasion • Two tasks • Anaphora/pronominal resolution • Co-reference resolution CPSC503 Winter 2016
Reference Resolution • Terminology • 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 • (see next) CPSC503 Winter 2016
Cont’ Referring Expressions • Inferrables“ I almost bought a new car today, but <a door> had a dent and <the engine> was too noisy” • Generics “I saw no less than 6 Ferraris today. <They> are the coolest cars.” CPSC503 Winter 2016
Pronominal Resolution: “Simplest” 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 CPSC503 Winter 2016
Additional Complications • Some pronouns don’t refer to anything • Itrained • must check if verb has a dummy subject • 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] CPSC503 Winter 2016
Focus John is a good student He goes to all his tutorials He helped Sam with CS4001 He wants to do a project for Prof. Gray He refers to John (not Sam) CPSC503 Winter 2016
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) Hebought it CPSC503 Winter 2016
Need World Knowledge… • The police prohibited the fascists from demonstrating because they feared violence. vs • The police prohibited the fascists from demonstrating because theyadvocated violence. • Exactly the same syntax! • Not possible to resolve they without detailed representation of world knowledge about feared violence vs. advocated violence CPSC503 Winter 2016
Coreference resolution • Decide whether any pair of NPs co-refer • Binary classifier again anaphor NPj antecedents • 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, ….” CPSC503 Winter 2016
Coreference Resolution: State the art Neural Coreference Resolution Kevin Clark CS Stanford University - Report CPSC503 Winter 2016
Today Feb 25 • Brief Intro Pragmatics • Discourse • Monologue • Dialog CPSC503 Winter 2016
Example: ACTION-DIRECTIVE (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 REJECT-PART ACTION- DIRECTIVE ACCEPT 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) CPSC503 Winter 2016
Dialog: two key tasks • (1) Dialog act interpretation: identify the user dialog act • (2) Dialog management: (1) & decide what to say and when CPSC503 Winter 2016
Cue-Based: Key Idea Words and collocations: • Please and would you -> REQUEST • are you and is it -> YES-NO-QUESTIONs Prosody: Loudness or stress yeah -> AGREEMENT vs. BACKCHANNEL • Conversational structure: • Yeah following PROPOSAL -> AGREEMENT • Yeah following INFORM -> BACKCHANNEL CPSC503 Winter 2016
Split Corpus for d1 N-gram models1 …… …… Corpus for dm N-gram modelsm Cue-Based model (1) Each dialog act type (d) has its own micro-grammar which can be captured by N-gram models Annotated Corpus • 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) CPSC503 Winter 2016
d3 d1 d5 d2 di-1 • … d4 Fi , Wi di Fi , Wi Fi , Wi Cue-Based model (2) • 1 Annotated Corpus • 1 Conversational structure: Markov chain • .3 • .8 • 1 • .2 • .2 • .3 • .5 • .7 Combine all info sources: HMM/CRF… N-gram models! CPSC503 Winter 2016
Combine Markov Chain and N-grams into single model Sequences of sequences • Now ..can be computed with …… Cue-Based model Summary • For each dialog act type (e.g., REQUEST), build lexical and phonological N-grams • Start form annotated corpus (each utterance labeled with appropriate dialog act) • Build Markov chain for dialog acts (to express conversational structure) CPSC503 Winter 2016
Assignment 3 will be posted soon (due March 11) Next class:TueMarch 1 • Project proposal (bring your write-up to class; 1-2 pages single project, 3-4 pages group project) • Project proposal Presentation • Approx4 min presentation + 1 min for questions (8 mins over all if you are in a group) • For content, follow instructions at course project web page • Bring 1 handout to class for me (copy of your slides) • Please send me your presentation by NOON (so that I can have all the presentations on my laptop) CPSC503 Winter 2016
Reading Presentation Assignment • We have 20 readings overall • So one paper each • Fill out Google form asap, readings will be assigned today • (if time - Show Course Web Page) CPSC503 Winter 2016
Knowledge-Formalisms Map(including probabilistic formalisms) Understanding Generation State Machines (and prob. versions) • Logical formalisms (First-Order Logics) • Thesaurus & corpus based methods Morphology Syntax Rule systems (and prob. versions) Semantics Pragmatics Discourse and Dialogue AI planners (MDPs Markov Decision Processes) CPSC503 Winter 2016
Next Time: Natural Language Generation • Read handout on NLG • Lecture will be about an NLG system that I developed and tested CPSC503 Winter 2016
Today 27/10 • Brief Intro Pragmatics • Discourse • Monologue • Dialog CPSC503 Winter 2016
Example: ACTION-DIRECTIVE (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 REJECT-PART ACTION- DIRECTIVE ACCEPT 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) CPSC503 Winter 2016
Dialog: two key tasks • (1) Dialog act interpretation: identify the user dialog act • (2) Dialog management: (1) & decide what to say and when CPSC503 Winter 2016
Dialog Act Interpretation • What dialog act a given utterance is? • Surface form is not sufficient! E.g., I’m having problems with the homework • 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 CPSC503 Winter 2016
Automatic Interpretation of Dialog Acts State Machines (and prob. versions) Morphology Logical formalisms (First-Order Logics) Cue-based Syntax Rule systems (and prob. versions) Semantics Pragmatics Discourse and Dialogue Plan-Inferential AI planners CPSC503 Winter 2016
Cue-Based: Key Idea Words and collocations: • Please and would you -> REQUEST • are you and is it -> YES-NO-QUESTIONs Prosody: Loudness or stress yeah -> AGREEMENT vs. BACKCHANNEL • Conversational structure: • Yeah following PROPOSAL -> AGREEMENT • Yeah following INFORM -> BACKCHANNEL CPSC503 Winter 2016
Split Corpus for d1 N-gram models1 …… …… Corpus for dm N-gram modelsm Cue-Based model (1) Each dialog act type (d) has its own micro-grammar which can be captured by N-gram models Annotated Corpus • 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) CPSC503 Winter 2016
d3 d1 d5 d2 di-1 • … d4 Fi , Wi di Fi , Wi Fi , Wi Cue-Based model (2) • 1 Annotated Corpus • 1 Conversational structure: Markov chain • .3 • .8 • 1 • .2 • .2 • .3 • .5 • .7 Combine all info sources: HMM N-gram models! CPSC503 Winter 2016
Combine Markov Chain and N-grams into an HMM Sequences of sequences • Now ..can be computed with …… Cue-Based model Summary • For each dialog act type (e.g., REQUEST), build lexical and phonological N-grams • Start form annotated corpus (each utterance labeled with appropriate dialog act) • Build Markov chain for dialog acts (to express conversational structure) CPSC503 Winter 2016
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 CPSC503 Winter 2016
Dialog Managers State Machines (and prob. versions) Morphology Logical formalisms (First-Order Logics) FSA Syntax Rule systems (and prob. versions) Semantics Template-Based Pragmatics Discourse and Dialogue BDI MDP AI planners (and prob. versions) CPSC503 Winter 2016
Time-consuming: • To develop • To execute • Ties discourse processing with non-linguistic reasoning -> AI complete Plan Inferential (BDI) Pros/Cons • Dialog acts are expressed as plan operators involving belief, desire, intentions • Powerful: uses rich and sound knowledge structures -> should enable modeling of subtle indirect uses of dialog acts CPSC503 Winter 2016