CPSC 503 Computational Linguistics Lecture 10 Giuseppe Carenini

  • Slides: 49
Download presentation
CPSC 503 Computational Linguistics Lecture 10 Giuseppe Carenini 9/15/2020 CPSC 503 Winter 2007 1

CPSC 503 Computational Linguistics Lecture 10 Giuseppe Carenini 9/15/2020 CPSC 503 Winter 2007 1

Knowledge-Formalisms Map (including probabilistic formalisms) Morphology State Machines (and prob. versions) (Finite State Automata,

Knowledge-Formalisms Map (including probabilistic formalisms) Morphology State Machines (and prob. versions) (Finite State Automata, Finite State Transducers, Markov Models) Syntax Semantics Pragmatics Discourse and Dialogue Rule systems (and prob. versions) (e. g. , (Prob. ) Context-Free Grammars) Logical formalisms (First-Order Logics) AI planners 9/15/2020 CPSC 503 Winter 2007 2

Next three classes • What meaning is and how to represent it • How

Next three classes • What meaning is and how to represent it • How to map sentences into their meaning • Meaning of individual words (lexical semantics) • Computational Lexical Semantics Tasks – Word sense disambiguation – Word Similarity – Semantic Labeling 9/15/2020 CPSC 503 Winter 2007 3

Today 16/10 • Semantics / Meaning /Meaning Representations • Linguistically relevant Concepts in FOPC

Today 16/10 • Semantics / Meaning /Meaning Representations • Linguistically relevant Concepts in FOPC / POL • Semantic Analysis 9/15/2020 CPSC 503 Winter 2007 4

Semantics Def. Semantics: The study of the meaning of words, intermediate constituents and sentences

Semantics Def. Semantics: The study of the meaning of words, intermediate constituents and sentences Def 1. Meaning: a representation that expresses the linguistic input in terms of objects, actions, events, time, space… beliefs, attitudes. . . relationships Def 2. Meaning: a representation that links the linguistic input to knowledge of the world Language independent! 9/15/2020 CPSC 503 Winter 2007 5

Semantic Relations involving Sentences Same truth Paraphrase: have the same meaning conditions • I

Semantic Relations involving Sentences Same truth Paraphrase: have the same meaning conditions • I gave the apple to John vs. I gave John the apple • I bought a car from you vs. you sold a car to me • The thief was chased by the police vs. …… Entailment: “implication” • The park rangers killed the bear vs. The bear is dead • Nemo is a fish vs. Nemo is an animal Contradiction: I am in Vancouver vs. I am in India 9/15/2020 CPSC 503 Winter 2007 6

Meaning Structure of Language • How does language convey meaning? – Grammaticization – Display

Meaning Structure of Language • How does language convey meaning? – Grammaticization – Display a partially compositional semantics – Display a basic predicate-argument structure (e. g. , verb complements) – Words 9/15/2020 CPSC 503 Winter 2007 7

Grammaticization Concept • • Past More than one Again Negation • • Affix -ed

Grammaticization Concept • • Past More than one Again Negation • • Affix -ed -s rein-, un-, de- Words from Nonlexical categories • Obligation • Possibility • Definite, Specific • Indefinite, Non-specific • Disjunction • Negation • Conjunction CPSC 503 Winter 2007 9/15/2020 • • must may the a or not and 8

Common Meaning Representations I have a car FOL Semantic Nets Conceptual Dependency 9/15/2020 Frames

Common Meaning Representations I have a car FOL Semantic Nets Conceptual Dependency 9/15/2020 Frames CPSC 503 Winter 2007 9

Requirements for Meaning Representations • Sample NLP Task: giving advice about restaurants – Accept

Requirements for Meaning Representations • Sample NLP Task: giving advice about restaurants – Accept queries in NL – Generate appropriate responses by consulting a KB e. g, • Does Maharani serve vegetarian food? -> Yes • What restaurants are close to the ocean? -> C and Monks 9/15/2020 CPSC 503 Winter 2007 10

Verifiability (in the world? ) • Example: Does Le. Dog serve vegetarian food? •

Verifiability (in the world? ) • Example: Does Le. Dog serve vegetarian food? • Knowledge base (KB) expressing our world model (in a formal language) • Convert question to KB language and verify its truth value against the KB content Yes / No / I do not know 9/15/2020 CPSC 503 Winter 2007 11

Canonical Form • • • Paraphrases should be mapped into the same representation. Does

Canonical Form • • • Paraphrases should be mapped into the same representation. Does Le. Dog have vegetarian dishes? Do they have vegetarian food at Le. Dog? Are vegetarian dishes served at Le. Dog? Does Le. Dog serve vegetarian fare? …………… 9/15/2020 CPSC 503 Winter 2007 12

How to Produce a Canonical Form • Words have different senses – food ___

How to Produce a Canonical Form • Words have different senses – food ___ – dish ___|____one overlapping meaning sense – fare ___| • Meaning of alternative syntactic constructions are systematically related server thing-being-served – [S [NP Maharani] serves [NP vegetarian dishes]] thing-being-served server [S [NP vegetarian dishes] are served at [NP Maharani]] 9/15/2020 CPSC 503 Winter 2007 13

Inference and Expressiveness • Consider a more complex request – Can vegetarians eat at

Inference and Expressiveness • Consider a more complex request – Can vegetarians eat at Maharani? – Vs: Does Maharani serve vegetarian food? • Why do these result in the same answer? • Inference: System’s ability to draw valid conclusions based on the meaning representations of inputs and its KB • serve(Maharani, Vegetarian. Food) => Can. Eat(Vegetarians, At(Maharani)) Expressiveness: system must be able to handle a wide range of subject matter 9/15/2020 CPSC 503 Winter 2007 14

Non Yes/No Questions • Example: I'd like to find a restaurant where I can

Non Yes/No Questions • Example: I'd like to find a restaurant where I can get vegetarian food. • Indefinite reference <-> variable serve(x, Vegetarian. Food) • Matching succeeds only if variable x can be replaced by known object in KB. What restaurants are close to the ocean? -> C and Monks 9/15/2020 CPSC 503 Winter 2007 15

Meaning Structure of Language • How does language convey meaning? – Grammaticization – Display

Meaning Structure of Language • How does language convey meaning? – Grammaticization – Display a partially compositional semantics – Display a basic predicate-argument structure (e. g. , verb complements) – Words 9/15/2020 CPSC 503 Winter 2007 16

Predicate-Argument Structure • Represent relationships among concepts • Some words act like arguments and

Predicate-Argument Structure • Represent relationships among concepts • Some words act like arguments and some words act like predicates: – Nouns as concepts or arguments: red(ball) – Adj, Adv, Verbs as predicates: red(ball) • Subcategorization frames specify number, position, and syntactic category of arguments • Examples: give NP 2 NP 1, find NP, sneeze [] 9/15/2020 CPSC 503 Winter 2007 17

Semantic (Thematic) Roles This can be extended to the realm of semantics • Semantic

Semantic (Thematic) Roles This can be extended to the realm of semantics • Semantic Roles: Participants in an event – Agent: George hit Bill was hit by George – Theme: George hit Bill was hit by George Source, Goal, Instrument, Force… • Verb subcategorization: Allows linking arguments in surface structure with their semantic roles • Mary gave/sent/read a book to Ming Agent Theme Goal • Mary gave/sent/read Ming a book Agent Goal Theme 9/15/2020 CPSC 503 Winter 2007 18

Non-verbal predicate-argument structures • A Spanish restaurant under the bridge Under(Spanish. Restaurant, bridge) Selectional

Non-verbal predicate-argument structures • A Spanish restaurant under the bridge Under(Spanish. Restaurant, bridge) Selectional Restrictions • Semantic (Selectional) Restrictions: Constrain the types of arguments verbs take – George assassinated the senator – *The spider assassinated the fly 9/15/2020 CPSC 503 Winter 2007 19

First Order Predicate Calculus (FOPC) • FOPC provides sound computational basis for verifiability, inference,

First Order Predicate Calculus (FOPC) • FOPC provides sound computational basis for verifiability, inference, expressiveness… – – – Supports determination of truth Supports Canonical Form Supports compositionality of meaning Supports question-answering (via variables) Supports inference Argument-Predicate structure 9/15/2020 CPSC 503 Winter 2007 20

Today 16/10 • Semantics / Meaning /Meaning Representations • Linguistically relevant Concepts in FOPC

Today 16/10 • Semantics / Meaning /Meaning Representations • Linguistically relevant Concepts in FOPC / POL • Semantic Analysis 9/15/2020 CPSC 503 Winter 2007 21

Linguistically Relevant Concepts in FOPC • • • Categories & Events (Reification) Representing Time

Linguistically Relevant Concepts in FOPC • • • Categories & Events (Reification) Representing Time Beliefs (optional, read if relevant to your project) Aspects (optional, read if relevant to your project) Description Logics (optional, read if relevant to your project) 9/15/2020 CPSC 503 Winter 2007 22

Categories & Events • Categories: – Vegetarian. Restaurant (Joe’s) - relation vs. object –

Categories & Events • Categories: – Vegetarian. Restaurant (Joe’s) - relation vs. object – Most. Popular(Joe’s, Vegetarian. Restaurant) – ISA (Joe’s, Vegetarian. Restaurant) Reification – AKO (Vegetarian. Restaurant, Restaurant) • Events: eg. “Make a reservation” – Reservation (Speaker, Joe’s, Today, 8 PM, 2) – Problems: • Determining the correct number of roles • Representing facts about the roles associated with an event • Ensuring that all and only the correct inferences can be drawn 9/15/2020 CPSC 503 Winter 2007 23

MUC-4 Example On October 30, 1989, one civilian was killed in a reported FMLN

MUC-4 Example On October 30, 1989, one civilian was killed in a reported FMLN attack in El Salvador. INCIDENT: DATE 30 OCT 89 INCIDENT: LOCATION EL SALVADOR INCIDENT: TYPE ATTACK INCIDENT: STAGE OF EXECUTION ACCOMPLISHED INCIDENT: INSTRUMENT ID INCIDENT: INSTRUMENT TYPE PERP: INCIDENT CATEGORY TERRORIST ACT PERP: INDIVIDUAL ID "TERRORIST" PERP: ORGANIZATION ID "THE FMLN" PERP: ORG. CONFIDENCE REPORTED: "THE FMLN" PHYS TGT: ID PHYS TGT: TYPE PHYS TGT: NUMBER PHYS TGT: FOREIGN NATION PHYS TGT: EFFECT OF INCIDENT PHYS TGT: TOTAL NUMBER HUM TGT: NAME HUM TGT: DESCRIPTION "1 CIVILIAN" HUM TGT: TYPE CIVILIAN: "1 CIVILIAN" HUM TGT: NUMBER 1: "1 CIVILIAN" HUM TGT: FOREIGN NATION HUM TGT: EFFECT OF INCIDENT DEATH: "1 CIVILIAN" HUM TGT: TOTAL NUMBER 9/15/2020 CPSC 503 Winter 2007 24

Subcategorization frames • • I I I I ate ate a turkey sandwich at

Subcategorization frames • • I I I I ate ate a turkey sandwich at my desk lunch a turkey sandwich for lunch at my desk no fixed “arity”! 9/15/2020 CPSC 503 Winter 2007 25

Reification Again “I ate a turkey sandwich for lunch” $ w: Isa(w, Eating) Ù

Reification Again “I ate a turkey sandwich for lunch” $ w: Isa(w, Eating) Ù Eater(w, Speaker) Ù Eaten(w, Turkey. Sandwich) Ù Meal. Eaten(w, Lunch) • Reification Advantages: – No need to specify fixed number of arguments for a given surface predicate – No more roles are postulated than mentioned in the input – Logical connections among related examples are specified 9/15/2020 CPSC 503 Winter 2007 26

Representing Time • Events are associated with points or intervals in time. • We

Representing Time • Events are associated with points or intervals in time. • We can impose an ordering on distinct events using the notion of precedes. • Temporal logic notation: ($w, x, t) Arrive(w, x, t) • Constraints on variable t I arrived in New York ($ t) Arrive(I, New. York, t) Ù precedes(t, Now) 9/15/2020 CPSC 503 Winter 2007 27

Interval Events • Need tstart and tend “She was driving to New York until

Interval Events • Need tstart and tend “She was driving to New York until now” $ tstart, tend , e, i ISA(e, Drive) Driver(e, She) Dest(e, New. York) Ù Interval. Of(e, i) Endpoint(i, tend) Startpoint(i, tend) Precedes(tstart, Now) Ù Equals(tend, Now) 9/15/2020 CPSC 503 Winter 2007 28

Relation Between Tenses and Time • Relation between simple verb tenses and points in

Relation Between Tenses and Time • Relation between simple verb tenses and points in time is not straightforward • Present tense used like future: – We fly from Baltimore to Boston at 10 • Complex tenses: – Flight 1902 arrived late – Flight 1902 had arrived late 9/15/2020 CPSC 503 Winter 2007 29

Reference Point • Reichenbach (1947) introduced notion of Reference point (R), separated out from

Reference Point • Reichenbach (1947) introduced notion of Reference point (R), separated out from Utterance time (U) and Event time (E) • Example: – When Mary's flight departed, I ate lunch – When Mary's flight departed, I had eaten lunch • Departure event specifies reference point. 9/15/2020 CPSC 503 Winter 2007 30

Today 16/10 • Semantics / Meaning /Meaning Representations • Linguistically relevant Concepts in FOPC

Today 16/10 • Semantics / Meaning /Meaning Representations • Linguistically relevant Concepts in FOPC / POL • Semantic Analysis 9/15/2020 CPSC 503 Winter 2007 31

Semantic Analysis Meanings of grammatical structures Meanings of words Common-Sense Domain knowledge Discourse Structure

Semantic Analysis Meanings of grammatical structures Meanings of words Common-Sense Domain knowledge Discourse Structure Context 9/15/2020 Sentence Syntax-driven Semantic Analysis Literal Meaning Further Analysis Intended meaning CPSC 503 Winter 2007 I N F E R E N C E 32

Compositional Analysis • Principle of Compositionality – The meaning of a whole is derived

Compositional Analysis • Principle of Compositionality – The meaning of a whole is derived from the meanings of the parts • What parts? – The constituents of the syntactic parse of the input • What could it mean for a part to have a meaning? 9/15/2020 CPSC 503 Winter 2007 33

Compositional Analysis: Example • Ay. Caramba serves meat 9/15/2020 CPSC 503 Winter 2007 34

Compositional Analysis: Example • Ay. Caramba serves meat 9/15/2020 CPSC 503 Winter 2007 34

Augmented Rules • Augment each syntactic CFG rule with a semantic formation rule •

Augmented Rules • Augment each syntactic CFG rule with a semantic formation rule • Abstractly • i. e. , The semantics of A can be computed from some function applied to the semantics of its parts. • The class of actions performed by f will be quite restricted. 9/15/2020 CPSC 503 Winter 2007 35

Simple Extension of FOL: Lambda Forms – A FOL sentence with variables in it

Simple Extension of FOL: Lambda Forms – A FOL sentence with variables in it that are to be bound. – Lambda-reduction: variables are bound by treating the lambda form as a function with formal arguments 9/15/2020 CPSC 503 Winter 2007 36

Augmented Rules: Example assigning constants • Attachments {Ay. Caramba} – Prop. Noun -> Ay.

Augmented Rules: Example assigning constants • Attachments {Ay. Caramba} – Prop. Noun -> Ay. Caramba {MEAT} – Mass. Noun -> meat • Easy parts… copying from daughters up to mothers. • Attachments – NP -> Prop. Noun {Prop. Noun. sem} – NP -> Mass. Noun {Mass. Noun. sem} 9/15/2020 CPSC 503 Winter 2007 37

Augmented Rules: Example Semantics attached to one daughter is applied to semantics of the

Augmented Rules: Example Semantics attached to one daughter is applied to semantics of the other daughter(s). • S -> NP VP • VP -> Verb NP • {VP. sem(NP. sem)} • {Verb. sem(NP. sem) lambda-form • Verb -> serves 9/15/2020 CPSC 503 Winter 2007 38

Example y y MEAT AC • • ……. MEAT S -> NP VP VP

Example y y MEAT AC • • ……. MEAT S -> NP VP VP -> Verb NP Verb -> serves NP -> Prop. Noun NP -> Mass. Noun Prop. Noun -> Ay. Caramba Mass. Noun -> meat 9/15/2020 • {VP. sem(NP. sem)} • {Verb. sem(NP. sem) • {Prop. Noun. sem} • {Mass. Noun. sem} • {AC} CPSC 503 Winter 2007 • {MEAT} 39

Full story more complex • To deal properly with quantifiers – Permit lambda-variables to

Full story more complex • To deal properly with quantifiers – Permit lambda-variables to range over predicates. E. g. , – Introduce complex terms to remain agnostic about final scoping 9/15/2020 CPSC 503 Winter 2007 40

Solution: Quantifier Scope Ambiguity • Similarly to PP attachment, number of possible interpretations exponential

Solution: Quantifier Scope Ambiguity • Similarly to PP attachment, number of possible interpretations exponential in the number of complex terms • Weak methods to prefer one interpretation over another: • likelihood of different orderings • Mirror surface ordering • Domain specific knowledge 9/15/2020 CPSC 503 Winter 2007 41

Attachments for a fragment of English (Sect. 18. 5) • • Sentences Noun-phrases Verb-phrases

Attachments for a fragment of English (Sect. 18. 5) • • Sentences Noun-phrases Verb-phrases Prepositional-phrases Based on “The core Language Engine” 1992 9/15/2020 CPSC 503 Winter 2007 42

Integration with a Parser • Assume you’re using a dynamic-programming style parser (Earley or

Integration with a Parser • Assume you’re using a dynamic-programming style parser (Earley or CYK). • Two basic approaches – Integrate semantic analysis into the parser (assign meaning representations as constituents are completed) – Pipeline… assign meaning representations to complete trees only after they’re completed 9/15/2020 CPSC 503 Winter 2007 43

Pros and Cons • Integration – use semantic constraints to cut off parses that

Pros and Cons • Integration – use semantic constraints to cut off parses that make no sense – assign meaning representations to constituents that don’t take part in any correct parse • Pipeline – assign meaning representations only to constituents that take part in a correct parse – parser needs to generate all correct parses 9/15/2020 CPSC 503 Winter 2007 44

Next Time • Read Chp. 19 (Lexical Semantics) 9/15/2020 CPSC 503 Winter 2007 45

Next Time • Read Chp. 19 (Lexical Semantics) 9/15/2020 CPSC 503 Winter 2007 45

Non-Compositionality • Unfortunately, there are lots of examples where the meaning of a constituent

Non-Compositionality • Unfortunately, there are lots of examples where the meaning of a constituent can’t be derived from the meanings of the parts - metaphor, (e. g. , corporation as person) – metonymy, (? ? ) – idioms, – irony, – sarcasm, – indirect requests, etc 9/15/2020 CPSC 503 Winter 2007 46

English Idioms • Lots of these… constructions where the meaning of the whole is

English Idioms • Lots of these… constructions where the meaning of the whole is either – Totally unrelated to the meanings of the parts (“kick the bucket”) – Related in some opaque way (“run the show”) • • 9/15/2020 “buy the farm” “bite the bullet” “bury the hatchet” etc… CPSC 503 Winter 2007 47

The Tip of the Iceberg – “Enron is the tip of the iceberg. ”

The Tip of the Iceberg – “Enron is the tip of the iceberg. ” NP -> “the tip of the iceberg” {…. } – “the tip of an old iceberg” – “the tip of a 1000 -page iceberg” – “the merest tip of the iceberg” NP -> Tip. NP of Iceberg. NP {…} Tip. NP: NP with tip as its head Iceberg. NP NP with iceberg as its head 9/15/2020 CPSC 503 Winter 2007 48

Handling Idioms – Mixing lexical items and grammatical constituents – Introduction of idiom-specific constituents

Handling Idioms – Mixing lexical items and grammatical constituents – Introduction of idiom-specific constituents – Permit semantic attachments that introduce predicates unrelated with constituents NP -> Tip. NP of Iceberg. NP {small-part(), beginning()…. } Tip. NP: NP with tip as its head Iceberg. NP NP with iceberg as its head 9/15/2020 CPSC 503 Winter 2007 49