LING 438/538 Computational Linguistics Sandiway Fong Lecture 22: 11/15.

Slides:



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

Chapter Chapter Summary Languages and Grammars Finite-State Machines with Output Finite-State Machines with No Output Language Recognition Turing.
LING 388: Language and Computers Sandiway Fong Lecture 16: 10/20.
LING 388: Language and Computers Sandiway Fong Lecture 9: 9/22.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/12.
LING 388: Language and Computers Sandiway Fong Lecture 15: 10/17.
LING 388 Language and Computers Lecture 14 10/16/03 Sandiway FONG.
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 388: Language and Computers Sandiway Fong Lecture 20: 11/2.
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.
A basis for computer theory and A means of specifying languages
LING 438/538 Computational Linguistics Sandiway Fong Lecture 23: 11/20.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 6: 9/7.
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 Sandiway Fong Lecture 17: 10/25.
1 CONTEXT-FREE GRAMMARS. NLE 2 Syntactic analysis (Parsing) S NPVP ATNNSVBD NP AT NNthechildrenate thecake.
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 364: Introduction to Formal Semantics Lecture 5 January 26th.
LING 388: Language and Computers Sandiway Fong Lecture 13: 10/10.
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 388: Language and Computers Sandiway Fong Lecture 8.
LING 388: Language and Computers Sandiway Fong 10/4 Lecture 12.
11 CS 388: Natural Language Processing: Syntactic Parsing Raymond J. Mooney University of Texas at Austin.
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1.
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.
Computing Science, University of Aberdeen1 CS4025: Grammars l Grammars for English l Features l Definite Clause Grammars See J&M Chapter 9 in 1 st ed,
Logic Programming Lecture 6: Parsing, Difference Lists and Definite Clause Grammars.
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.
LING 388: Language and Computers Sandiway Fong Lecture 7.
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.
LING 388: Language and Computers Sandiway Fong Lecture 15 10/13.
LING 388: Language and Computers Sandiway Fong Lecture 30 12/8.
LING 388: Language and Computers Sandiway Fong Lecture 18.
LING 388: Language and Computers Sandiway Fong Lecture 26 11/22.
LING 388: Language and Computers Sandiway Fong Lecture 10.
LING 388: Language and Computers Sandiway Fong Lecture 19.
Context Free Grammars Reading: Chap 9, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Rada Mihalcea.
LING/C SC/PSYC 438/538 Lecture 26 Sandiway Fong. Administrivia 538 Presentations – Send me your choices if you haven’t already Thanksgiving Holiday –
Syntax Why is the structure of language (syntax) important? How do we represent syntax? What does an example grammar for English look like? What strategies.
November 2011CLINT-LN CFG1 Computational Linguistics Introduction Context Free Grammars.
LING 388: Language and Computers Sandiway Fong Lecture 12.
LING 388: Language and Computers Sandiway Fong Lecture 11: 10/4.
Rules, Movement, Ambiguity
CSA2050 Introduction to Computational Linguistics Parsing I.
LING 388: Language and Computers Sandiway Fong Lecture 21.
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.
1 Introduction to Computational Linguistics Eleni Miltsakaki AUTH Fall 2005-Lecture 3.
1 Some English Constructions Transformational Framework October 2, 2012 Lecture 7.
LING 388: Language and Computers Sandiway Fong Lecture 20.
Logic Programming Lecture 6: Parsing and Definite Clause Grammars.
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1.
Chapter 3 – Describing Syntax CSCE 343. Syntax vs. Semantics Syntax: The form or structure of the expressions, statements, and program units. Semantics:
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,[]).
Natural Language Processing Vasile Rus
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 24 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 25 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 26 Sandiway Fong.
Presentation transcript:

LING 438/538 Computational Linguistics Sandiway Fong Lecture 22: 11/15

Context-free Grammars back to DCGs next homework: –write a phrase structure grammar for a fragment of English Textbook: –Phrase structure grammars are covered in Chapter 9

Recall: Chomsky Hierarchy Regular Grammars FSA Regular Expressions DCG = Type-0 Type-3 Type-2 = Context-free Type-1 = Context-sensitive from lecture5

Definite Clause Grammars Basic Technology already covered earlier in the course See: –Lecture 5: Basic definition of a DCG –Lecture 6: Left and right recursion. Prolog’s Computation Rule –Lecture 7: Adding an extra argument to non-terminals to generate a parse tree for grammatical sentences –Lecture 9: Adding extra arguments to non-terminals to enforce agreement between constituents

Introduction to Context-free grammars Basically (in DCG format): –LHS --> RHS. –LHS = single non-terminal –RHS = a sequence of zero or more terminal or non- terminals (possibly mixed) –non-terminals may contain extra arguments, e.g. np(NP,Case,Number,Person)

Exercise Let’s write a context-free grammar that returns parse trees for simple active/passive sentence pairs such as: –John hit a ball/John ate a sandwich –*John hit/John ate –*hit a ball/*ate a sandwich –the ball was hit/the sandwich was eaten –the ball was hit by John/the sandwich was eaten by John Let’s introduce traces in the case of passives: –[ S [ NP the ball] [ VP [aux was ][ VP [ V hit] [ NP trace]]]] –[ S [ NP the ball] [ VP [ VP [aux was ][ VP [ V hit] [ NP trace]]][ PP [ P by][ NP John]]]]

Grammar Note: –need to handle English passive morphology –passive be selects for a V-en Example –*was ate (simple past form) –was eaten (-en past participle form) Implementation: –use an extra argument to indicate the verb form –v(v(ate),past) --> [ate]. –v(v(eaten),pastparticiple) --> [eaten].

Grammar [Developed in class] s(s(NP,VP)) --> np(NP,notrace), vp(VP,_,_,notrace). np(np(Det,N),notrace) --> det(Det), common_noun(N). np(np(N),notrace) --> proper_noun(N). np(np(trace),trace) --> []. proper_noun(john) --> [john]. det(det(the)) --> [the]. det(det(a)) --> [a]. common_noun(n(ball)) --> [ball]. common_noun(n(sandwich)) --> [sandwich]. vp(vp(BE,VP),Form,selectsforvp,no trace) --> passive_be(BE,Form), vp(VP,pastparticiple,transitive,tr ace). vp(vp(V,NP),Form,transitive,EC) --> transitive(V,Form), np(NP,EC). vp(vp(V),Form,intransitive,notrace) --> intransitive(V,Form). vp(vp(VP,PP),Form,transitive,EC) - -> vp(VP,Form,transitive,EC), pp(PP).

Grammar passive_be(v(be),root) --> [be]. passive_be(v(is),thirdpersonpresen t) --> [is]. passive_be(v(was),past) --> [was]. intransitive(v(eat),root) --> [eat]. intransitive(v(eats),s) --> [eats]. intransitive(v(ate),past) --> [ate]. intransitive(v(eaten),pastparticiple) --> [eaten]. transitive(v(eat),root) --> [eat]. transitive(v(eats),s) --> [eats]. transitive(v(ate),past) --> [ate]. transitive(v(eaten),pastparticiple) -- > [eaten]. transitive(v(hit),root) --> [hit]. transitive(v(hits),s) --> [hits]. transitive(v(hit),past) --> [hit]. transitive(v(hit),pastparticiple) --> [hit]. pp(pp(P,NP)) --> p(P), np(NP,notrace). p(p(by)) --> [by].

Grammatical Sentences ?- s(X,[john,hit,the,ball],[]). X = s(np(john),vp(v(hit),np(det(the),n(ball)))) | ?- s(X,[john,ate,a,sandwich],[]). X = s(np(john),vp(v(ate),np(det(a),n(sandwich)))) | ?- s(X,[john,ate],[]). X = s(np(john),vp(v(ate))) | ?- s(X,[the,sandwich,was,eaten],[]). X = s(np(det(the),n(sandwich)),vp(v(was),vp(v(eaten),np(trace)))) | ?- s(X,[the,sandwich,was,eaten,by,john],[]). X = s(np(det(the),n(sandwich)),vp(v(was),vp(vp(v(eaten),np(trace)),pp(p( by),np(john)))))