CPSC 503 Computational Linguistics

Slides:



Advertisements
Similar presentations
CILC2011 A framework for structured knowledge extraction and representation from natural language via deep sentence analysis Stefania Costantini Niva Florio.
Advertisements

Syntactic analysis using Context Free Grammars. Analysis of language Morphological analysis – Chairs, Part Of Speech (POS) tagging – The/DT man/NN left/VBD.
Statistical NLP: Lecture 3
1 Computational Semantics Chapter 18 November 2012 We will not do all of this… Lecture #12.
For Monday Read Chapter 23, sections 3-4 Homework –Chapter 23, exercises 1, 6, 14, 19 –Do them in order. Do NOT read ahead.
Meaning Representation and Semantic Analysis Ling 571 Deep Processing Techniques for NLP February 9, 2011.
6/9/2015CPSC503 Winter CPSC 503 Computational Linguistics Lecture 11 Giuseppe Carenini.
CS 4705 Semantic Analysis: Syntax-Driven Semantics.
CS 330 Programming Languages 09 / 13 / 2007 Instructor: Michael Eckmann.
CS 4705 Lecture 17 Semantic Analysis: Syntax-Driven Semantics.
Let remember from the previous lesson what is Knowledge representation
CS 4705 Semantic Analysis: Syntax-Driven Semantics.
1 CSC 594 Topics in AI – Applied Natural Language Processing Fall 2009/2010 Overview of NLP tasks (text pre-processing)
Models of Generative Grammar Smriti Singh. Generative Grammar  A Generative Grammar is a set of formal rules that can generate an infinite set of sentences.
11 CS 388: Natural Language Processing: Syntactic Parsing Raymond J. Mooney University of Texas at Austin.
Albert Gatt LIN 3098 Corpus Linguistics. In this lecture Some more on corpora and grammar Construction Grammar as a theoretical framework Collostructional.
Context Free Grammars Reading: Chap 12-13, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Paul Tarau, based on Rada.
Natural Language Processing
1 Features and Unification Chapter 15 October 2012 Lecture #10.
9/8/20151 Natural Language Processing Lecture Notes 1.
For Friday Finish chapter 23 Homework: –Chapter 22, exercise 9.
1 Statistical Parsing Chapter 14 October 2012 Lecture #9.
Natural Language Processing Introduction. 2 Natural Language Processing We’re going to study what goes into getting computers to perform useful and interesting.
10. Parsing with Context-free Grammars -Speech and Language Processing- 발표자 : 정영임 발표일 :
1 Natural Language Processing Lecture Notes 11 Chapter 15 (part 1)
Semantic Analysis CMSC Natural Language Processing May 8, 2003.
An Intelligent Analyzer and Understander of English Yorick Wilks 1975, ACM.
Context Free Grammars Reading: Chap 9, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Rada Mihalcea.
11 Chapter 14 Part 1 Statistical Parsing Based on slides by Ray Mooney.
Computing Science, University of Aberdeen1 CS4025: Logic-Based Semantics l Compositionality in practice l Producing logic-based meaning representations.
1 Natural Language Processing Chapter 15 (part 2).
Lecture 1, 7/21/2005Natural Language Processing1 CS60057 Speech &Natural Language Processing Autumn 2007 Lecture August 2007.
Semantic Construction lecture 2. Semantic Construction Is there a systematic way of constructing semantic representation from a sentence of English? This.
Albert Gatt LIN3021 Formal Semantics Lecture 4. In this lecture Compositionality in Natural Langauge revisited: The role of types The typed lambda calculus.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Rules, Movement, Ambiguity
Artificial Intelligence: Natural Language
CPSC 503 Computational Linguistics
Supertagging CMSC Natural Language Processing January 31, 2006.
CPSC 422, Lecture 27Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 27 Nov, 16, 2015.
King Faisal University جامعة الملك فيصل Deanship of E-Learning and Distance Education عمادة التعلم الإلكتروني والتعليم عن بعد [ ] 1 King Faisal University.
10/31/00 1 Introduction to Cognitive Science Linguistics Component Topic: Formal Grammars: Generating and Parsing Lecturer: Dr Bodomo.
Natural Language Processing Vasile Rus
Natural Language Processing Vasile Rus
Introduction to Parsing (adapted from CS 164 at Berkeley)
Statistical NLP: Lecture 3
Natural Language Processing
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 27
Natural Language Processing
Compiler Lecture 1 CS510.
Part I: Basics and Constituency
CPSC 503 Computational Linguistics
CPSC 503 Computational Linguistics
CSCI 5832 Natural Language Processing
CS 388: Natural Language Processing: Syntactic Parsing
CSCI 5832 Natural Language Processing
Probabilistic and Lexicalized Parsing
CSCI 5832 Natural Language Processing
Natural Language - General
CSCI 5832 Natural Language Processing
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 27
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 26
CSCI 5832 Natural Language Processing
CSCI 5832 Natural Language Processing
Linguistic Essentials
CPSC 503 Computational Linguistics
David Kauchak CS159 – Spring 2019
Faculty of Computer Science and Information System
CPSC 503 Computational Linguistics
Presentation transcript:

CPSC 503 Computational Linguistics Semantic Analysis Lecture 16 Giuseppe Carenini 11/13/2018 CPSC503 Spring 2004

Meanings of grammatical structures Semantic Analysis Sentence Meanings of grammatical structures Syntax-driven Semantic Analysis Meanings of words Literal Meaning I N F E R C Common-Sense Domain knowledge Further Analysis Context. Mutual knowledge, physical context Has Mary left? Semantic analysis is the process of taking in some linguistic input and assigning a meaning representation to it. There a lot of different ways to do this that make more or less (or no) use of syntax We’re going to start with the idea that syntax does matter The compositional rule-to-rule approach Discourse Structure Intended meaning Context 11/13/2018 CPSC503 Spring 2004

Today 17/3 Compositional Analysis Integrate semantics and parsing Non-compositionality Semantic Grammars Information Extraction Semantic Grammars: productions and constituents are designed to correspond directly to entities and relations from the domain being modelled IE small amount of specific information from large bodies of text Does not require complete syntactic analysis 11/13/2018 CPSC503 Spring 2004

Meaning Structure of Language How does language convey meaning? Grammaticization Tense systems Conjunctions Quantifiers Indefinites (variables) ………… Display a partially compositional semantics Display a basic predicate-argument structure Events, actions and relationships can be captured with representations that consist of predicates and arguments. Languages display a division of labor where some words and constituents function as predicates and some as arguments. Past More than one Again Negation Obligation Possibility Definite, Specific Indefinite, Non-specific Disjunction Conjunction 11/13/2018 CPSC503 Spring 2004

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? 11/13/2018 CPSC503 Spring 2004

Compositional Analysis: Example AyCaramba serves meat 11/13/2018 CPSC503 Spring 2004

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 A’s parts. We’ll accomplish this by attaching semantic formation rules to our syntactic CFG rules This should be read as the semantics we attach to A can be computed from some function applied to the semantics of A’s parts. As we’ll see the class of actions performed by f in the following rule can be quite restricted. The class of actions performed by f will be quite restricted. 11/13/2018 CPSC503 Spring 2004

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 Extend syntax of FOL The state of something satisfying the P predicate Allow those variables to be bound by treating the lambda form as a function with formal arguments Lambda-reduction you can apply the lambda expression to logical terms and create new FOPC expressions in which the occurrences of the variable are bound to the argument more than one variable: an application returns a reduced lambda exp. 11/13/2018 CPSC503 Spring 2004

Augmented Rules: Example Easy parts… assigning constants Attachments {AyCaramba} {MEAT} PropNoun -> AyCaramba MassNoun -> meat copying from daughters up to mothers. NP -> PropNoun NP -> MassNoun Attachments {PropNoun.sem} {MassNoun.sem} Concrete entities are represented by FOPC constants These attachments consist of assigning constants and copying from daugthers up to mothers. 11/13/2018 CPSC503 Spring 2004

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 These consist of taking the semantics attached to one daughter and applying it as a function to the semantics of the other daughters. Verb -> serves 11/13/2018 CPSC503 Spring 2004

Example S -> NP VP VP -> Verb NP Verb -> serves y MEAT ……. AC MEAT S -> NP VP VP -> Verb NP Verb -> serves NP -> PropNoun NP -> MassNoun PropNoun -> AyCaramba MassNoun -> meat {VP.sem(NP.sem)} {Verb.sem(NP.sem) {PropNoun.sem} {MassNoun.sem} {AC} {MEAT} Each node in a tree corresponds to a rule in the grammar Each grammar rule has a semantic rule associated with it that specifies how the semantics of the RHS of that rule can be computed from the semantics of its daughters. Strong Compositionality :The semantics of the whole is derived solely from the semantics of the parts. (i.e. we ignore what’s going on in other parts of the tree). 11/13/2018 CPSC503 Spring 2004

Problem: Quantified Phrases Consider “A restaurant serves meat.” Assume that semantics for A restaurant is: If we proceed as we did in the previous example, the semantics for S would be: ?!? 11/13/2018 CPSC503 Spring 2004

Solution: Complex Terms Complex-Term → <Quantifier var body> Examples Now, semantics of: “A restaurant serves meat”: Similarly to lambda exp. We have to provide a straightforward way to convert it back to FOL So… complex terms wind up being embedded inside predicates. So pull them out and redistribute the parts in the right way… 11/13/2018 CPSC503 Spring 2004

Convert complex-terms back to FOL P(<quantifier, var, body>) Quantifier var body connective P(var) Example If the quantifier is , then the connective is an  If the quantifier is , then the connective is an  Note 11/13/2018 CPSC503 Spring 2004

Problem: Quantifier Scope Ambiguity Consider: “Every restaurant has a menu” first Note that the conversion technique pulls the quantifiers out to the front of the logical form… That leads to ambiguity if there’s more than one complex term in a sentence. Consider Every restaurant has a menu That could mean that every restaurant has a menu Or that There’s some uber-menu out there and all restaurants have that menu  first 11/13/2018 CPSC503 Spring 2004

Solution: Quantifier Scope Ambiguity Similarly to PP attachment, number of possible interpretations exponential in the number of complex terms likelihood of different orderings Mirror surface ordering Domain specific knowledge Weak methods to prefer one interpretation over another: 11/13/2018 CPSC503 Spring 2004

Attachments for a fragment of English Sentences Noun-phrases Verb-phrases Prepositional-phrases The Core Language Engine Edited by Hiyan Alshawi The Core Language Engine presents the theoretical and engineering advances embodied in one of the most comprehensive natural language processing systems designed to date. Recent research results from different areas of computational linguistics are integrated into a single elegant design with potential for application to tasks ranging from machine translation to information system interfaces. Bridging the gap between theoretical and implementation oriented literature, The Core Language Engine describes novel analyses and techniques developed by the contributors at SRI International's Cambridge Computer Science Research Centre. It spans topics that include a wide-coverage unification grammar for English syntax and semantics, context-dependent and contextually disambiguated logical form representations, interactive translation, efficient algorithms for parsing and generation, and mechanisms for quantifier scoping, reference resolution, and lexical acquisition. Hiyan Alshawi is Senior Computer Scientist at SRI International, Cambridge, England. Contents: Introduction to the CLE. Logical Forms. Categories and Rules. Unification Based Syntactic Analysis. Semantic Rules for English. Lexical Analysis. Syntactic and Semantic Processing. Quantifier Scoping. Sortal Restrictions. Resolving Quasi Logical Forms. Lexical Acquisition. The CLE in Application Development. Ellipsis, Comparatives, and Generation. Swedish- English QLF Translation. Based on “The core Language Engine” 1992 11/13/2018 CPSC503 Spring 2004

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 As constituents are completed and entered into the table, we compute their semantics. If they’re complete, we have their parts. If we have their parts we have the semantics for the parts… Therefore we can compute the semantics of the newly completed constituent. 11/13/2018 CPSC503 Spring 2004

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 the correct (most probable) parse Pipeline assign meaning representations only to constituents that take part in the correct (most probable) parse parser needs to generate all correct parses Integration semantic analysis into the parser as its running… You can use semantic constraints to cut off parses that make no sense From BERP I want to eat someplace near campus The Berkeley Restaurant Project (BeRP) 11/13/2018 CPSC503 Spring 2004

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, (corporation as person) metonymy, (??) idioms, irony, sarcasm, indirect requests, etc He likes Joyce Corporation as person. The white house did not like her comment 11/13/2018 CPSC503 Spring 2004

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”) “buy the farm” “bite the bullet” “bury the hatchet” etc… 11/13/2018 CPSC503 Spring 2004

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” Describing this particular construction A fixed phrase with a particular meaning A syntactically and lexically flexible phrase with a particular meaning A syntactically and lexically flexible phrase with a partially compositional meaning How about That’s just the iceberg’s tip. NP -> TipNP of IcebergNP {…} TipNP: NP with tip as its head IcebergNP NP with iceberg as its head 11/13/2018 CPSC503 Spring 2004

Handling Idioms Mixing lexical items and grammatical constituents Introduction of idiom-specific constituents Permit semantic attachments that introduce predicates unrelated with constituents NP -> TipNP of IcebergNP {small-part(), beginning()….} TipNP: NP with tip as its head IcebergNP NP with iceberg as its head Describing this particular construction A fixed phrase with a particular meaning A syntactically and lexically flexible phrase with a particular meaning A syntactically and lexically flexible phrase with a partially compositional meaning How about That’s just the iceberg’s tip. Syntax and semantics aren’t separable in the way that we’ve been assuming Grammars contain form-meaning pairings that vary in the degree to which the meaning of a constituent (and what constitutes a constituent) can be computed from the meanings of the parts. 11/13/2018 CPSC503 Spring 2004

Knowledge-Formalisms Map (including probabilistic formalisms) State Machines (and prob. versions) (Finite State Automata,Finite State Transducers, Markov Models) Morphology Syntax IE Rule systems (and prob. versions) (e.g., (Prob.) Context-Free Grammars) SG Semantics Pragmatics Discourse and Dialogue Logical formalisms (First-Order Logics) AI planners 11/13/2018 CPSC503 Spring 2004

Semantic Grammars Def: CFGs in which rules and constituents correspond directly to semantic entities and relations Meeting scheduler ……….. suggestion -> suggest-time suggest-time -> how about time time -> point point -> on dayofweek timeofday dayofweek -> Tuesday … timeofday -> afternoon Restaurant Reservation ……….. Info-Request -> User want to eat FoodType TimeExp FoodType ->Nationality FoodType Nationality ->Chinese,…. One problem with traditional grammars is that they don’t necessarily reflect the semantics in a straightforward way You can deal with this by… Fighting with the grammar Complex lambdas and complex terms, etc Rewriting the grammar to reflect the semantics And in the process give up on some syntactic niceties 11/13/2018 CPSC503 Spring 2004

Semantic Grammars Limitations Almost complete lack of reuse Tend to grow in size (missing syntactic generalizations) Typically used in conversational agents in constrained domains Limited vocabulary Limited grammatical complexity grow in size -Italian food -Italian restaurant 11/13/2018 CPSC503 Spring 2004

Information Extraction (IE) Scanning newspapers, newswires for a fixed set of events of interests E.g., ?? Scanning websites for products, prices, reviews, etc. Arbitrarily complex (long) sentences Extended discourse Multiple writers Database-style shallow semantics (attribute-value lists) IE A different kind of approach is required for information extraction applications Such systems must deal with… International business joint ventures 11/13/2018 CPSC503 Spring 2004

Back to Finite State Methods Apply a series of cascaded transducers to an input text At each stage specific elements of syntax/semantics are extracted for use in the next level: e.g., complex phrases, semantic patterns The end result is a set of relations suitable for entry into a database 11/13/2018 CPSC503 Spring 2004

Complex Phrases & Semantic Patterns Relationship: TIE-UP Entities: Bridgestone Sports Co. said Friday it has set up a joint venture in Taiwan with a local concern and a Japanese trading house to produce golf clubs to be shipped to Japan. The joint venture, Bridgestone Sports Taiwan Co., capitalized at 20 million new Taiwan dollars, will start production in January 1990 with production of 20,000 iron and “metal wood” clubs a... Activity: PRODUCTION Product: 11/13/2018 CPSC503 Spring 2004

FASTUS Output 11/13/2018 CPSC503 Spring 2004

Named Entities Recognition Labeling all the occurrences of named entities in a text… People, organizations, lakes, bridges, hospitals, mountains, etc… This can be done quite robustly and looks like one of the most useful tasks across a variety of applications 11/13/2018 CPSC503 Spring 2004

Next Time Lexical Semantics Read Chapter 16 11/13/2018 CPSC503 Spring 2004

Meaning Structure of Language The semantics of human languages… Display a basic predicate-argument structure Make use of variables Make use of quantifiers Use a partially compositional semantics Has Mary left? 11/13/2018 CPSC503 Spring 2004

IE Key Points What about the stuff we don’t care about? Ignore it. I.e. It’s not written to the next tape, so it just disappears from further processing It works because of the constrained nature of the problem… Only looking for a small set of items that can appear in a small set of roles 11/13/2018 CPSC503 Spring 2004

Cascades 11/13/2018 CPSC503 Spring 2004

Key Point It works because of the constrained nature of the problem… Only looking for a small set of items that can appear in a small set of roles 11/13/2018 CPSC503 Spring 2004

Next Time More robust approaches to semantic analysis Semantic grammars Information extraction Probabilistic labeling More on less than compositional constructions and Word meanings So read Chapter 16 11/13/2018 CPSC503 Spring 2004

Predicate-Argument Semantics The functions/operations permitted in the semantic rules fall into two classes Pass the semantics of a daughter up unchanged to the mother Apply (as a function) the semantics of one of the daughters of a node to the semantics of the other daughters 11/13/2018 CPSC503 Spring 2004

Predicate-Argument Semantics S -> NP VP VP -> Verb NP Is it really necessary to specify these attachments? {VP.sem(NP.sem)} {Verb.sem(NP.sem) No, in each rule there’s a daughter whose semantics is a function and one that isn’t. What else is there to do? 11/13/2018 CPSC503 Spring 2004

Harder Example What makes this hard? What role does Harry play in all this? 11/13/2018 CPSC503 Spring 2004

Harder Example The VP for told is VP -> V NP VPto So you do what? Apply the semantic function attached to VPTO the semantics of the NP; this binds Harry as the goer of the going. Then apply the semantics of the V to the semantics of the NP; this binds Harry as the Tellee of the Telling And to the result of the first application to get the right value of the told thing. V.Sem(NP.Sem, VPto.Sem(NP.Sem) 11/13/2018 CPSC503 Spring 2004

Harder Example That’s a little messy and violates the notion that the grammar ought not to know much about what is going on in the semantics… Better might be V.sem(NP.Sem, VPto.Sem) i.e Apply the semantics of the head verb to the semantics of its arguments. Complicate the semantics of the verb inside VPto to figure out what’s going on. 11/13/2018 CPSC503 Spring 2004

Two Philosophies Let the syntax do what syntax does well and don’t expect it to know much about meaning In this approach, the lexical entry’s semantic attachments do the work Assume the syntax does know about meaning Here the grammar gets complicated and the lexicon simpler 11/13/2018 CPSC503 Spring 2004

Example Consider the attachments for the VPs VP -> Verb NP NP rule (gave Mary a book) VP -> Verb NP PP (gave a book to Mary) Assume the meaning representations should be the same for both. Under the lexicon-heavy scheme the attachments are: VP.Sem(NP.Sem, NP.Sem) VP.Sem(NP.Sem, PP.Sem) 11/13/2018 CPSC503 Spring 2004

Example Under the syntax-heavy scheme we might want to do something like VP -> V NP NP V.sem ^ Recip(NP1.sem) ^ Object(NP2.sem) VP -> V NP PP V.Sem ^ Recip(PP.Sem) ^ Object(NP1.sem) I.e the verb only contributes the predicate, the grammar “knows” the roles. 11/13/2018 CPSC503 Spring 2004

Constructional Approach So we’ll allow both VP → V NP {V.sem(NP.sem)} and VP → Kick-Verb the bucket {λ x Die(x)} 11/13/2018 CPSC503 Spring 2004

Semantic Grammars One problem with traditional grammars is that they don’t necessarily reflect the semantics in a straightforward way You can deal with this by… Fighting with the grammar Complex lambdas and complex terms, etc Rewriting the grammar to reflect the semantics And in the process give up on some syntactic niceties (1) [suggestion] <- [suggest-time] (2) [suggest-time] <- how about [time] (3) [time] <- [point] (4) [point] <- *on[dayofweek]*[timeofday] (5) [dayofweek] <- Tuesday … (6) [timeofday] <- afternoon … * Means optional 11/13/2018 CPSC503 Spring 2004

BERP Example 11/13/2018 CPSC503 Spring 2004

BERP Example How about a rule like the following… Request → I want to go to eat FoodType Time { some attachment } 11/13/2018 CPSC503 Spring 2004

Semantic Grammar The term semantic grammar refers to the motivation for the grammar rules The technology (plain CFG rules with a set of terminals) is the same as we’ve been using The good thing about them is that you get exactly the semantic rules you need The bad thing is that you need to develop a new grammar for each new domain 11/13/2018 CPSC503 Spring 2004

Semantic Grammars Typically used in conversational agents in constrained domains Limited vocabulary Limited grammatical complexity Chart parsing (Earley) can often produce all that’s needed for semantic interpretation even in the face of ungrammatical input. 11/13/2018 CPSC503 Spring 2004