Understanding Computational Linguistics: Pragmatics and Formalisms
Explore the world of computational linguistics through topics like pragmatics, formalisms, knowledge representation, state machines, neural models, semantics, and discourse analysis. Dive into the intricacies of language structures, meanings, and contextual inferences to unravel the complexities of human communication.
Uploaded on Sep 21, 2024 | 0 Views
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
CPSC 503 Computational Linguistics Intro to Pragmatics Lecture 13 Giuseppe Carenini 9/21/2024 CPSC503 Winter 2016 1
Knowledge-Formalisms Map (including probabilistic formalisms) U n d e r s t a n d i n g G e n e r a t i o n State Machines (prob. versions) Neural Models Morphology Syntax Rule systems (and prob. versions) Semantics (First-Order Logics) Thesaurus & corpus based methods & Neural models Logical formalisms Pragmatics Discourse: Monolog and Dialogue AI planners (HTN, MDPs+RL) 9/21/2024 CPSC503 Winter 2016 2
Today Feb 25 Brief Intro Pragmatics Discourse Monologue Dialog 9/21/2024 CPSC503 Winter 2016 3
Semantic Analysis Sentence 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 Context Intended meaning Pragmatics 9/21/2024 CPSC503 Winter 2016 4
Semantic Analysis I am going to SFU on Tue The garbage truck just left Sentence Meanings of grammatical structures 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 Context Intended meaning 9/21/2024 Shall we meet on Tue? What time is it? CPSC503 Winter 2016 5
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 ? 9/21/2024 CPSC503 Winter 2016 6
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 9/21/2024 CPSC503 Winter 2016 7
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?) 9/21/2024 CPSC503 Winter 2016 8
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 9/21/2024 CPSC503 Winter 2016 9
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 9/21/2024 CPSC503 Winter 2016 10
Today Feb 25 Brief Intro Pragmatics Discourse Monologue Dialog 9/21/2024 CPSC503 Winter 2016 11
Discourse: Monologue Monologues as sequences of sentences have structure Tasks: Rhetorical (discourse) parsing and generation (like sentences as sequences of words) Key discourse phenomenon: referring expressions (what they denote may depend on previous discourse) Task: Coreference resolution 9/21/2024 CPSC503 Winter 2016 12
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. 9/21/2024 CPSC503 Winter 2016 15
Corresponding Text Structure CORE EVIDENCE House-A interesting house. is an CORE-1 CONCESSION-1 EVIDENCE-1 It location. has a convenient it is close to a rapid transportation stop it is close to work Even somewhat far from the park though house-A is 9/21/2024 CPSC503 Winter 2016 ordering 16 decomposition rhetorical relations
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 CORE EVIDENCE House-A interesting house. transportation stop. is an CORE-1 CONCESSION-1 EVIDENCE-1 It location. has a convenient it is close to a rapid transportation stop it is close to work Even somewhat far from the park though house-A is 9/21/2024 CPSC503 Winter 2016 ordering 18 decomposition rhetorical relations
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 CORE EVIDENCE House-A interesting house. transportation stop. is an CORE-1 CONCESSION-1 EVIDENCE-1 It location. has a convenient it is close to a rapid transportation stop it is close to work Even somewhat far from the park though house-A is 9/21/2024 CPSC503 Winter 2016 ordering 19 decomposition 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] content, text [Reiter et al. AIJ 03]. Generation of textual summaries from neonatal intensive care data [Portet et al. AIJ 09]. [convince user to quit smoking]generate structure, 9/21/2024 CPSC503 Winter 2016 20
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 9/21/2024 Co-reference resolution CPSC503 Winter 2016 21
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) 9/21/2024 CPSC503 Winter 2016 22
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. 9/21/2024 CPSC503 Winter 2016 23
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 9/21/2024 CPSC503 Winter 2016 24
Additional Complications Some pronouns don t refer to anything It rained 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] 9/21/2024 CPSC503 Winter 2016 25
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) 9/21/2024 CPSC503 Winter 2016 26
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 9/21/2024 CPSC503 Winter 2016 27
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 9/21/2024 CPSC503 Winter 2016 28
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, . 9/21/2024 CPSC503 Winter 2016 29
Coreference Resolution: State the art Neural Coreference Resolution Kevin Clark CS Stanford University - Report 9/21/2024 CPSC503 Winter 2016 30
Today Feb 25 Brief Intro Pragmatics Discourse Monologue Dialog 9/21/2024 CPSC503 Winter 2016 31
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 ACTION- DIRECTIVE ACCEPT 9/21/2024 CPSC503 Winter 2016 32
Dialog: two key tasks (1) Dialog act interpretation: identify the user dialog act (2) Dialog management: (1) & decide what to say and when 9/21/2024 CPSC503 Winter 2016 33
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 9/21/2024 CPSC503 Winter 2016 36
Cue-Based model (1) Each dialog act type (d) has its own micro-grammar which can be captured by N-gram models Split Corpus for d1 Corpus for dm N-gram models1 Annotated Corpus N-gram modelsm 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 9/21/2024 dialog act (d) we can compute P(F|d) CPSC503 Winter 2016 37
Cue-Based model (2) Conversational structure: Markov chain Annotated Corpus 1 1 d1 d3 1 .3 .8 d5 d2 .2 .2 .3 d4 .5 .7 Fi , Wi Combine all info sources: HMM/CRF ( | ) P i d d 1 i di-1 di d = ( P , | d ) P = W F d i W i i ( , | ) P W F i i i ( | ) ( | ) P F d i i i i Fi , Wi Fi , Wi N-gram models! 9/21/2024 CPSC503 Winter 2016 38
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 single model Now ( max arg D P D Sequences of sequences | , ) W F 9/21/2024 ..can be computed with CPSC503 Winter 2016 39
Assignment 3 will be posted soon (due March 11) Next class: Tue March 1 Project proposal (bring your write-up to class; 1-2 pages single project, 3-4 pages group project) Project proposal Presentation Approx 4 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) 9/21/2024 CPSC503 Winter 2016 40
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) 9/21/2024 CPSC503 Winter 2016 41
Knowledge-Formalisms Map (including probabilistic formalisms) U n d e r s t a n d i n g G e n e r a t i o n State Machines (and prob. versions) Morphology Syntax Rule systems (and prob. versions) Semantics (First-Order Logics) Thesaurus & corpus based methods Logical formalisms Pragmatics Discourse and Dialogue AI planners (MDPs Markov Decision Processes) 9/21/2024 CPSC503 Winter 2016 42
Next Time: Natural Language Generation Read handout on NLG Lecture will be about an NLG system that I developed and tested 9/21/2024 CPSC503 Winter 2016 43
Today 27/10 Brief Intro Pragmatics Discourse Monologue Dialog 9/21/2024 CPSC503 Winter 2016 44
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 ACTION- DIRECTIVE ACCEPT 9/21/2024 CPSC503 Winter 2016 45
Dialog: two key tasks (1) Dialog act interpretation: identify the user dialog act (2) Dialog management: (1) & decide what to say and when 9/21/2024 CPSC503 Winter 2016 46
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 9/21/2024 CPSC503 Winter 2016 47
Automatic Interpretation of Dialog Acts State Machines (and prob. versions) Morphology Cue-based Syntax Rule systems (and prob. versions) Semantics Pragmatics Discourse and Dialogue Logical formalisms (First-Order Logics) Plan-Inferential AI planners 9/21/2024 CPSC503 Winter 2016 48
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 9/21/2024 CPSC503 Winter 2016 49
Cue-Based model (1) Each dialog act type (d) has its own micro-grammar which can be captured by N-gram models Split Corpus for d1 Corpus for dm N-gram models1 Annotated Corpus N-gram modelsm 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 9/21/2024 dialog act (d) we can compute P(F|d) CPSC503 Winter 2016 50
Cue-Based model (2) Conversational structure: Markov chain Annotated Corpus 1 1 d1 d3 1 .3 .8 d5 d2 .2 .2 .3 d4 .5 .7 Fi , Wi Combine all info sources: HMM ( | ) P i d d 1 i di-1 di d = ( P , | d ) P = W F d i W i i ( , | ) P W F i i i ( | ) ( | ) P F d i i i i Fi , Wi Fi , Wi N-gram models! 9/21/2024 CPSC503 Winter 2016 51
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 Sequences of sequences Now arg max D ( | , ) P D W F 9/21/2024 ..can be computed with CPSC503 Winter 2016 52
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 9/21/2024 CPSC503 Winter 2016 53
Dialog Managers State Machines (and prob. versions) Morphology FSA Syntax Rule systems (and prob. versions) Semantics Template-Based Pragmatics Discourse and Dialogue Logical formalisms (First-Order Logics) BDI MDP AI planners (and prob. versions) 9/21/2024 CPSC503 Winter 2016 54
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 Time-consuming: To develop To execute Ties discourse processing with non- linguistic reasoning -> AI complete 9/21/2024 CPSC503 Winter 2016 55