LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1.

Slides:



Advertisements
Similar presentations
LING 388: Language and Computers
Advertisements

Computational language: week 10 Lexical Knowledge Representation concluded Syntax-based computational language Sentence structure: syntax Context free.
Syntactic analysis using Context Free Grammars. Analysis of language Morphological analysis – Chairs, Part Of Speech (POS) tagging – The/DT man/NN left/VBD.
LING 388: Language and Computers Sandiway Fong Lecture 2.
Statistical NLP: Lecture 3
Natural Language Processing DCG and Syntax NLP DCG A “translation” example: special case A DCG recogniser.
LING 388: Language and Computers Sandiway Fong Lecture 16: 10/20.
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 388: Language and Computers Sandiway Fong Lecture 15: 10/17.
LING 388: Language and Computers Sandiway Fong Lecture 21: 11/7.
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 438/538 Computational Linguistics Sandiway Fong Lecture 22: 11/15.
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 388 Language and Computers Take-Home Final Examination 12/9/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 388 Language and Computers Lecture 13 10/14/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 17: 10/24.
LING 388 Language and Computers Lecture 12 10/9/03 Sandiway FONG.
1 Basic Parsing with Context Free Grammars Chapter 13 September/October 2012 Lecture 6.
LING 388: Language and Computers Sandiway Fong Lecture 8.
SI485i : NLP Set 9 Advanced PCFGs Some slides from Chris Manning.
11 CS 388: Natural Language Processing: Syntactic Parsing Raymond J. Mooney University of Texas at Austin.
LING 388: Language and Computers Sandiway Fong Lecture 11.
October 2004csa4050: Semantics II1 CSA4050: Advanced Topics in NLP Semantics II The Lambda Calculus Semantic Representation Encoding in Prolog.
PARSING David Kauchak CS457 – Fall 2011 some slides adapted from Ray Mooney.
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.
CS : Speech, Natural Language Processing and the Web/Topics in Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 12: Deeper.
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 3.
LING 388: Language and Computers Sandiway Fong Lecture 18.
LING 388: Language and Computers Sandiway Fong Lecture 10.
LING 388: Language and Computers Sandiway Fong Lecture 13.
Linguistic Essentials
LING 388: Language and Computers Sandiway Fong Lecture 12.
LING 388: Language and Computers Sandiway Fong Lecture 11: 10/4.
CPE 480 Natural Language Processing Lecture 4: Syntax Adapted from Owen Rambow’s slides for CSc Fall 2006.
Rules, Movement, Ambiguity
CSA2050 Introduction to Computational Linguistics Parsing I.
PARSING 2 David Kauchak CS159 – Spring 2011 some slides adapted from Ray Mooney.
LING 388: Language and Computers Sandiway Fong Lecture 21.
CS 4705 Lecture 7 Parsing with Context-Free Grammars.
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.
CS460/IT632 Natural Language Processing/Language Technology for the Web Lecture 13 (17/02/06) Prof. Pushpak Bhattacharyya IIT Bombay Top-Down Bottom-Up.
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1.
CS : Language Technology for the Web/Natural Language Processing Pushpak Bhattacharyya CSE Dept., IIT Bombay Parsing Algos.
PARSING David Kauchak CS159 – Fall Admin Assignment 3 Quiz #1  High: 36  Average: 33 (92%)  Median: 33.5 (93%)
LING/C SC 581: Advanced Computational Linguistics Lecture Notes Feb 17 th.
Statistical NLP: Lecture 3
Natural Language Processing
LING/C SC/PSYC 438/538 Lecture 23 Sandiway Fong.
CS : Speech, NLP and the Web/Topics in AI
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
LING/C SC 581: Advanced Computational Linguistics
LING/C SC/PSYC 438/538 Lecture 23 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 22 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.
Linguistic Essentials
David Kauchak CS159 – Spring 2019
Presentation transcript:

LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1

Today's Topic Let's write a phrase structure grammar (PSG) using Prolog Mechanisms: 1.Extra argument for Prolog term representation of a parse 2.Extra arguments for feature value agreement 3.Dealing with left recursive rules: grammar transformation

Topics Mechanisms: 1.Extra argument for Prolog term representation of a parse 2.Extra arguments for feature value agreement 3.Dealing with left recursive rules: grammar transformation

Parse Let's write a simple grammar returning appropriate parse trees for sentences like: – John kicked the ball – the men kicked the ball – a man kicked the ball Stanford Parser: –(ROOT – (S – (NP (DT the) (NNS men)) – (VP (VBD kicked) – (NP (DT the) (NN ball)))))

Topics Mechanisms: 1.Extra argument for Prolog term representation of a parse 2.Extra arguments for feature value agreement 3.Dealing with left recursive rules: grammar transformation

Extra Arguments: Agreement Idea: – We can also use an extra argument to impose constraints between constituents within a DCG rule Example: – English determiner-noun number agreement – Data: the man the men a man *a men – Lexical Features: man singular men plural 6

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 7

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 value of the variable 8

Extra Arguments: Agreement Note: Use of the extra argument for agreement here is basically “syntactic sugar” and lends no more 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 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]. 9

Extra Arguments: Agreement English exhibits subject- verb agreement Examples: – John kicked the ball – The men kicked the ball – John kicks the balls – The men *kicks/kick the ball Constraint: 1.-s form of the verb is compatible with 3rd person singular only for the subject NP 2.uninflected form is not compatible with 3 rd person singular for the subject NP

Subject Verb Agreement We need feature percolation: eats *eat FormEndingComment eat uninflectednot 3 rd person singular eats-s3 rd person singular ate-edpast eaten-enpast participle eating-inggerund Person Number Person Number Ending Subject and VP come together at this rule Person Number Person Number Ending POS tags

Subject Verb Agreement Implementation: using POS tags Constraint table: –% table of Person Number Tag possible combinations –check(3,plural,vb). –check(3,plural,vbd). –check(3,singular,vbz). –check(3,singular,vbd). Person, Number from Subject NP POS tag from verb

Topics Mechanisms: 1.Extra argument for Prolog term representation of a parse 2.Extra arguments for feature value agreement 3.Dealing with left recursive rules: grammar transformation

Today’s Topic Left recursive parses: We know from an earlier lecture that left recursive rules are a no-no given Prolog’s left-to- right depth-first computation rule… Example: 1.s --> a, [!]. 2.a --> ba, [a]. 3.a --> a, [a]. 4.ba --> b, [a]. 5.b --> [b]. ?- s([b,a,!],[]). ERROR: Out of local stack s a a a a...

Preposition Phrase (PP) Attachment The preferred syntactic analysis is a left recursive parse Examples: – John saw the boy with a telescope – (structural ambiguity: automatically handled by Prolog) possessive with instrument with

Preposition Phrase (PP) Attachment The preferred syntactic analysis is a left recursive parse Can “stack” PPs: – John saw the boy with a limp with Mary with a telescope – ambiguity: with possessive, with accompaniment, with instrument

Preposition Phrase Attachment Linguistically: – PP (recursively) adjoins to NP or VP –np(np(NP,PP)) --> np(NP), pp(PP). –vp(vp(VP,PP)) --> vp(VP), pp(PP). Left recursion gives Prolog problems Derivation (top-down, left-to-right): 1.vp 2.vp pp 3.vp pp pp 4.vp pp pp pp 5.vp pp pp pp ppinfinite loop…

Transformation Apply the general transformation: to NP and VP rules: 1.np(np(DT,NN)) --> dt(DT,Number), nn(NN,Number). 2.np(np(NP,PP)) --> np(NP), pp(PP). 3.vp(vp(VBD,NP)) --> vbd(VBD), np(NP). 4.vp(vp(VP,PP)) --> vp(VP), pp(PP). x(x(X,y)) --> x(X), [y]. x(x(z)) --> [z]. x(x(X,y)) --> x(X), [y]. x(x(z)) --> [z]. [z] [y] x x x(X) --> [z], w(X,x(z)). x(x(z)) --> [z]. w(W,X) --> [y], w(W,x(X,y)). w(x(X,y),X) --> [y]. x(X) --> [z], w(X,x(z)). x(x(z)) --> [z]. w(W,X) --> [y], w(W,x(X,y)). w(x(X,y),X) --> [y]. [z] [y] x x Note: w is a new Non-terminal That takes 2 arguments Note: w is a new Non-terminal That takes 2 arguments

Transformed grammar