UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Using Definite Knowledge: NLP and nl_interface.pl Notes for Ch.3 of Poole et.

Slides:



Advertisements
Similar presentations
CSA2050: DCG I1 CSA2050 Introduction to Computational Linguistics Lecture 8 Definite Clause Grammars.
Advertisements

DEFINITE CLAUSE GRAMMARS Ivan Bratko University of Ljubljana Faculty of Computer and Information Sc.
Grammars.
Chapter Chapter Summary Languages and Grammars Finite-State Machines with Output Finite-State Machines with No Output Language Recognition Turing.
For Monday Read Chapter 23, sections 3-4 Homework –Chapter 23, exercises 1, 6, 14, 19 –Do them in order. Do NOT read ahead.
Understanding Natural Language
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Ch.2: Syntax and Semantics Fall 2005.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.6 [P]: Reasoning Under Uncertainty Section.
NLP and Speech Course Review. Morphological Analyzer Lexicon Part-of-Speech (POS) Tagging Grammar Rules Parser thethe – determiner Det NP → Det.
CSE 3302 Programming Languages Chengkai Li, Weimin He Spring 2008 Syntax Lecture 2 - Syntax, Spring CSE3302 Programming Languages, UT-Arlington ©Chengkai.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.5 [P]: Propositions and Inference Sections.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Controlling Backtracking Notes for Ch.5 of Bratko For CSCE 580 Sp03 Marco Valtorta.
Language is very difficult to put into words. -- Voltaire What do we mean by “language”? A system used to convey meaning made up of arbitrary elements.
LING 388: Language and Computers Sandiway Fong Lecture 28: 12/6.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.12 [P]: Individuals and Relations Proofs.
Natural Language Processing AI - Weeks 19 & 20 Natural Language Processing Lee McCluskey, room 2/07
November 12, 2009Introduction to Cognitive Science Lecture 18: NLP & Expert Systems 1 Natural Language Processing For us humans, spoken language is the.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Using Definite Knowledge Notes for Ch.3 of Poole et al. CSCE 580 Marco Valtorta.
1 Understanding Natural Language The Natural Language Understanding Problem 14.1Deconstructing Language: A Symbolic Analysis 14.2Syntax 14.3Syntax.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering A Hole in Goal Trees Notes for: D.W. Loveland and M. Stickel. “A Hole in Goal.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Using Definite Knowledge Notes for Ch.3 of Poole et al. CSCE 580 Marco Valtorta.
Chapter 3: Formal Translation Models
Statistical Natural Language Processing Advanced AI - Part II Luc De Raedt University of Freiburg WS 2005/2006 Many slides taken from Helmut Schmid.
Specifying Languages CS 480/680 – Comparative Languages.
Natural Language Processing AI - Weeks 19 Natural Language Processing PART 2 Lee McCluskey, room 2/07
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.12 [P]: Individuals and Relations Datalog.
Grammars and Parsing. Sentence  Noun Verb Noun Noun  boys Noun  girls Noun  dogs Verb  like Verb  see Grammars Grammar: set of rules for generating.
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.
Elements of Computing Systems, Nisan & Schocken, MIT Press, 2005, Chapter 10: Compiler I: Syntax Analysis slide 1www.idc.ac.il/tecs.
Prolog and grammars Prolog’s execution strategy is useful for writing parsers for natural language (eg. English) and programming languages (interpreters.
9/8/20151 Natural Language Processing Lecture Notes 1.
Grammars.
Syntax & Semantic Introduction Organization of Language Description Abstract Syntax Formal Syntax The Way of Writing Grammars Formal Semantic.
CCSB354 ARTIFICIAL INTELLIGENCE (AI)
ICS611 Introduction to Compilers Set 1. What is a Compiler? A compiler is software (a program) that translates a high-level programming language to machine.
Introduction Syntax: form of a sentence (is it valid) Semantics: meaning of a sentence Valid: the frog writes neatly Invalid: swims quickly mathematics.
1 CS 385 Fall 2006 Chapter 14 Understanding Natural Language (omit 14.4)
For Friday Finish chapter 23 Homework: –Chapter 22, exercise 9.
Artificial intelligence project
THE BIG PICTURE Basic Assumptions Linguistics is the empirical science that studies language (or linguistic behavior) Linguistics proposes theories (models)
Abstract Question answering is an important task of natural language processing. Unification-based grammars have emerged as formalisms for reasoning about.
Understanding Natural Language
Natural Language Processing Artificial Intelligence CMSC February 28, 2002.
Context Free Grammars Reading: Chap 9, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Rada Mihalcea.
Computing Science, University of Aberdeen1 CS4025: Logic-Based Semantics l Compositionality in practice l Producing logic-based meaning representations.
Artificial Intelligence: Natural Language
October 2005CSA3180 NLP1 CSA3180 Natural Language Processing Introduction and Course Overview.
Artificial Intelligence: Natural Language
1 Context Free Grammars October Syntactic Grammaticality Doesn’t depend on Having heard the sentence before The sentence being true –I saw a unicorn.
Syntax The Structure of a Language. Lexical Structure The structure of the tokens of a programming language The scanner takes a sequence of characters.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
CPSC 422, Lecture 27Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 27 Nov, 16, 2015.
The Interpreter Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
Syntax-Directed Definitions and Attribute Evaluation Compiler Design Lecture (02/18/98) Computer Science Rensselaer Polytechnic.
1 An Introduction to Computational Linguistics Mohammad Bahrani.
1 CS Programming Languages Class 04 September 5, 2000.
NATURAL LANGUAGE PROCESSING
Composing Music with Grammars. grammar the whole system and structure of a language or of languages in general, usually taken as consisting of syntax.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Operational Semantics (Slides mainly.
Chapter 3 – Describing Syntax CSCE 343. Syntax vs. Semantics Syntax: The form or structure of the expressions, statements, and program units. Semantics:
LECTURE 10 Semantic Analysis. REVIEW So far, we’ve covered the following: Compilation methods: compilation vs. interpretation. The overall compilation.
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.
Natural Language Processing Vasile Rus
Fundamentals of Programming II Recursive Processing of Languages
Programming Language Syntax 7
CSCE 330 Programming Language Structures Ch.2: Syntax and Semantics
Artificial Intelligence 2004 Speech & Natural Language Processing
Representations & Reasoning Systems (RRS) (2.2)
Presentation transcript:

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Using Definite Knowledge: NLP and nl_interface.pl Notes for Ch.3 of Poole et al. CSCE 580 Marco Valtorta

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Natural Language Processing (NLP) with Definite Clause Logic nl_interface.pl Computational Linguistics is a big field Three reasons to study NLP –Ease of communication with people (infobot) –Lots of information stored in NL –Many problems in AI arise in NL

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Syntax, Semantics, Pragmatics Imagine finding these sentences at the beginning of the textbook: –This book is about computational intelligence. –Green frogs sleep soundly. –Colorless green ideas sleep furiously. Noam Chomsky –Time flies like green bananas. Robert Oakman –Sleep ideas green furiously colorless.

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Rules and Lists for NL A context-free production rule: –sentence -> noun_phrase, verb_phrase A corresponding definite clause: –sentence(S) <- noun_phrase(N), verb_phrase(V), append(N,V,S). –Sentences and phrases are represented as lists, e.g.: Noun_phrase([computer]).

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Definite Clause Grammars We may do away with explicit appends by using difference lists. –This leads to definite clause grammars. noun-phrase(T1,T2) is true if T1 – T2 is a noun phrase. E.g., –noun_phrase([the, computer, runs], [runs]). is true in the normal interpretation, since “the computer” is a noun phrase.

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Examples sentence  noun_phrase, verb_phrase sentence(T0,T2)  noun-phrase(T0,T1) & verb_phrase(T1,T2). Read: “There is a sentence between T0 and T2 if there is a noun phrase between T0 and T1 and there is a noun phrase between T1 and T2.” This reading is consistent with the view of the second part of a difference list as a pointer to the end of the list.

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering More Examples h  a,b,[c,d],e,[f],g a, b, e, and g are nonterminal symbols: they get rewritten c, d, and g are terminal symbols. h(T0,T6)  a(T0,T6) & b(T1, [c,d|T3]) & e(T3,[f|T5]) & g(T5,T6).

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering More Examples noun-phrase(T0,T4)  det(T0,T1) & modifiers(T1,T2) & noun(T2,T3) & pp(T3,T4). –“A noun phrase is a determiner followed by modifiers followed by a noun followed by a prepositional phrase.” det(T,T). Empty list: determiner is optional! det([a|T],T). det([the|T],T).

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Building Parse Trees Use extra arguments. This is done with recursive descent parsers in CSCE 531, where the atoms correspond to Java methods. sentence(T0,T2,s(NP,VP))  noun_phrase(T0,T1,NP) & verb_phrase(T1,T2,VP). Parse trees do not adequately represent the deep structure of a sentence.

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Enforcing Constraints Parameters added to nonterminals enforce constraints cf. attribute grammars; these are contextual grammars! nl_numbera.pl is a grammar that enforces subject-verb number agreement. ?sentence([the, student, eats],[],Num,T) Num = singular, T = s(np(definite,[],student,nopp),vp(eat,nonp,nopp)).

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering NL Interface to a DB The query… ?noun_phrase([a, female, student, enrolled, in, a, computer,science,course]) …returns C = [course(X), dept(X,comp_science), enrolled(P,X), student(P), female(P)]. This is (almost) a Datalog query. See nl_interface.pl

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Limitations Assumptions of compositionality. Ambiguity of NL: need to deal with uncertainty.

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Canned Text Output A grammar rule can be used “backwards.” The “meaning” (parse tree) may be bound, while the sentence itself is a free variable. Example: trans.pl (Figure 3.7) with query… ?trans (scheduled(w92,cs422,clock(15,30), above(csci333)), T, []). …produces the answer T = [the, winter, 1992, session, of, the, advanced, artificial, intelligence, course, is, scheduled, at, 3, :, 30, pm, in, the, room, above, the, computer, science, department, office].