1 Natural Language Processing Chapter 6. 344-471 AI & ESChapter 6 NLP 2 NLP Language translation / multilingual translation Language understanding Figure.

Slides:



Advertisements
Similar presentations
Computational language: week 10 Lexical Knowledge Representation concluded Syntax-based computational language Sentence structure: syntax Context free.
Advertisements

Natural Language Processing Lecture 2: Semantics.
CSA2050: DCG I1 CSA2050 Introduction to Computational Linguistics Lecture 8 Definite Clause Grammars.
C O N T E X T - F R E E LANGUAGES ( use a grammar to describe a language) 1.
LING NLP 1 Introduction to Computational Linguistics Martha Palmer April 19, 2006.
For Monday Read Chapter 23, sections 3-4 Homework –Chapter 23, exercises 1, 6, 14, 19 –Do them in order. Do NOT read ahead.
1 Words and the Lexicon September 10th 2009 Lecture #3.
NLP and Speech Course Review. Morphological Analyzer Lexicon Part-of-Speech (POS) Tagging Grammar Rules Parser thethe – determiner Det NP → Det.
1 Pertemuan 22 Natural Language Processing Syntactic Processing Matakuliah: T0264/Intelijensia Semu Tahun: Juli 2006 Versi: 2/2.
Chapter 3 Program translation1 Chapt. 3 Language Translation Syntax and Semantics Translation phases Formal translation models.
PSY 369: Psycholinguistics Some basic linguistic theory part3.
Artificial Intelligence 2004 Natural Language Processing - Syntax and Parsing - Language Syntax Parsing.
Chapter 3: Formal Translation Models
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.
CSC 8310 Programming Languages Meeting 2 September 2/3, 2014.
Lecture 1, 7/21/2005Natural Language Processing1 CS60057 Speech &Natural Language Processing Autumn 2005 Lecture 1 21 July 2005.
February 2009Introduction to Semantics1 Logic, Representation and Inference Introduction to Semantics What is semantics for? Role of FOL Montague Approach.
Natural Language Processing Chapter Artificial IntelligenceChapter 42 NLP Language translation / multilingual translation Language understanding.
2.2 A Simple Syntax-Directed Translator Syntax-Directed Translation 2.4 Parsing 2.5 A Translator for Simple Expressions 2.6 Lexical Analysis.
9/8/20151 Natural Language Processing Lecture Notes 1.
Syntax & Semantic Introduction Organization of Language Description Abstract Syntax Formal Syntax The Way of Writing Grammars Formal Semantic.
CCSB354 ARTIFICIAL INTELLIGENCE (AI)
Lecture 12: 22/6/1435 Natural language processing Lecturer/ Kawther Abas 363CS – Artificial Intelligence.
Introduction to Python
For Friday Finish chapter 23 Homework: –Chapter 22, exercise 9.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
Chapter 10: Compilers and Language Translation Invitation to Computer Science, Java Version, Third Edition.
CS : Language Technology for the Web/Natural Language Processing Pushpak Bhattacharyya CSE Dept., IIT Bombay Constituent Parsing and Algorithms (with.
Chapter 15 Natural Language Processing (cont)
Natural Language Processing Artificial Intelligence CMSC February 28, 2002.
CS 153: Concepts of Compiler Design October 5 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
Introduction to C Programming Chapter 2 : Data Input, Processing and Output.
Chapter 2 Syntax and meaning of Prolog Programs LP and Prolog Chapter 22 PROLOG domains variable name = type predicates relation(variable name,
Natural Language Processing
Chapter 7 Turbo Prolog Chapter 7 Turbo Prolog Artificial Intelligence ดร. วิภาดา เวทย์ประสิทธิ์ ภาควิชาวิทยาการคอมพิวเตอร์ คณะ วิทยาศาสตร์ มหาวิทยาลัยสงขลานครินทร์
CSA2050 Introduction to Computational Linguistics Lecture 1 Overview.
CPS 506 Comparative Programming Languages Syntax Specification.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Rules, Movement, Ambiguity
Chapter 3 Describing Syntax and Semantics
The Functions and Purposes of Translators Syntax (& Semantic) Analysis.
CSE573 Autumn /23/98 Natural Language Processing Administrative –PS3 due today –PS4 out Wednesday, due Friday 3/13 (last day of class) special.
For Friday Finish chapter 23 Homework –Chapter 23, exercise 15.
Compiler Construction By: Muhammad Nadeem Edited By: M. Bilal Qureshi.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
Programming Fundamentals. Summary of previous lectures Programming Language Phases of C++ Environment Variables and Data Types.
CPSC 422, Lecture 27Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 27 Nov, 16, 2015.
Natural Language Processing Slides adapted from Pedro Domingos
Parsing and Code Generation Set 24. Parser Construction Most of the work involved in constructing a parser is carried out automatically by a program,
Compiler Construction CPCS302 Dr. Manal Abdulaziz.
NATURAL LANGUAGE PROCESSING
Overview of Compilation Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Principles Lecture 2.
Languages and Strings Chapter 2. (1) Lexical analysis: Scan the program and break it up into variable names, numbers, etc. (2) Parsing: Create a tree.
CC410: System Programming Dr. Manal Helal – Fall 2014 – Lecture 12–Compilers.
10/31/00 1 Introduction to Cognitive Science Linguistics Component Topic: Formal Grammars: Generating and Parsing Lecturer: Dr Bodomo.
Programming Languages Translator
Basic Parsing with Context Free Grammars Chapter 13
Natural Language Processing (NLP)
Method of Language Definition
Natural Language - General
Lecture 4: Lexical Analysis & Chomsky Hierarchy
Natural Language Processing
Chapter 1 c++ structure C++ Input / Output
Artificial Intelligence 2004 Speech & Natural Language Processing
Language translation Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections
Faculty of Computer Science and Information System
Presentation transcript:

1 Natural Language Processing Chapter 6

AI & ESChapter 6 NLP 2 NLP Language translation / multilingual translation Language understanding Figure 14.5 p. 365 Interaction among component Figure 14.6 p. 366 A speech Waveform

AI & ESChapter 6 NLP 3 NLP Problems Figure 15.1 P. 378 English sentences are incomplete descriptions of the information that are intended to convey. The same expression means different things in different context. No natural language program can be complete because of new words, expression, and meaning can be generated quite freely. There are lots of ways to say the same thing.

AI & ESChapter 6 NLP 4 NLP Problems 1) Processing written text using lexical, syntactic, and semantic knowledge of the language require the real world information 2) Processing spoken language using all information needed above plus additional knowledge about phonology handle ambiguities in speech

AI & ESChapter 6 NLP 5 Step in NLP 1) Morphological Analysis 2) Syntactic Analysis 3) Semantic Analysis 4) Discourse Integration 5) Pragmatic Analysis boundaries between these five phrases are often fuzzy.

AI & ESChapter 6 NLP 6 1. Morphological Analysis Individual words are analyzed into components Nonword tokens such as punctuation are separated from the words I want to print Bill ’ s.int file. proper noun possessive suffix file extension

AI & ESChapter 6 NLP 7 2. Syntactic Analysis linear sequence of words are transformed into structures show how words relate to each other English syntactic analyzer If do not pass the syntactic analyzer  reject e.g. (Boy the go to store the)

AI & ESChapter 6 NLP 8 Example of syntactic analysis Figure 15.2 p. 382  RM2, RM5, RM5 A knowledge base Fragment Figure 15.3 p. 383 User073, F1, Printing, File_Structure, Waiting Mental Event/ Physical Event Animate/Event Partial meaning for a sentence Figure 15.4 p Syntactic Analysis

AI & ESChapter 6 NLP 9 Syntax

AI & ESChapter 6 NLP 10 Parse Tree

AI & ESChapter 6 NLP 11 Apply rule

AI & ESChapter 6 NLP Semantic Analysis the structures created by the syntactic analyzer are assign meanings mapping between the syntactic structure and objects in the task domain If no mapping  reject (colorless green ideas sleep furiously) 1) It must map individual words into appropriate objects in the knowledge base or database. 2) It must create the correct structures to correspond to the meanings of the individual words combine with each other.

AI & ESChapter 6 NLP Discourse Integration the meaning of the individual sentence may depend on the sentences that precede it and may influence the meanings of the sentences that follow it. (Ex. John want it.)  “ It ” depends on the previous sentence. Current user who type word “ I ” is User068 = Susan_Black We get F1 with filename in /wsmith/ directory

AI & ESChapter 6 NLP Pragmatic Analysis The structure representing what was said is reinterpreted to determine what was actually meant. (Ex. Do you know what time it is?)  we should understand what to do.... Understand to decide what to do as a result Representing the intended meaning Figure 15.5 P. 385

AI & ESChapter 6 NLP 15 Internal Representative

AI & ESChapter 6 NLP 16 Syntactic Processing (2) Grammar  declarative representation  syntactic facts about the language Figure 15.6 p.387 Parser  procedure  compares the grammar against input sentences to produce parsed structure. Figure 15.7 p.388 A parse tree for a sentence

AI & ESChapter 6 NLP 17 Top-down Parsing Begin with start symbol and apply the grammar rules forward until the symbols at the terminals of the tree correspond to the components of the sentence being parsed. Bottom-up Parsing Begin with the sentence to be parsed and apply the grammar rules backward until a single tree whose terminals are the words of the sentence and whose top node is the start symbol has been produced. Syntactic Processing

AI & ESChapter 6 NLP 18 Transition Network

AI & ESChapter 6 NLP 19 ATN : Augmented Transition Network similar to finite state machine Figure 15.8 p.392 An ATN network Figure 15.9 p.3923An ATN Grammar in List Form sentence  “ The long file has printed. ” S  NP  Q1  AUX  Q3  V  Q4 (F) halt NP  Det  Q6  Adj  Q6  N  Q7 (F) (S DCL (NP (FILE (LONG) DEFINITE)) HAS (VP PRINTED))

AI & ESChapter 6 NLP 20 Unification Grammar DAGs : Direct Acyclic Graph the graph corresponding to “ the ” and “ file ” are [CAT: DET[CAT: N [NP [DET: N LEX:the]LEX : file HEAD: file NUMBER: SING] NUMBER: SING]]

AI & ESChapter 6 NLP 21 Semantic Processing (3) Step 1. Lexicon  look up the individual words in a dictionary and extract their meaning. Step 2 Lexicon disambiguity or Word sense disambiguity words may have more than one meaning e.g. bank ( ธนาคาร หรือ ตลิ่ง ), diamond p.398 ( เพชร หรือ รูปเหลี่ยม ) use semantic marker  PHYSICAL OBJECT, ANIMATE OBJECT, ABSTRACT OBJECT e.g. I drop my diamond...

AI & ESChapter 6 NLP 22 Semantic Processing (3) use semantic marker PHYSICAL OBJECT ANIMATE OBJECT ABSTRACT OBJECT e.g. I drop my diamond... note that “ My lawn hates the cold ” is a correct semantic as well, although lawn can not act the verb hate..... but this sentence can be use in the good English sense.

AI & ESChapter 6 NLP 23 Sentence Level Processing (3) 1) Semantic grammars 2) Case grammars 3) Conceptual parsing 4) Approximately compositional semantic interpretation

AI & ESChapter 6 NLP 24 1) Semantic grammars - semantic action associate with the grammar rule - Figure p. 401 e.g. “ I want to ”  ACTION - Figure p. 402 Parsing Result with semantic grammars Sentence Level Processing (3)

AI & ESChapter 6 NLP 25 2) Case grammars : passing process driven from the sentence ’ s main verb. - Figure p. 404 Active and passive sentence : Susan printed a file. = The file was printed by Susan. - Figure p. 404 Similar sentence : Mother baked for three hours. = The pie baked for three hours. - Word case p. 405 : (A) Agent, (I) Instrument, (F) Factitive, (L) Locatives, (S) Source, (G) Goal, (B) Beneficiary, (T) Time, (O) Object Sentence Level Processing (3)

AI & ESChapter 6 NLP 26 2) Case grammars - Figure p. 406 Some verb case frames : open [_ _ O (I) (A)] A : Instigator of the action D : Entity effect by the action : die [_ _ D] John die. : kill [_ _ D (I) (A)] Bill killed John. Bill killed John with a knife. : want [_ _A O] John wanted some ice cream. John wanted Marry to go to store. Sentence Level Processing (3)

AI & ESChapter 6 NLP 27 3) Conceptual parsing strategy for finding both the structure and the meaning of the sentence in one step. use verb-ACT dictionary Figure p. 407 e.g. “want” 1) stative (wanting something to happen) 2) transitive ATRANS (wanting an object) 3) intransitive PTRANS (wanting a person) Sentence Level Processing (3)

AI & ESChapter 6 NLP 28 3) Conceptual parsing CD : Conceptual Dependency structure : passing process driven from the sentence’s main verb with more details in the lower level. Figure p. 407 “John wanted Mary to go to the store.” (PTRANS) Sentence Level Processing (3)

AI & ESChapter 6 NLP 29 4) Approximately compositional semantic interpretation - Semantic interpretation rules Figure p Combining Mapping Knowledge Figure p. 412 wanting : agent : (animate), object : (state or event) Sentence Level Processing (3)

AI & ESChapter 6 NLP 30 Discourse (4) and Pragmatic Processing (5) use to understand a single sentence. p. 415 – 416 Relationship between discourse contexts Names of individuals Dave went to the movie. Parts of actions. 1) John went on a business trip to New York. 2) He left on an early morning flight. Causal chains.... Planning sequences....

AI & ESChapter 6 NLP 31 knowledge to focus the current focus on dialogue a model of each participant’s current beliefs the rule of conversation shared by all participants Modeling Individual beliefs p.419 Model logic : Three belief spaces Figure p.420 temporal logics allow to talk about the truth of the set of proposition at current state of the real world, in the past, and in the future as well. conditional logic allow to talk about the truth or falsehood under some circumstances Discourse (4) and Pragmatic Processing (5)

32 Turbo Prolog

AI & ESChapter 6 NLP 33 ftp:// /older/DosProgram/TPROLOG Alt + Enter = Big Screen F1 : Help F2 : Save F3 : Load F6 : Next/Switch F8 : Previous Goal F9 : Compile F10 : Step (For trace) / End Alt + T : Trace ON/OFF Set up  window size  edit Use arrow key to adjust the size TURBO PROLOG

AI & ESChapter 6 NLP 34 Use the example from the EXAMPLE directory to try to program. Start with EX03EX01.PRO predicates likes(symbol,symbol) clauses likes(ellen, tennis). likes(john, football). likes(tom, baseball). likes(eric, swimming) likes(mark, tennis). likes(bill, Activity) if likes(tom, Activity). likes(mark, Activity) :- likes(ellen, Activity). TURBO PROLOG FACTS RULES

AI & ESChapter 6 NLP 35 ARITHMETIC Arithmetic operators: +, -, *, /, mod, div Relational operators: >, =,, >< Functions: sin, cos, tan, arctan, ln, log, exp, sqrt, round, trunc, abs EX: = 2 + 1, X = 5/2, X = 5 mod 2, 5 <> 9 PROLOG.HELP

AI & ESChapter 6 NLP 36 char1 byte characters integer2 byte integer numbers real8 byte floating point numbers symbolstrings inserted in the internal symbol table stringsequences of chars "hello world\n" PREDEFINED DOMAINS

AI & ESChapter 6 NLP 37 CONSTANTS const1 = definition const2 = definition [GLOBAL] DOMAINS dom [,dom] = [reference] declaration1; declaration2 listdom = dom* dom = [GLOBAL] DATABASE [ - ] [determ] pred1(....) pred2(.....) GLOBAL PREDICATES [determ|nondeterm] pred1( ) -(i,i,o,..)(i,o,i,..) [ language c|pascal|fortran ] [ as "name" ] pred2( ) PREDICATES [determ|nondeterm] pred1( ) pred2( ) CLAUSES p(....):-p1(...), p2(.....),.... include "filename" Include a file during compilation. SUMMARY OF PROGRAM SECTIONS

AI & ESChapter 6 NLP 38 random(RealVariable) (real) - (o) random(MaxValue,RandomInt) (integer,integer) - (i,o) sound(Duration,Frequency) (integer,integer) - (i,i) beep date(Year,Month,Day) (integer,integer,integer) - (o,o,o) (i,i,i) time(Hours,Minutes,Seconds,Hundredths) (integer,integer,integer,integer) - (o,o,o,o) (i,i,i,i) trace(on/off) (string) - (i) (o) MISCELLANEOUS

AI & ESChapter 6 NLP 39 trap (PredicateCall,ExitCode,Predicate ToCallOnError) exit exit (ExitCode) (integer) - (i) if exit to DOS then the DOS errorlevel task processing variable will contain the value given to the exit predicate. break (on/off) (string) - (i) (o) ERROR & BREAK CONTROL

AI & ESChapter 6 NLP 40 display(String) (string) - (i) edit(InputString,OutputString) (string,string) - (i,o) edit(InputString,OutputString,Headstr,Headstr2,Ms g,Pos,Helpfilename, EditMode,Indent,Insert,TextMode,RetPos,RetStatu s) (string,string,string,string,string,integer,str ing,integer,integer,integer,integer,integer,int eger) - (i,o,i,i,i,i,i,i,i,i,i,o,o) If the user saves the text from the editor, HeadStr2 will be used as the file name. editmsg(InputString,OutputString,Headstr,Headstr2,Msg,Pos,Helpfilename,RetStatus) (string,string,string,string,string,integer,str ing,integer)- (i,o,i,i,i,i,i,o) EDITOR

AI & ESChapter 6 NLP 41 makewindow(WindowNo,ScrAtt,FrameAtt,Framestr,Ro w,Column,Height,Width) (integer,integer,integer,string,integer,integ er,integer,integer) shiftwindow(WindowNo) (integer) - (i) (o) gotowindow(WindowNo) (integer) - (i) resizewindow(StartRow,NoOfRows,StartCol,NoOfCol s) (integer,integer,integer,integer) - (i,i,i,i) colorsetup(Main_Frame) (integer) - (i) WINDOW SYSTEM

AI & ESChapter 6 NLP 42 readln(StringVariable) (string) - (o) readint(IntgVariable) (integer) - (o) readreal(RealVariable) (real) - (o) readchar(CharVariable) (char) - (o) keypressed unreadchar(CharToBePushedBack) (Char) - (i) readterm( Domain, Variable ) (DomainName,Domain) - (i,_) INPUT

AI & ESChapter 6 NLP 43 write( Variable|Constant * ) nl writef( FormatString, Variable|Constant* ) In the format string the following options are known after a percentage sign: %d Normal decimal number. (chars and integers) %u As an unsigned integer. (chars and integers) %R As a database reference number. (database reference numbers) %X As a long hexadecimal number. (strings, database reference numb). %x As a hexadecimal number. (chars and integers). %s Strings. (symbols and strings). %c As a char. (chars and integers). %g Reals in shortest posible format (default for reals) %e Reals in exponetial notation %f Reals in fixed notation %lf Only for C compatibility (fixed reals) \n - newline \t - tabulator \nnn - character with code nnn OUTPUT

AI & ESChapter 6 NLP 44 The End