LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.

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
For Monday Read Chapter 23, sections 3-4 Homework –Chapter 23, exercises 1, 6, 14, 19 –Do them in order. Do NOT read ahead.
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/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/11.
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 16: 10/19.
1 CSC 594 Topics in AI – Applied Natural Language Processing Fall 2009/ Outline of English Syntax.
LING 388: Language and Computers Sandiway Fong Lecture 17: 10/24.
LING 388 Language and Computers Lecture 12 10/9/03 Sandiway FONG.
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.
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 27.
For Friday Finish chapter 23 Homework: –Chapter 22, exercise 9.
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 3.
Verbals and Verbal Phrases
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.
11 Chapter 14 Part 1 Statistical Parsing Based on slides by Ray Mooney.
Linguistic Essentials
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 20 Sandiway Fong 1.
LING 388: Language and Computers Sandiway Fong Lecture 16.
Handling Unlike Coordinated Phrases in TAG by Mixing Syntactic Category and Grammatical Function Carlos A. Prolo Faculdade de Informática – PUCRS CELSUL,
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.
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 3 rd.
LING/C SC 581: Advanced Computational Linguistics Lecture Notes Feb 17 th.
Natural Language Processing Vasile Rus
Lecture – VIII Monojit Choudhury RS, CSE, IIT Kharagpur
Statistical NLP: Lecture 3
LING/C SC/PSYC 438/538 Lecture 23 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 5 Sandiway Fong.
CS : Speech, NLP and the Web/Topics in AI
LING/C SC/PSYC 438/538 Lecture 20 Sandiway Fong.
LING 581: Advanced Computational Linguistics
Syntax.
LING/C SC 581: Advanced Computational Linguistics
LING/C SC/PSYC 438/538 Lecture 3 Sandiway Fong.
Probabilistic and Lexicalized Parsing
LING/C SC/PSYC 438/538 Lecture 23 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 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
LING/C SC/PSYC 438/538 Lecture 13 Sandiway Fong.
David Kauchak CS159 – Spring 2019
LING/C SC/PSYC 438/538 Lecture 3 Sandiway Fong.
Presentation transcript:

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

Today's Topics Homework 13 out today Let's practice writing a natural language grammar…

Homework 13 Cognate Object Construction (COC) examples: He fought a heroic fight He fought (the enemy) She lived a happy life She lived They died a gruesome death They died You smiled a happy smile You smiled According to Levin's EVCA (1993), CO-taking verbs include: Verbs of Nonverbal Expression (some), e.g. laugh, smile, yawn; Waltz Verbs, e.g. boogie, dance, waltz; Other Verbs: e.g. dream, flight, live, sing, sleep, think;

Homework 13 Question 1: write a predicate co_verb(V, N) that databases the CO- taking verbs, e.g. co_verb(fight, fight). co_verb(live, life). Question 2: write a predicate verb_form(V, POS_Tag, Form) that lists the verb forms for the CO-taking verbs, e.g. verb_form(fight, vbd, fought). verb_form(fight, vbz, fights).

Homework 13 Question 3: use Prolog's grammar rules to write a sentence grammar that allows the intransitive form or take cognate objects only. HINT 0: normally we write lexical rules directly as follows, e.g. dt --> [a]. dt --> [the]. jj --> [happy]. HINT 1: use {…} in conjunction with your answers to Questions 1 and 2, e.g. co_verb --> [Form], {verb_form(_Verb,_Tag,Form)}. ( _Variable: means don't warn me about this variable not being used here.) HINT 2: use an extra argument to restrict your sentential object to be a CO, e.g. vp --> co_verb(CO_V), np(CO_N), {co_verb(CO_V,CO_N)}.

Homework 13 Test your grammar, document your code, and submit plenty of examples, e.g. Grammatical: s([she,lived],[]). s([she,lived,a,life],[]). s([she,lived,a,happy,life],[]). Ungrammatical: s([she,lived,a,death],[]).

Homework 13 Question 4: modify your answer to Question 3 to compute parses for the grammatical cases, e.g. Use the Penn Treebank POS and syntax tags HINT: you can have multiple extra arguments in a grammar rule Submit your runs

Homework 13 Usual rules: one PDF file, code attachments, due by next Monday midnight

Phrase Structure Grammars Let's write a phrase structure grammar (PSG) using Prolog Mechanisms: Extra argument for Prolog term representation of a parse (you already know this) Extra arguments for feature value agreement Dealing with left recursive rules: grammar transformation

Prolog 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))))) Berkeley Parser:

Prolog Parse

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

Phrase Structure Grammars Berkeley Parser: a men kicked the ball

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

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(dt(the),sg) --> [the]. det(dt(the),pl) --> [the]. det(dt(a),sg) --> [a]. common_noun(nn(ball),sg) --> [ball]. common_noun(nn(man),sg) --> [man]. common_noun(nns(men),pl) --> [men]. pronoun(prp(i)) --> [i]. pronoun(prp(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(dt(the),sg) --> [the]. det(dt(the),pl) --> [the]. det(dt(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(dt(the),_) --> [the]. Note: _ is a variable used underscore character because we don’t care about the value of the variable

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 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(dt(a)) --> [a]. detsg(dt(the)) --> [the]. detpl(dt(the)) --> [the]. common_nounsg(nn(ball)) --> [ball]. common_nounsg(nn(man)) -->[man]. common_nounpl(nn(men)) --> [men].

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

Subject Verb Agreement We need feature percolation: Form Ending Comment eat uninflected not 3rd person singular eats -s 3rd person singular ate -ed past eaten -en past participle eating -ing gerund Subject and VP come together at this rule Person Number Ending POS tags eats *eat Person Number Ending

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

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

Left recursion and Prolog Left recursive grammars: we know from an earlier lecture that left recursive rules are a no-no given Prolog’s left-to-right depth- first computation rule… s a ... Example: s --> a, [!]. a --> ba, [a]. a --> a, [a]. ba --> b, [a]. b --> [b]. ?- s([b,a,!],[]). ERROR: Out of local stack

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) withinstrument withpossessive