November 2008NL Semantics V1 Advanced Topics in NLP Semantics V NL Access to Databases Semantics of Questions and Answers Simple Interpreters for Questions.

Slides:



Advertisements
Similar presentations
Artificial Intelligence: Natural Language and Prolog
Advertisements

Prolog programming....Dr.Yasser Nada. Chapter 8 Parsing in Prolog Taif University Fall 2010 Dr. Yasser Ahmed nada prolog programming....Dr.Yasser Nada.
October 2004CSA4050: Semantics III1 CSA4050: Advanced Topics in NLP Semantics III Quantified Sentences.
Natural Language Processing Lecture 2: Semantics.
November 2008NLP1 Natural Language Processing Definite Clause Grammars.
CSA2050: DCG I1 CSA2050 Introduction to Computational Linguistics Lecture 8 Definite Clause Grammars.
CSA4050: Advanced Topics in NLP Semantics IV Partial Execution Proper Noun Adjective.
Semantics (Representing Meaning)
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Prolog COMP 112 #
Semantic Analysis Read J & M Chapter 15.. The Principle of Compositionality There’s an infinite number of possible sentences and an infinite number of.
April 2010CSA50061 Logic, Representation and Inference Simple Question Answering NL Access to Databases Semantics of Questions and Answers Simple Interpreters.
DEFINITE CLAUSE GRAMMARS Ivan Bratko University of Ljubljana Faculty of Computer and Information Sc.
C. Varela; Adapted w/permission from S. Haridi and P. Van Roy1 Declarative Computation Model Defining practical programming languages Carlos Varela RPI.
Parsing: Features & ATN & Prolog By
LING 364: Introduction to Formal Semantics Lecture 4 January 24th.
Natural Language Query Interface Mostafa Karkache & Bryce Wenninger.
LING 364: Introduction to Formal Semantics Lecture 13 February 23rd.
LING 364: Introduction to Formal Semantics Lecture 5 January 26th.
March 1, 2009 Dr. Muhammed Al-Mulhem 1 ICS 482 Natural Language Processing INTRODUCTION Muhammed Al-Mulhem March 1, 2009.
Statistical Natural Language Processing. What is NLP?  Natural Language Processing (NLP), or Computational Linguistics, is concerned with theoretical.
LING 388: Language and Computers Sandiway Fong Lecture 11.
February 2009Introduction to Semantics1 Logic, Representation and Inference Introduction to Semantics What is semantics for? Role of FOL Montague Approach.
October 2004csa4050: Semantics II1 CSA4050: Advanced Topics in NLP Semantics II The Lambda Calculus Semantic Representation Encoding in Prolog.
Syntax Directed Translation. Syntax directed translation Yacc can do a simple kind of syntax directed translation from an input sentence to C code We.
LING 388: Language and Computers Sandiway Fong Lecture 17.
October 2008csa3180: Setence Parsing Algorithms 1 1 CSA350: NLP Algorithms Sentence Parsing I The Parsing Problem Parsing as Search Top Down/Bottom Up.
For Friday Finish chapter 23 Homework: –Chapter 22, exercise 9.
LING 388: Language and Computers Sandiway Fong Lecture 7.
October 2004CSA4050 Advanced Techniques in NLP 1 CSA4050: Advanced Topics in NLP Semantics 6 Semantics of Questions and Assertions involving Quantification.
Learning to Transform Natural to Formal Language Presented by Ping Zhang Rohit J. Kate, Yuk Wah Wong, and Raymond J. Mooney.
November 2003CSA4050: Semantics I1 CSA4050: Advanced Topics in NLP Semantics I What is semantics for? Role of FOL Montague Approach.
Declarative vs Procedural Programming  Procedural programming requires that – the programmer tell the computer what to do. That is, how to get the output.
A Procedural Model of Language Understanding Terry Winograd in Schank and Colby, eds., Computer Models of Thought and Language, Freeman, 1973 발표자 : 소길자.
October 2004CSA4050: Semantics III1 CSA4050: Advanced Topics in NLP Semantics III Quantified Sentences.
Transition Network Grammars for Natural Language Analysis - W. A. Woods In-Su Yoon Pusan National University School of Electrical and Computer Engineering.
Computing Science, University of Aberdeen1 CS4025: Logic-Based Semantics l Compositionality in practice l Producing logic-based meaning representations.
October 2005CSA3180 NLP1 CSA3180 Natural Language Processing Introduction and Course Overview.
CSA2050 Introduction to Computational Linguistics Lecture 1 Overview.
Semantic Construction lecture 2. Semantic Construction Is there a systematic way of constructing semantic representation from a sentence of English? This.
Grammars Grammars can get quite complex, but are essential. Syntax: the form of the text that is valid Semantics: the meaning of the form – Sometimes semantics.
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
CSA2050 Introduction to Computational Linguistics Parsing I.
For Monday Read chapter 26 Last Homework –Chapter 23, exercise 7.
November 2004csa3050: Sentence Parsing II1 CSA350: NLP Algorithms Sentence Parsing 2 Top Down Bottom-Up Left Corner BUP Implementation in Prolog.
Semantics Day 38 LING Computational Linguistics Harry Howard Tulane University.
Logical and Functional Programming
November 2006Semantics I1 Natural Language Processing Semantics I What is semantics for? Role of FOL Montague Approach.
Natural Language Processing Chapter 1 : Introduction.
Introduction to Prolog. Outline What is Prolog? Prolog basics Prolog Demo Syntax: –Atoms and Variables –Complex Terms –Facts & Queries –Rules Examples.
CSE573 Autumn /02/98 Natural Language Processing Administrative –PS4 support code now in the NT course area Truckworld interface (stop, start,
October 2004CSA3050 NLP Algorithms1 CSA3050: Natural Language Algorithms Morphological Parsing.
CSA3050: NLP Algorithms Sentence Grammar NLP Algorithms.
For Monday Read chapter 26 Homework: –Chapter 23, exercises 8 and 9.
October 2004csa4050: Semantics V1 CSA4050: Advanced Topics in NLP Semantics V NL Access to Databases Semantics of Questions and Answers Simple Interpreters.
Artificial Intelligence Knowledge Representation.
Context Free Grammars. Slide 1 Syntax Syntax = rules describing how words can connect to each other * that and after year last I saw you yesterday colorless.
1 Sections 3.1 – 3.2a Basic Syntax and Semantics Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Grammar Journeys Lesson 2 Kinds of Sentences
Natural Language Processing
CS : Speech, NLP and the Web/Topics in AI
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
LING 581: Advanced Computational Linguistics
Principles of Programming Languages
CSA4050: Advanced Topics in NLP
Natural Language Processing
CSA4050: Advanced Topics in NLP
Database SQL.
Presentation transcript:

November 2008NL Semantics V1 Advanced Topics in NLP Semantics V NL Access to Databases Semantics of Questions and Answers Simple Interpreters for Questions

November 2008NL Semantics V2 Access to Databases: 3 Approaches DB Query Language Form Interface Natural Language

November 2008NL Semantics V3 DB Query Language range of C is countries range of Cont is continents range of I is inclusions retrieve( Cont.name, count(C.name where C.name = I.inside and I.outside = Cont.name))

November 2008NL Semantics V4 Form Interface

November 2008NL Semantics V5 Natural Language How many countries are there in each continent?

November 2008NL Semantics V6 Issues Accessibility –Type of query language –What needs to be learned to make a query? –Data input vs. data output Flexibility –Can types of question be predicted? –Can types of question be easily changed? Expressivity –Limitations on kinds of information present –What types of query is possible

November 2008NL Semantics V7 Chat 80 Pereira and Warren (1983) General Architecture ENGLISH LOGICAL FORM PROLOG ANSWER Translation: what does the question mean Planning: how shall I answer it Execution: what is the answer?

November 2008NL Semantics V8 Different Types of Sentence Sentence TypeCommunicative Act Declarative SentenceAssertion Interrogative SentenceQuestion Imperative SentenceCommand

November 2008NL Semantics V9 Sentences and Assertions Assertions are usually expressed by declarative sentences. Our grammar/lexicon deals with very simple examples, e.g. John saw Fido More complex declarative sentences include All candidates for CSA4050 failed. Candidates who fail more than four credits shall not be allowed to take resits.

November 2008NL Semantics V10 Sentences and Questions Questions are usually expressed by interrogative sentences. Our simple grammar/lexicon does not yet deal with interrogative sentences. To handle them we must modify the grammar Issue: how do we recognise interrogative sentences?

November 2008NL Semantics V11 Execution of Communicative Acts Assertions add information to the database. The meaning of a declarative sentence involves execution an appropriate assert operation Questions query information in the database. The meaning of an interrogative sentence involves execution of an appropriate query operation Commands identify actions to be carried out. Representation of communicative act is in addition to representation of content.

November 2008NL Semantics V12 Assertions and Questions: Semantic Representation SentenceRepresentation of Semantic Content Representation of Communicative Act John sees Fido see(john,fido)a1(see(john,fido)) Does John see Fido see(john,fido)q1(see(john,fido))

November 2008NL Semantics V13 Basic Processing process(Sent,Result) :- s(SEM,Sent,[]), interpret(SEM,Result). In other words: to process the sentence: Parse it to produce semantic representation SEM Interpret SEM and give back RESULT Next we must define the interpret predicate

November 2008NL Semantics V14 Defining the Interpreter interpret(a1(LF),Ans) :- deal_with_a1_type(Ans). interpret(q1(LF),Ans) :- deal_with_q1_type(Ans). interpret(x(LF),Ans) :- deal_with_x_type(Ans). etc.

November 2008NL Semantics V15 Very Basic Intepretation interpret(a1(SEM,ok)) :- asserta(SEM). In the case of an assertion, just assert it. interpret(q1(SEM,yes)) :- call(SEM), !. interpret(q1(SEM,no)). If it’s a yes-no question, see if it’s true

November 2008NL Semantics V16 Dealing with Syntax We now have a primitive interpretation mechanism in place. It remains to modify the grammar/lexicon to handle the syntax of these very simple questions. To begin with, we will limit ourselves to yes/no questions

November 2008NL Semantics V17 Yes/No Questions: Grammar Rules for S % Declarative sentence s --> np, vp. John sees Fido % interrogative sentence s --> aux, np, vp. does John see Fido ?

November 2008NL Semantics V18 S Rule with Arguments :- [process]. s(a1(S)) --> np(VP^S), vp(VP). s(q1(S)) --> aux, np(VP^S), vp(VP).

November 2008NL Semantics V19 Complete Grammar s(a1(S)) --> np(NP), vp(VP), { reduce{NP,VP,S)}. s(q1(S)) --> aux, np(NP), vp(VP), { reduce{NP,VP,S)}. np(NP) --> n(NP). np(NP) --> d(D), n(N), {reduce(D,N,NP)}. vp(VP) --> v(VP). vp(Z^P) --> v(V2), np(NP), {reduce(V2,Z,V1), reduce(NP,V1,P)}. % lexicon aux --> [does]. aux --> [did]. v(X^walk(X)) --> [walk]. v(X^walk(X)) --> [walked]. v(X^Y^chased(X,Y)) --> [chase]. v(X^Y^chased(X,Y)) --> [chased]. n(X^cat(X)) --> [cat]. n(VP^S) --> [suzie], {reduce(VP,suzie,S)}. n(VP^S) --> [felix], {reduce(VP,felix,S)}. d(RL^SL^some(X,R,S)) --> [a], {reduce(RL,X,R),reduce(SL,X,S) }.

November 2008NL Semantics V20 Demo ?- process([does,john,see,fido],Ans). Ans=no ?- process([john,sees,fido],Ans). Ans=ok ?- process([does,john,sees,fido],Ans). Ans=yes

November 2008NL Semantics V21 Improving the Interpreter dbq :- readLine(L), dbq1(L), !, dbq. dbq1([halt]) :- nl, write(bye), !, fail. dbq1(Sent) :- process(Sent,A).