NLP.

Slides:



Advertisements
Similar presentations
Feature Structures and Parsing Unification Grammars Algorithms for NLP 18 November 2014.
Advertisements

CSA4050: Advanced Topics in NLP Semantics IV Partial Execution Proper Noun Adjective.
Statistical NLP: Lecture 3
LING NLP 1 Introduction to Computational Linguistics Martha Palmer April 19, 2006.
1 Introduction to Computational Linguistics Eleni Miltsakaki AUTH Fall 2005-Lecture 2.
1/17 Probabilistic Parsing … and some other approaches.
Natural Language Query Interface Mostafa Karkache & Bryce Wenninger.
Context Free Grammar S -> NP VP NP -> det (adj) N
1 CSC 594 Topics in AI – Applied Natural Language Processing Fall 2009/ Outline of English Syntax.
Linguistic Theory Lecture 2 Phrase Structure. What was there before structure? Classical studies: Classical studies: –Languages such as Latin Rich morphology.
11 CS 388: Natural Language Processing: Syntactic Parsing Raymond J. Mooney University of Texas at Austin.
February 2009Introduction to Semantics1 Logic, Representation and Inference Introduction to Semantics What is semantics for? Role of FOL Montague Approach.
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.
Introduction Syntax: form of a sentence (is it valid) Semantics: meaning of a sentence Valid: the frog writes neatly Invalid: swims quickly mathematics.
Natural Language Processing Lecture 6 : Revision.
10. Parsing with Context-free Grammars -Speech and Language Processing- 발표자 : 정영임 발표일 :
1 Natural Language Processing Lecture Notes 11 Chapter 15 (part 1)
Semantic Analysis CMSC Natural Language Processing May 8, 2003.
Natural Language Processing Artificial Intelligence CMSC February 28, 2002.
CS 460 NATURAL LANGUAGE PROCESSING. CONTENTS Introduction Motivation Categorial Grammar Combinatory Categorial Grammar Three parts of formalism of CCG.
NLP. Introduction to NLP Is language more than just a “bag of words”? Grammatical rules apply to categories and groups of words, not individual words.
PARSING David Kauchak CS159 – Spring 2011 some slides adapted from Ray Mooney.
Context Free Grammars Reading: Chap 9, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Rada Mihalcea.
October 2008CSA3180: Sentence Parsing1 CSA3180: NLP Algorithms Sentence Parsing Algorithms 2 Problems with DFTD Parser.
1 LIN6932 Spring 2007 LIN6932 Topics in Computational Linguistics Lecture 6: Grammar and Parsing (I) February 15, 2007 Hana Filip.
Notes on Pinker ch.7 Grammar, parsing, meaning. What is a grammar? A grammar is a code or function that is a database specifying what kind of sounds correspond.
Linguistic Essentials
Grammars Grammars can get quite complex, but are essential. Syntax: the form of the text that is valid Semantics: the meaning of the form – Sometimes semantics.
The man bites the dog man bites the dog bites the dog the dog dog Parse Tree NP A N the man bites the dog V N NP S VP A 1. Sentence  noun-phrase verb-phrase.
CSA2050 Introduction to Computational Linguistics Parsing I.
NLP. Introduction to NLP Background –Developed by Jay Earley in 1970 –No need to convert the grammar to CNF –Left to right Complexity –Faster than O(n.
Basic Parsing Algorithms: Earley Parser and Left Corner Parsing
1 Context Free Grammars October Syntactic Grammaticality Doesn’t depend on Having heard the sentence before The sentence being true –I saw a unicorn.
NLP. Introduction to NLP Motivation –A lot of the work is repeated –Caching intermediate results improves the complexity Dynamic programming –Building.
Section 11.3 Features structures in the Grammar ─ Jin Wang.
CATEGORIAL GRAMMARS AND THE NATURAL LANGUAGE PROCESSING Ismaïl Biskri Mathematics and Computer-Science Department University of Quebec in Trois-Rivières.
NLP. Introduction to NLP Shallow parsing Useful for information extraction –noun phrases, verb phrases, locations, etc. Example –FASTUS (Appelt and Israel,
1 Natural Language Processing Lectures 8-9 Auxiliary Verbs Movement Phenomena Reading: James Allen NLU (Chapter 5)
1 Introduction to Computational Linguistics Eleni Miltsakaki AUTH Spring 2006-Lecture 2.
CS460/IT632 Natural Language Processing/Language Technology for the Web Lecture 13 (17/02/06) Prof. Pushpak Bhattacharyya IIT Bombay Top-Down Bottom-Up.
CSA3050: NLP Algorithms Sentence Grammar NLP Algorithms.
NLP. Introduction to NLP #include int main() { int n, reverse = 0; printf("Enter a number to reverse\n"); scanf("%d",&n); while (n != 0) { reverse =
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%)
Context Free Grammars. Slide 1 Syntax Syntax = rules describing how words can connect to each other * that and after year last I saw you yesterday colorless.
Natural Language Processing Vasile Rus
Beginning Syntax Linda Thomas
NLP.
Lecture – VIII Monojit Choudhury RS, CSE, IIT Kharagpur
Statistical NLP: Lecture 3
Basic Parsing with Context Free Grammars Chapter 13
CKY Parser 0Book 1 the 2 flight 3 through 4 Houston5 6/19/2018
Probabilistic CKY Parser
Syntax.
CS : Speech, NLP and the Web/Topics in AI
Statistical NLP Spring 2011
CS 388: Natural Language Processing: Statistical Parsing
CKY Parser 0Book 1 the 2 flight 3 through 4 Houston5 11/16/2018
CS 388: Natural Language Processing: Syntactic Parsing
Language Variations: Japanese and English
Grundlagen Englisch Verb patterns HFW Bern Philipp Brunner.
CSCI 5832 Natural Language Processing
Linguistic Essentials
David Kauchak CS159 – Spring 2019
Natural Language Processing
Introduction to Grammar
Structure of a Lexicon Debasri Chakrabarti 13-May-19.
David Kauchak CS159 – Spring 2019
Artificial Intelligence 2004 Speech & Natural Language Processing
NLP.
Presentation transcript:

NLP

Combinatory Categorial Grammar (CCG) Introduction to NLP Combinatory Categorial Grammar (CCG)

Combinatory Categorial Grammar (CCG) Complex types E.g., X/Y and X\Y These take an argument of type Y and return an object of type X. X/Y – means that Y should appear on the right X\Y – means that Y should appear on the left PROVENANCE

Structure of CCG Categories Combinatory rules Lexicon

CCG Rules Function composition Type raising Coordination X/Y Y/Z -> X/Z X\Y Z\X -> Z\Y X/Y Y\Z -> X\Z X/Y Z\X -> Z/Y Type raising X -> Y/(Y\X) X -> Y\(Y/X) Coordination

Example PROVENANCE Example from Jonathan Kummerfeld, Aleka Blackwell, and Patrick Littell

Expressive power CCGs can generate the language anbncndn, n>0 Interesting examples: I like New York I like and hate New York I like and would rather be in New York I gave a book to Chen and a laptop to Jorge I want Chen to stay and Jorge to leave I like and Chen hates, New York Where are the verb phrases? PROVENANCE

Examples from Steedman 1996

Examples from Steedman 1996

Examples from Steedman 1996

CCG in NLTK http://www.nltk.org/howto/ccg.html from nltk.ccg import chart, lexicon lex = lexicon.parseLexicon(''' :- S, NP, N, VP Det :: NP/N Pro :: NP Modal :: S\\NP/VP TV :: VP/NP DTV :: TV/NP the => Det that => Det that => NP I => Pro you => Pro we => Pro chef => N cake => N children => N dough => N will => Modal should => Modal might => Modal must => Modal and => var\\.,var/.,var to => VP[to]/VP without => (VP\\VP)/VP[ing] be => TV cook => TV eat => TV cooking => VP[ing]/NP give => DTV is => (S\\NP)/NP prefer => (S\\NP)/NP which => (N\\N)/(S/NP) persuade => (VP/VP[to])/NP ''') http://www.nltk.org/howto/ccg.html

CCG in NLTK http://www.nltk.org/howto/ccg.html parser = chart.CCGChartParser(lex, chart.DefaultRuleSet) for parse in parser.parse("you prefer that cake".split()): chart.printCCGDerivation(parse) break you prefer that cake NP ((S\NP)/NP) (NP/N) N ----- NP ------------- ((S\NP)/NP) -------- (NP/N) ------ N --------------> ---------------------------> (S\NP) --------------------------------< S http://www.nltk.org/howto/ccg.html

for parse in parser. parse("that is the cake which you prefer" for parse in parser.parse("that is the cake which you prefer".split()): chart.printCCGDerivation(parse) break that is the cake which you prefer NP ((S\NP)/NP) (NP/N) N ((N\N)/(S/NP)) NP ((S\NP)/NP) ------ NP ------------- ((S\NP)/NP) -------- (NP/N) N ---------------- ((N\N)/(S/NP)) ----- ----->T (S/(S\NP)) ------------------>B (S/NP) ----------------------------------> (N\N) ----------------------------------------< ------------------------------------------------> -------------------------------------------------------------> (S\NP) -------------------------------------------------------------------< S http://www.nltk.org/howto/ccg.html

CCG NACLO problem from 2014 Authors: Jonathan Kummerfeld, Aleka Blackwell, and Patrick Littell http://www.nacloweb.org/resources/problems/2014/N2014-O.pdf http://www.nacloweb.org/resources/problems/2014/N2014-OS.pdf http://www.nacloweb.org/resources/problems/2014/N2014-P.pdf http://www.nacloweb.org/resources/problems/2014/N2014-PS.pdf

CCG Parsing CKY works fine http://openccg.sourceforge.net/

http://4. easy-ccg. appspot. com/do_parse http://4.easy-ccg.appspot.com/do_parse?sentence=Fruit+flies+like+a+banana&nbest=5

Exercise How do you represent the following categories in CCG Nouns Adjectives Articles Prepositions Transitive verbs Intransitive verbs

Exercise How do you represent the following categories in CCG Nouns N Adjectives N/N Articles NP/N Prepositions (NP\NP)/NP Transitive verbs (S\NP)/NP Intransitive verbs

CCG for Dutch Cross-Serial Dependencies … because I1 Cecilia2 Henk3 the hippopotamuses4 saw1 help2 feed3,4. [Example from Stephen Clark]

Notes CCG is mildly context-sensitive CCG rules are monotonic It can handle some phenomena that are not CFG But it can be parsed efficiently CCG rules are monotonic Movement is not allowed Complexity O(n3) – with restricted type raising Unbounded – with unrestricted type raising CCG gets closer to semantics and lambda calculus

CCGBank Hockenmaier and Steedman (2005)

NLP