LING/C SC/PSYC 438/538 Lecture 14 Sandiway Fong. Administrivia Midterm – This Wednesday – A bit like doing a homework in real time – Bring your laptop.

Slides:



Advertisements
Similar presentations
November 2008NLP1 Natural Language Processing Definite Clause Grammars.
Advertisements

LING 388: Language and Computers Sandiway Fong Lecture 5: 9/5.
LING 388: Language and Computers Sandiway Fong Lecture 24: 11/16.
LING 388: Language and Computers Sandiway Fong Lecture 16: 10/20.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 8: 9/29.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/12.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 10: 9/27.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 9: 9/21.
LING 388: Language and Computers Sandiway Fong Lecture 15: 10/17.
LING 388: Language and Computers Sandiway Fong Lecture 21: 11/7.
LING 388: Language and Computers Sandiway Fong Lecture 12: 10/5.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 8: 9/18.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/11.
LING 388 Language and Computers Lecture 8 9/25/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 28: 12/6.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 22: 11/15.
LING 388: Language and Computers Sandiway Fong Lecture 20: 11/2.
LING 364: Introduction to Formal Semantics Lecture 4 January 24th.
LING 388: Language and Computers Sandiway Fong Lecture 14: 10/13.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 9: 9/25.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 6: 9/6.
LING 388: Language and Computers Sandiway Fong Lecture 6: 9/13.
LING 388: Language and Computers Sandiway Fong Lecture 11: 10/3.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 6: 9/7.
LING 388 Language and Computers Lecture 10 10/2/03 Sandiway FONG.
LING 388 Language and Computers Take-Home Final Examination 12/9/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 28: 12/5.
LING 388 Language and Computers Lecture 18 10/30/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 17: 10/25.
LING 388: Language and Computers Sandiway Fong Lecture 16: 10/19.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 5: 9/5.
LING 388 Language and Computers Lecture 9 9/30/03 Sandiway FONG.
Chapter 3: Formal Translation Models
LING 388: Language and Computers Sandiway Fong Lecture 17: 10/24.
LING 388: Language and Computers Sandiway Fong Lecture 13: 10/10.
LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1.
LING 388 Language and Computers Lecture 12 10/9/03 Sandiway FONG.
LING 388 Language and Computers Lecture 6 9/18/03 Sandiway FONG.
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1.
1 Syntax and Semantics The Purpose of Syntax Problem of Describing Syntax Formal Methods of Describing Syntax Derivations and Parse Trees Sebesta Chapter.
LING 388: Language and Computers Sandiway Fong Lecture 14 10/11.
LING 388: Language and Computers Sandiway Fong Lecture 17.
ITEC 380 Organization of programming languages Lecture 2 – Grammar / Language capabilities.
LING 388: Language and Computers Sandiway Fong Lecture 7.
LING 388: Language and Computers Sandiway Fong Lecture 15 10/13.
LING 388: Language and Computers Sandiway Fong Lecture 30 12/8.
Winter 2007SEG2101 Chapter 71 Chapter 7 Introduction to Languages and Compiler.
LING 388: Language and Computers Sandiway Fong Lecture 18.
CS 461 – Sept. 19 Last word on finite automata… –Scanning tokens in a compiler –How do we implement a “state” ? Chapter 2 introduces the 2 nd model of.
LING/C SC/PSYC 438/538 Lecture 26 Sandiway Fong. Administrivia 538 Presentations – Send me your choices if you haven’t already Thanksgiving Holiday –
LING/C SC/PSYC 438/538 Lecture 12 10/4 Sandiway Fong.
LING 388: Language and Computers Sandiway Fong Lecture 11: 10/4.
CPS 506 Comparative Programming Languages Syntax Specification.
LING/C SC/PSYC 438/538 Lecture 13 Sandiway Fong. Administrivia Reading Homework – Chapter 3 of JM: Words and Transducers.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
LING/C SC/PSYC 438/538 Lecture 15 Sandiway Fong. Did you install SWI Prolog?
LING/C SC/PSYC 438/538 Lecture 20 Sandiway Fong 1.
LING 388: Language and Computers Sandiway Fong Lecture 16.
LING/C SC/PSYC 438/538 Lecture 18 Sandiway Fong. Adminstrivia Homework 7 out today – due Saturday by midnight.
CSC312 Automata Theory Lecture # 26 Chapter # 12 by Cohen Context Free Grammars.
LING/C SC/PSYC 438/538 Lecture 16 Sandiway Fong. SWI Prolog Grammar rules are translated when the program is loaded into Prolog rules. Solves the mystery.
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1.
CSE 311 Foundations of Computing I Lecture 19 Recursive Definitions: Context-Free Grammars and Languages Spring
LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong. Last Time Talked about: – 1. Declarative (logical) reading of grammar rules – 2. Prolog query: s(String,[]).
General Information on Context-free and Probabilistic Context-free Grammars İbrahim Hoça CENG784, Fall 2013.
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 22 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 26 Sandiway Fong.
Faculty of Computer Science and Information System
Presentation transcript:

LING/C SC/PSYC 438/538 Lecture 14 Sandiway Fong

Administrivia Midterm – This Wednesday – A bit like doing a homework in real time – Bring your laptop – Exam slides available at class time – Answer as many questions as you can and me your answers at 7pm – Tested on material covered up to and including today – If you are unable to attend class, you must make alternative arrangements with me Next week (2 nd half of the course begins) – Morphology: reading Chapter 3

Administrivia Guest Lectures – Dr. Jerry Ball, Army Research Lab, Mesa AZ – October 25 th and November 1 st – Abstract on next slide…

Administrivia A Pseudo-Deterministic Model of Human Language Processing with a Computational Implementation A cognitively plausible and functional model of human language processing (HLP) will be presented which combines an incremental, serial, pseudo-deterministic processing mechanism and a non- monotonic mechanism of context accommodation, with an interactive, probabilistic mechanism that uses all available information in parallel to select the best choice at each choice point. The results of processing are linguistic representations that combine structural and functional information that is largely consistent with the “Simpler Syntax” of Culicover & Jackendoff, as well as Huddleston & Pullum’s comprehensive grammar of English. The first lecture will focus on the theoretical underpinnings of the system of linguistic representation and the pseudo-deterministic processing mechanism. The second lecture will focus on the computational implementation and will go into more detail on the linguistic representations that are generated by the model. The second lecture will include a demo of the model. References Ball, J., Freiman, M., Rodgers, S. & Myers, C. (2010). Toward a Functional Model of Human Language Processing. Proceedings of the 32 nd Annual Meeting of the Cognitive Science Society. Culicover, P. (2009) Natural Language Syntax. Oxford. Culicover, P. & Jackendoff, J. (2005). Simpler Syntax. Oxford. Huddleston, R. & Pullum, G. (2002). The Cambridge Grammar of the English Language. Cambridge.

Extra Argument: Parse Tree Recovering a parse tree – when want Prolog to return more than just Yes/No answers – in case of Yes, we can compute a syntax tree representation of the parse – by adding an extra argument to nonterminals – applies to all grammar rules (not just regular grammars) Example sheeptalk again DCG (non-regular, context-free): s --> [b], [a], a, [!]. a --> [a]. (base case) a --> [a], a. (recursive case) s a! a a a a b

Extra Argument: Parse Tree Tree: Prolog data structure: – term – hierarchical – allows sequencing of arguments – functor(arg 1,..,arg n ) – each arg i could be another term or simple atom s a! a a a a b s(b,a,a(a,a(a)),!)

Extra Arguments: Parse Tree DCG – s --> [b],[a], a, [!]. – a --> [a]. (base case) – a --> [a], a. (right recursive case) base case –a --> [a]. –a(subtree) --> [a]. –a(a(a)) --> [a]. recursive case –a --> [a], a. –a(subtree) --> [a], a(subtree). –a(a(a,A)) --> [a], a(A). s a! a a a a b s(b,a,a(a,a(a)),!) Idea: for each nonterminal, add an argument to store its subtree

Extra Arguments: Parse Tree Prolog grammar – s --> [b], [a], a, [!]. – a --> [a]. (base case) – a --> [a], a. (right recursive case) base and recursive cases –a(a(a)) --> [a]. –a(a(a,A)) --> [a], a(A). start symbol case –s --> [b], [a], a, [!]. –s(tree) --> [b], a(subtree), [!]. –s(s(b,a,A,!) ) --> [b], [a], a(A), [!]. s a! a a a a b s(b,a,a(a,a(a)),!)

Extra Arguments: Parse Tree Prolog grammar – s --> [b], [a], a, [!]. – a --> [a]. (base case) – a --> [a], a. (right recursive case) Equivalent Prolog grammar computing a parse –s(s(b,a,A,!)) --> [b], [a], a(A), [!]. –a(a(a)) --> [a]. –a(a(a,A)) --> [a], a(A).

Extra Arguments: Agreement Idea: – We can also use an extra argument to impose constraints between constituents within a DCG rule – (in fact, we can have multiple extra arguments) Example: – English determiner-noun number agreement – Data: the man the men a man *a men – Lexical Features: man singular men plural

Extra Arguments: Agreement Context-Free Grammar of English: s(s(Y,Z)) --> np(Y), vp(Z). np(np(Y)) --> pronoun(Y). pronoun(i) --> [i]. pronoun(we) --> [we]. np(np(D,N)) --> det(D), common_noun(N). det(det(the)) --> [the]. det(det(a)) --> [a]. common_noun(n(ball)) --> [ball]. common_noun(n(man)) --> [man]. common_noun(n(men)) --> [men]. vp(vp(Y)) --> unergative(Y). vp(vp(Y,Z)) --> transitive(Y), np(Z). unergative(v(ran)) --> [ran]. transitive(v(hit)) --> [hit]. Example sentences – We ran – The men hit the ball – etc. – *A men hit a ball Example sentences – We ran – The men hit the ball – etc. – *A men hit a ball

Extra Arguments: Agreement Let’s test and modify this grammar in Prolog Test: ?- s(Tree,Sentence,[]). Sentence is a Prolog list to be supplied by user Tree a variable

Extra Arguments: Agreement Data: – the man/men – a man/*a men Grammar: (NP section) – np(np(Y)) --> pronoun(Y). – np(np(D,N)) --> det(D), common_noun(N,Number). – det(det(the)) --> [the]. – det(det(a)) --> [a]. – common_noun(n(ball),sg) --> [ball]. – common_noun(n(man),sg) --> [man]. – common_noun(n(men),pl) --> [men]. – pronoun(i) --> [i]. – pronoun(we) --> [we]. –Idea: specify singular ( sg ) and plural ( pl ) for common nouns using an extra argument Rules the can combine with singular or plural nouns a can combine only with singular nouns

Extra Arguments: Agreement Data: – the man/men – a man/*a men Grammar: (NP section) np(np(Y)) --> pronoun(Y). np(np(D,N)) --> det(D,Number), common_noun(N,Number). det(det(the),sg) --> [the]. det(det(the),pl) --> [the]. det(det(a),sg) --> [a]. common_noun(n(ball),sg) --> [ball]. common_noun(n(man),sg) --> [man]. common_noun(n(men),pl) --> [men]. pronoun(i) --> [i]. pronoun(we) --> [we]. –Idea: give determiners a number feature as well and make it agree with the noun Rules the can combine with singular or plural nouns a can combine only with singular nouns

Extra Arguments: Agreement Simplifying the grammar: det(det(the),sg) --> [the]. det(det(the),pl) --> [the]. det(det(a),sg) --> [a]. Grammar is ambiguous: – two rules for determiner the Agreement Rule (revisited): the can combine with singular or plural nouns i.e. the doesn’t care about the number of the noun DCG Rule: np(np(D,N)) --> det(D,Number), common_noun(N,Number). det(det(the),_) --> [the]. Note: _ is a variable used underscore character because we don’t care about the name of the variable

Extra Arguments: Agreement Note: Use of the extra argument for agreement here is basically “syntactic sugar” and lends no more extra expressive power to the grammar rule system i.e. we can enforce the agreement without the use of the extra argument at the cost of more rules Note: Use of the extra argument for agreement here is basically “syntactic sugar” and lends no more extra expressive power to the grammar rule system i.e. we can enforce the agreement without the use of the extra argument at the cost of more rules Instead of np(np(D,N)) --> det(D,Number), common_noun(N,Number). we could have written: np(np(D,N)) --> detsg(D), common_nounsg(N). np(np(D,N)) --> detpl(D), common_nounpl(N). detsg(det(a)) --> [a]. detsg(det(the)) --> [the]. detpl(det(the)) --> [the]. common_nounsg(n(ball)) --> [ball]. common_nounsg(n(man)) -->[man]. common_nounpl(n(men)) --> [men].

Extra Arguments: Expressive Power General Question: – Does the extra argument change the system? – i.e. does it offer the grammar more expressive power ? Answer: – Yes Example: – We can write an otherwise regular-looking DCG for the non-regular language L ab = { a n b n | n ≥ 1 } (which cannot be encoded by any regular grammar)

Extra Arguments: Expressive Power s(X) --> [a],b(a(X)). b(X) --> [a],b(a(X)). b(a(X)) --> [b],c(X). b(a(0)) --> [b]. c(a(X)) --> [b],c(X). c(a(0)) --> [b]. Query: ?- s(0,L,[]). s --> [a],b. b --> [a],b. b --> [b],c. b --> [b]. c --> [b],c. c --> [b].  a+b+a+b+ a regular grammar regular grammar + extra argument

Extra Arguments: Expressive Power Computation tree: – ?- s(0,[a,a,b,b],[]). – ?- b(a(0),[a,b,b],[]). – ?- b(a(a(0)),[b,b],[]). – ?- c(a(0),[b],[]). – Yes s(X) --> [a],b(a(X)). b(X) --> [a],b(a(X)). b(a(X)) --> [b],c(X). b(a(0)) --> [b]. c(a(X)) --> [b],c(X). c(a(0)) --> [b].