Syntactic Parsing. Prof. Sameer Singh CS 295: STATISTICAL NLP WINTER February 7, 2017

Similar documents
Grammars & Parsing, Part 1:

Basic Parsing with Context-Free Grammars. Some slides adapted from Julia Hirschberg and Dan Jurafsky 1

11/29/2010. Statistical Parsing. Statistical Parsing. Simple PCFG for ATIS English. Syntactic Disambiguation

Syntax Parsing 1. Grammars and parsing 2. Top-down and bottom-up parsing 3. Chart parsers 4. Bottom-up chart parsing 5. The Earley Algorithm

Context Free Grammars. Many slides from Michael Collins

CS 598 Natural Language Processing

Enhancing Unlexicalized Parsing Performance using a Wide Coverage Lexicon, Fuzzy Tag-set Mapping, and EM-HMM-based Lexical Probabilities

Chunk Parsing for Base Noun Phrases using Regular Expressions. Let s first let the variable s0 be the sentence tree of the first sentence.

UNIVERSITY OF OSLO Department of Informatics. Dialog Act Recognition using Dependency Features. Master s thesis. Sindre Wetjen

BANGLA TO ENGLISH TEXT CONVERSION USING OPENNLP TOOLS

SEMAFOR: Frame Argument Resolution with Log-Linear Models

Parsing of part-of-speech tagged Assamese Texts

Natural Language Processing. George Konidaris

ENGBG1 ENGBL1 Campus Linguistics. Meeting 2. Chapter 7 (Morphology) and chapter 9 (Syntax) Pia Sundqvist

Heuristic Sample Selection to Minimize Reference Standard Training Set for a Part-Of-Speech Tagger

Informatics 2A: Language Complexity and the. Inf2A: Chomsky Hierarchy

LTAG-spinal and the Treebank

The stages of event extraction

Prediction of Maximal Projection for Semantic Role Labeling

Compositional Semantics

Basic Syntax. Doug Arnold We review some basic grammatical ideas and terminology, and look at some common constructions in English.

Parsing with Treebank Grammars: Empirical Bounds, Theoretical Models, and the Structure of the Penn Treebank

1/20 idea. We ll spend an extra hour on 1/21. based on assigned readings. so you ll be ready to discuss them in class

Chapter 4: Valence & Agreement CSLI Publications

The Indiana Cooperative Remote Search Task (CReST) Corpus

Introduction to HPSG. Introduction. Historical Overview. The HPSG architecture. Signature. Linguistic Objects. Descriptions.

Construction Grammar. University of Jena.

Developing a TT-MCTAG for German with an RCG-based Parser

Chinese Language Parsing with Maximum-Entropy-Inspired Parser

2/15/13. POS Tagging Problem. Part-of-Speech Tagging. Example English Part-of-Speech Tagsets. More Details of the Problem. Typical Problem Cases

EdIt: A Broad-Coverage Grammar Checker Using Pattern Grammar

Three New Probabilistic Models. Jason M. Eisner. CIS Department, University of Pennsylvania. 200 S. 33rd St., Philadelphia, PA , USA

Towards a MWE-driven A* parsing with LTAGs [WG2,WG3]

Accurate Unlexicalized Parsing for Modern Hebrew

Target Language Preposition Selection an Experiment with Transformation-Based Learning and Aligned Bilingual Data

Derivational: Inflectional: In a fit of rage the soldiers attacked them both that week, but lost the fight.

Ensemble Technique Utilization for Indonesian Dependency Parser

cmp-lg/ Jan 1998

Adapting Stochastic Output for Rule-Based Semantics

A Minimalist Approach to Code-Switching. In the field of linguistics, the topic of bilingualism is a broad one. There are many

COMPUTATIONAL COMPLEXITY OF LEFT-ASSOCIATIVE GRAMMAR

The Smart/Empire TIPSTER IR System

Theoretical Syntax Winter Answers to practice problems

The Role of the Head in the Interpretation of English Deverbal Compounds

Analysis of Probabilistic Parsing in NLP

Language Acquisition Fall 2010/Winter Lexical Categories. Afra Alishahi, Heiner Drenhaus

We are going to talk about the meaning of the word weary. Then we will learn how it can be used in different sentences.

Ch VI- SENTENCE PATTERNS.

Project in the framework of the AIM-WEST project Annotation of MWEs for translation

Towards a Machine-Learning Architecture for Lexical Functional Grammar Parsing. Grzegorz Chrupa la

A Computational Evaluation of Case-Assignment Algorithms

Domain Adaptation for Parsing

Proof Theory for Syntacticians

Modeling Attachment Decisions with a Probabilistic Parser: The Case of Head Final Structures

Psychology and Language

Specifying a shallow grammatical for parsing purposes

The Interface between Phrasal and Functional Constraints

POS tagging of Chinese Buddhist texts using Recurrent Neural Networks

IBAN LANGUAGE PARSER USING RULE BASED APPROACH

The presence of interpretable but ungrammatical sentences corresponds to mismatches between interpretive and productive parsing.

University of Alberta. Large-Scale Semi-Supervised Learning for Natural Language Processing. Shane Bergsma

Probing for semantic evidence of composition by means of simple classification tasks

Developing Grammar in Context

Some Principles of Automated Natural Language Information Extraction

"f TOPIC =T COMP COMP... OBJ

SINGLE DOCUMENT AUTOMATIC TEXT SUMMARIZATION USING TERM FREQUENCY-INVERSE DOCUMENT FREQUENCY (TF-IDF)

Natural Language Processing: Interpretation, Reasoning and Machine Learning

LNGT0101 Introduction to Linguistics

(Sub)Gradient Descent

An Introduction to the Minimalist Program

Inleiding Taalkunde. Docent: Paola Monachesi. Blok 4, 2001/ Syntax 2. 2 Phrases and constituent structure 2. 3 A minigrammar of Italian 3

AQUA: An Ontology-Driven Question Answering System

RANKING AND UNRANKING LEFT SZILARD LANGUAGES. Erkki Mäkinen DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF TAMPERE REPORT A ER E P S I M S

Product Feature-based Ratings foropinionsummarization of E-Commerce Feedback Comments

Introduction. Beáta B. Megyesi. Uppsala University Department of Linguistics and Philology Introduction 1(48)

Linking Task: Identifying authors and book titles in verbose queries

What is NLP? CS 188: Artificial Intelligence Spring Why is Language Hard? The Big Open Problems. Information Extraction. Machine Translation

Learning Computational Grammars

Grammar Extraction from Treebanks for Hindi and Telugu

Lecture 1: Basic Concepts of Machine Learning

Parsing natural language

EAGLE: an Error-Annotated Corpus of Beginning Learner German

Update on Soar-based language processing

A Graph Based Authorship Identification Approach

Pre-Processing MRSes

Building a Semantic Role Labelling System for Vietnamese

On the Notion Determiner

Software Maintenance

A Version Space Approach to Learning Context-free Grammars

Building an HPSG-based Indonesian Resource Grammar (INDRA)

THE VERB ARGUMENT BROWSER

What Can Neural Networks Teach us about Language? Graham Neubig a2-dlearn 11/18/2017

Survey on parsing three dependency representations for English

Grammar Lesson Plan: Yes/No Questions with No Overt Auxiliary Verbs

Capitalism and Higher Education: A Failed Relationship

Hindi Aspectual Verb Complexes

Semi-supervised methods of text processing, and an application to medical concept extraction. Yacine Jernite Text-as-Data series September 17.

A Usage-Based Approach to Recursion in Sentence Processing

have to be modeled) or isolated words. Output of the system is a grapheme-tophoneme conversion system which takes as its input the spelling of words,

Memory-based grammatical error correction

Transcription:

Syntactic Parsing Prof. Sameer Singh CS 295: STATISTICAL NLP WINTER 2017 February 7, 2017 Based on slides from Nathan Schneider, Noah Smith, Marine Carpuat, Dan Jurafsky, and everyone else they copied from.

Outline Syntactic Parsing Context Free Grammars Parsing: CKY Algorithm CS 295: STATISTICAL NLP (WINTER 2017) 2

Outline Syntactic Parsing Context Free Grammars Parsing: CKY Algorithm CS 295: STATISTICAL NLP (WINTER 2017) 3

Limitations of Sequence Tags John Smith shot Bill in his pajamas. What happened? Who shot who? Who was wearing the pajamas? Using http://nlp.stanford.edu:8080/corenlp/process CS 295: STATISTICAL NLP (WINTER 2017) 4

Constituents Constituent behave as a unit that can be rearranged: John talked [to the children] [about drugs]. John talked [about drugs] [to the children]. John talked drugs to the children about Or substituted/expanded: John talked [to the children taking the drugs] [about alcohol]. Harry the Horse a high-class spot such as Mindy s the Broadway coppers the reason he comes into the Hot Box they three parties from Brooklyn X arrive(s) attract(s) love(s) sit(s) Noun phrases appear before verbs in English. CS 295: STATISTICAL NLP (WINTER 2017) 5

Constituents and Grammars Grammar Tells you how the constituents can be arranged Implicit knowledge for us (we often can t tell why something is wrong) Generate all, and only, the possible sentences of the language Different from meaning: Colorless green ideas sleep furiously. The words are in the right order, And that ideas are green and colorless, And that ideas sleep, And that sleeping is done furiously, As opposed to: sleep green furiously ideas colorless CS 295: STATISTICAL NLP (WINTER 2017) 6

Uses of Parsing [ send [the text message from James] [to Sharon] ] [ translate [the message] [from Hindi] [to English] ] Grammar checkers Dialog systems High precision question answering Named entity recognition Sentence compression Extracting opinions about products Improved interaction in computer games Helping linguists find data Machine translation Relation extraction systems CS 295: STATISTICAL NLP (WINTER 2017) 7

Outline Syntactic Parsing Context Free Grammars Parsing: CKY Algorithm CS 295: STATISTICAL NLP (WINTER 2017) 8

Basic Grammar: Regular Expr. You can capture individual words: (man dog cat) Simple sentences: (man dog cat)(ate loves consumed)(. food lunch) Infinite length? Yes! men (who like (cats dogs))* cry. Finite State men Machine Start S1 who dogs S2 cats like S3 End cry But too weak for English. CS 295: STATISTICAL NLP (WINTER 2017) 9

Context-Free Grammars Grammar, G Terminal Symbols Non-terminal Symbols Rules Grammar applies rules recursively.. If we can construct the input sentence, it is in the grammar, otherwise not. CS 295: STATISTICAL NLP (WINTER 2017) 10

Example CFG CS 295: STATISTICAL NLP (WINTER 2017) 11

Example Parse Tree I prefer a morning flight. CS 295: STATISTICAL NLP (WINTER 2017) 12

Example Parse Tree: Brackets I prefer a morning flight. CS 295: STATISTICAL NLP (WINTER 2017) 13

More details: Noun Phrases Simple Noun Phrases NP ProperNoun NP Det Nominal Nominal Noun Noun Nominal Complex Noun Phrases all the morning flights from Denver to Tampa leaving before 10 CS 295: STATISTICAL NLP (WINTER 2017) 14

Recursive Noun Phrases this is the house this is the house that Jack built this is the cat that lives in the house that Jack built this is the dog that chased the cat that lives in the house that Jack built this is the flea that bit the dog that chased the cat that lives in the house the Jack built this is the virus that infected the flea that bit the dog that chased the cat that lives in the house that Jack built CS 295: STATISTICAL NLP (WINTER 2017) 15

More details: Verb Phrases Simple Verb Phrases VP Verb VP Verb NP VP Verb NP PP VP Verb PP disappear prefer a morning flight leave Boston in the morning leave in the morning But all verbs are not the same! (this grammar overgenerates) Solution: subcategorize! Sneezed: John sneezed. Find: Please find a flight to NY. Give: Give me a cheaper fare. Help: Can you help me with a flight? Prefer: I prefer to leave earlier. Told: I was told United has a flight. CS 295: STATISTICAL NLP (WINTER 2017) 16

Types of Sentences Declarative S NP VP A plane left. Imperative S VP Show the plane. Yes/no Questions S Aux NP VP Did the plane leave? Wh-Questions S WhNP Aux NP VP When did the plane leave? CS 295: STATISTICAL NLP (WINTER 2017) 17

Source of Grammar? Manual Write symbolic grammar (CFG or often richer) and lexicon S NP VP NN interest NP (DT) NN NNS rates NP NN NNS NNS raises NP NNP VBP interest VP V NP VBZ rates Used grammar/proof systems to prove parses from words Noam Chomsky Fed raises interest rates 0.5% in effort to control inflation Minimal grammar: 36 parses Simple 10 rule grammar: 592 parses Real-size broad-coverage grammar: millions of parses CS 295: STATISTICAL NLP (WINTER 2017) 18

Source of Grammar? From data! The Penn Treebank Building a treebank seems a lot slower and less useful than building a grammar But a treebank gives us many things Reusability of the labor Many parsers, POS taggers, etc. Valuable resource for linguistics Broad coverage Frequencies and distributional information A way to evaluate systems [Marcus et al. 1993, Computational Linguistics] CS 295: STATISTICAL NLP (WINTER 2017) 19

( (S (NP-SBJ (DT The) (NN move)) (VP (VBD followed) (NP (NP (DT a) (NN round)) (PP (IN of) (NP (NP (JJ similar) (NNS increases)) (PP (IN by) (NP (JJ other) (NNS lenders))) (PP (IN against) (NP (NNP Arizona) (JJ real) (NN estate) (NNS loans)))))) (,,) (S-ADV (NP-SBJ (-NONE- *)) (VP (VBG reflecting) (NP (NP (DT a) (VBG continuing) (NN decline)) (PP-LOC (IN in) (NP (DT that) (NN market))))))) (..))) CS 295: STATISTICAL NLP (WINTER 2017) 20

Some of the rules, with counts 40717 PP IN NP 33803 S NP-SBJ VP 22513 NP-SBJ -NONE- 21877 NP NP PP 20740 NP DT NN 14153 S NP-SBJ VP. 12922 VP TO VP 11881 PP-LOC IN NP 11467 NP-SBJ PRP 11378 NP -NONE- 11291 NP NN... 989 VP VBG S 985 NP-SBJ NN 983 PP-MNR IN NP 983 NP-SBJ DT 969 VP VBN VP 100 VP VBD PP-PRD 100 PRN : NP : 100 NP DT JJS 100 NP-CLR NN 99 NP-SBJ-1 DT NNP 98 VP VBN NP PP-DIR 98 VP VBD PP-TMP 98 PP-TMP VBG NP 97 VP VBD ADVP-TMP VP... 10 WHNP-1 WRB JJ 10 VP VP CC VP PP-TMP 10 VP VP CC VP ADVP-MNR 10 VP VBZ S, SBAR-ADV 10 VP VBZ S ADVP-TMP 4500 rules for VP! CS 295: STATISTICAL NLP (WINTER 2017) 21

Evaluating Parses Each parse tree is represented by a list of tuples: Use this to estimate precision/recall! CS 295: STATISTICAL NLP (WINTER 2017) 22

Evaluating Parses: Example CS 295: STATISTICAL NLP (WINTER 2017) 23

Outline Syntactic Parsing Context Free Grammars Parsing: CKY Algorithm CS 295: STATISTICAL NLP (WINTER 2017) 24

The Parsing Problem Given sentence x and grammar G, Recognition Is sentence x in the grammar? If so, prove it. Proof is a deduction, valid parse tree. Parsing Show one or more derivations for x in G. Even with small grammars, brute force grows exponentially! Book that flight CS 295: STATISTICAL NLP (WINTER 2017) 25

Top Down Parsing Considers only valid trees But are inconsistent with the words! Book that flight CS 295: STATISTICAL NLP (WINTER 2017) 26

Bottom-up Parsing Book that flight Builds only consistent trees But most of them are invalid (don t go anywhere)! CS 295: STATISTICAL NLP (WINTER 2017) 27

Chomsky Normal Form Context free grammar where all non-terminals to go: - 2 non-terminals, or - A single terminal A B C D w Converting to CNF Case 1 Case 2 A B B C D B w A C D A w A B C D E A X E X Y D Y B C CS 295: STATISTICAL NLP (WINTER 2017) 28

Original Grammar Chomsky Normal Form CS 295: STATISTICAL NLP (WINTER 2017) 29

Dynamic Programming table[i,j] = Set of all valid non-terminals for the constituent span (i,j) Base case Rule: A word[j] A should be in table[j-1,j] A word[j] (j-1,j) Recursion Rule: A B C (i,j) A If you find a k such that B is in table[i,k], and C is in table[k,j], then A should be in table[i,j] B (i,k) C (k,j) CS 295: STATISTICAL NLP (WINTER 2017) 30

CKY Algorithm Book the flight through TWA CS 295: STATISTICAL NLP (WINTER 2017) 31

Outline Syntactic Parsing Context Free Grammars Parsing: CKY Algorithm CS 295: STATISTICAL NLP (WINTER 2017) 32

Upcoming Homework Homework 2 is due in a week: February 13, 2017 Homework 1 grades will be available tonight Project Proposal is due on tonight Only 2 pages Summaries Paper summaries: February 17, February 28, March 14 Only 1 page each CS 295: STATISTICAL NLP (WINTER 2017) 33