1 Context Free Grammars October 2008. 2 Syntactic Grammaticality Doesn’t depend on Having heard the sentence before The sentence being true –I saw a unicorn.

Slides:



Advertisements
Similar presentations
Introduction to Syntax and Context-Free Grammars Owen Rambow
Advertisements

Introduction to Syntax, with Part-of-Speech Tagging Owen Rambow September 17 & 19.
1 Context Free Grammars Chapter 12 (Much influenced by Owen Rambow) September 2012 Lecture #5.
Syntax and Context-Free Grammars Julia Hirschberg CS 4705 Slides with contributions from Owen Rambow, Kathy McKeown, Dan Jurafsky and James Martin.
Syntactic analysis using Context Free Grammars. Analysis of language Morphological analysis – Chairs, Part Of Speech (POS) tagging – The/DT man/NN left/VBD.
Context-Free Grammars Julia Hirschberg CS 4705 Slides with contributions from Owen Rambow, Kathy McKeown, Dan Jurafsky and James Martin.
Introduction to Syntax Owen Rambow September 30.
Introduction to Syntax Owen Rambow September
Introduction to Syntax Owen Rambow October
What is Syntax?  The rules that govern the structure of utterances; also called grammar  The basic organization of sentences is around syntax  build.
Matakuliah: G0922/Introduction to Linguistics Tahun: 2008 Session 11 Syntax 2.
Introduction to Syntax, with Part-of-Speech Tagging Owen Rambow September 17 & 19.
Introduction to Syntax and Context-Free Grammars Owen Rambow September
1 CONTEXT-FREE GRAMMARS. NLE 2 Syntactic analysis (Parsing) S NPVP ATNNSVBD NP AT NNthechildrenate thecake.
Lect. 11Phrase structure rules Learning objectives: To define phrase structure rules To learn the forms of phrase structure rules To compose new sentences.
Linguistics II Syntax. Rules of how words go together to form sentences What types of words go together How the presence of some words predetermines others.
Context-Free Grammar CSCI-GA.2590 – Lecture 3 Ralph Grishman NYU.
The students will be able to know:
Dr. Ansa Hameed Syntax (4).
Models of Generative Grammar Smriti Singh. Generative Grammar  A Generative Grammar is a set of formal rules that can generate an infinite set of sentences.
Linguistic Theory Lecture 2 Phrase Structure. What was there before structure? Classical studies: Classical studies: –Languages such as Latin Rich morphology.
Constituency Tests Phrase Structure Rules
Phonetics, Phonology, Morphology and Syntax
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.
School of something FACULTY OF OTHER School of Computing FACULTY OF ENGINEERING COMP3310 Natural Language Processing Eric Atwell, Language Research Group.
Context Free Grammars Reading: Chap 12-13, Jurafsky & Martin This slide set was adapted from J. Martin and Rada Mihalcea.
Creativity of Language
TEORIE E TECNICHE DEL RICONOSCIMENTO Linguistica computazionale in Python: -Analisi sintattica (parsing)
1 CPE 480 Natural Language Processing Lecture 5: Parser Asst. Prof. Nuttanart Facundes, Ph.D.
1 Words and rules Linguistics lecture #2 October 31, 2006.
CFGS – TAKE 2 David Kauchak CS30 – Spring Admin Today’s mentor hours moved to 6-8pm Assignment 4 graded Assignment 5 - how’s it going? - part A.
Natural Language Processing Lecture 6 : Revision.
THE BIG PICTURE Basic Assumptions Linguistics is the empirical science that studies language (or linguistic behavior) Linguistics proposes theories (models)
GRAMMARS David Kauchak CS159 – Fall 2014 some slides adapted from Ray Mooney.
Chapter 12: FORMAL GRAMMARS OF ENGLISH Heshaam Faili University of Tehran.
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.
1 LIN6932 Spring 2007 LIN6932 Topics in Computational Linguistics Lecture 6: Grammar and Parsing (I) February 15, 2007 Hana Filip.
For Wednesday Read chapter 23 Homework: –Chapter 22, exercises 1,4, 7, and 14.
Parsing with Context-Free Grammars for ASR Julia Hirschberg CS 4706 Slides with contributions from Owen Rambow, Kathy McKeown, Dan Jurafsky and James Martin.
CPE 480 Natural Language Processing Lecture 4: Syntax Adapted from Owen Rambow’s slides for CSc Fall 2006.
Rules, Movement, Ambiguity
1 Context Free Grammars Chapter 9 (Much influenced by Owen Rambow) October 2009 Lecture #7.
CS 4705 Lecture 7 Parsing with Context-Free Grammars.
CPSC 422, Lecture 27Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 27 Nov, 16, 2015.
Natural Language Processing Lecture 14—10/13/2015 Jim Martin.
SYNTAX.
3 Phonology: Speech Sounds as a System No language has all the speech sounds possible in human languages; each language contains a selection of the possible.
◦ Process of describing the structure of phrases and sentences Chapter 8 - Phrases and sentences: grammar1.
GRAMMARS David Kauchak CS457 – Spring 2011 some slides adapted from Ray Mooney.
Language and Cognition Colombo, June 2011 Day 2 Introduction to Linguistic Theory, Part 3.
CSA3050: NLP Algorithms Sentence Grammar NLP Algorithms.
Lecturer: Abrar Mujaddidi LANE 321 P HRASES AND S ENTENCES : G RAMMAR.
Lecturer : Ms. Abrar Mujaddidi S YNTAX. I NTRODUCTION  In the previous chapter, we moved from the general categories and concepts of traditional grammar,
SYNTAX.
King Faisal University جامعة الملك فيصل Deanship of E-Learning and Distance Education عمادة التعلم الإلكتروني والتعليم عن بعد [ ] 1 King Faisal University.
Syntax An Overview and Implications for Instruction Jayne Jaskolski Sue Saynay Rosalie Schatzman Julie Steuber.
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
Introduction to Syntax and Context-Free Grammars
Beginning Syntax Linda Thomas
Basic Parsing with Context Free Grammars Chapter 13
Chapter Eight Syntax.
CSC NLP -Context-Free Grammars
Introduction to Syntax and Context-Free Grammars cs
What is Syntax?  The rules that govern the structure of utterances; also called grammar  The basic organization of sentences is around syntax  build.
Chapter Eight Syntax.
Introduction to Linguistics
Introduction to Syntax
David Kauchak CS159 – Spring 2019
Presentation transcript:

1 Context Free Grammars October 2008

2 Syntactic Grammaticality Doesn’t depend on Having heard the sentence before The sentence being true –I saw a unicorn yesterday The sentence being meaningful –Colorless green ideas sleep furiously –*Furiously sleep ideas green colorless –I sperred a couple of gurpy fipps. Grammatically is a formal property that we can investigate and describe

3 Syntax By syntax, we mean various aspects of how words are strung together to form components of sentences and how those components are strung together to form sentences New Concept: Constituency Groups of words may behave as a single unit or constituent E.g., noun phrases Evidence –Whole group appears in similar syntactic environment –E.g., before a verb –Preposed/postposed constructions –Note: notions of meaning play no role in syntax (sort-of)

4 What is Syntax? Study of structure of language Specifically, goal is to relate surface form (e.g., interface to phonological component) to semantics (e.g., interface to semantic component) Morphology, phonology, semantics farmed out (mainly), issue is word order and structure Representational device is tree structure

5 Types of Linguistic Activity Descriptive: provide account of syntax of a language; often good enough for NLP engineering work Explanatory: provide principles-and-parameters style account of syntax of (preferably) several languages Prescriptive: “prescriptive linguistics” is an oxymoron

6 Structure in Strings Some words: the a small nice big very boy girl sees likes Some good sentences: –the boy likes a girl –the small girl likes the big girl –a very small nice boy sees a very nice boy Some bad sentences: –*the boy the girl –*small boy likes nice girl Can we find subsequences of words (constituents) which in some way behave alike?

7 Structure in Strings Proposal Some words: the a small nice big very boy girl sees likes Some good sentences: –(the boy) likes (a girl) –(the small girl) likes (the big girl) –(a very small nice boy) sees (a very nice boy) Some bad sentences: –*(the boy) (the girl) –*(small boy) likes (the nice girl) This is a reasonable proposal: seems to capture some generality

8 More Structure in Strings Proposal -- ctd Some words: the a small nice big very boy girl sees likes Some good sentences: –((the) boy) likes ((a) girl) –((the) (small) girl) likes ((the) (big) girl) –((a) ((very) small) (nice) boy) sees ((a) ((very) nice) girl) Some bad sentences: –*((the) boy) ((the) girl) –*((small) boy) likes ((the) (nice) girl)

9 From Substrings to Trees (((the) boy) likes ((a) girl)) boy the likes girl a

10 Node Labels? ( ((the) boy) likes ((a) girl) ) Group words by distribution of constituents they head (part-of-speech, POS): –Noun (N), verb (V), adjective (Adj), adverb (Adv), determiner (Det) Category of constituent: XP, where X is POS –NP, S, AdjP, AdvP, DetP

11 Node Labels (((the/ Det ) boy/ N ) likes/ V ((a/ Det ) girl/ N )) boy the likes girl a DetP NP DetP S

12 Types of Nodes (((the/ Det ) boy/ N ) likes/ V ((a/ Det ) girl/ N )) boy the likes girl a DetP NP DetP S Phrase-structure tree nonterminal symbols = constituents terminal symbols = words

13 Context-Free Grammars Defined in formal language theory (comp sci) Terminals, nonterminals, start symbol, rules String-rewriting system Start with start symbol, rewrite using rules, done when only terminals left NOT A LINGUISTIC THEORY, just a formal device

14 CFG: Example Many possible CFGs for English, here is an example (fragment): –S  NP VP –VP  V NP –NP  DetP N | DetP AdjP N –AdjP  Adj | Adv AdjP –N  boy | girl –V  sees | likes –Adj  big | small –Adv  very –DetP  a | the the very small boy likes a girl

15 Derivations in a CFG S  NP VP VP  V NP NP  DetP N | DetP AdjP N AdjP  Adj | Adv AdjP N  boy | girl V  sees | likes Adj  big | small Adv  very DetP  a | the S S

16 Derivations in a CFG S  NP VP VP  V NP NP  DetP N | DetP AdjP N AdjP  Adj | Adv AdjP N  boy | girl V  sees | likes Adj  big | small Adv  very DetP  a | the NP VP NP S VP

17 Derivations in a CFG S  NP VP VP  V NP NP  DetP N | DetP AdjP N AdjP  Adj | Adv AdjP N  boy | girl V  sees | likes Adj  big | small Adv  very DetP  a | the DetP N VP DetP NP S VP N

18 Derivations in a CFG S  NP VP VP  V NP NP  DetP N | DetP AdjP N AdjP  Adj | Adv AdjP N  boy | girl V  sees | likes Adj  big | small Adv  very DetP  a | the the boy VP boy the DetP NP S VP N

19 Derivations in a CFG S  NP VP VP  V NP NP  DetP N | DetP AdjP N AdjP  Adj | Adv AdjP N  boy | girl V  sees | likes Adj  big | small Adv  very DetP  a | the the boy likes NP boythelikes DetP NP S VP N V

20 Derivations in a CFG S  NP VP VP  V NP NP  DetP N | DetP AdjP N AdjP  Adj | Adv AdjP N  boy | girl V  sees | likes Adj  big | small Adv  very DetP  a | the the boy likes a girl boythelikes DetP NP girl a NP DetP S VP N N V

21 Derivations in a CFG; Order of Derivation Irrelevant S  NP VP VP  V NP NP  DetP N | DetP AdjP N AdjP  Adj | Adv AdjP N  boy | girl V  sees | likes Adj  big | small Adv  very DetP  a | the NP likes DetP girl likes NP girl NP DetP S VP N V

22 Key Constituents (English) Sentences Noun phrases Verb phrases Prepositional phrases

23 Recursion We’ll have to deal with rules such as the following where the non-terminal on the left also appears somewhere on the right (directly). NP -> NP PP[[The flight] [to Boston]] VP -> VP PP[[departed Miami] [at noon]]

24 Recursion Can make things interesting. Consider the rule: NP -> NP PP flights from Denver flights from Denver to Miami flights from Denver to Miami in February flights from Denver to Miami in February on a Friday flights from Denver to Miami in February on a Friday under $300 flights from Denver to Miami in February on a Friday under $300 with lunch

25 Recursion [[flights] [from Denver]] [[[flights] [from Denver]] [to Miami]] [[[[flights] [from Denver]] [to Miami]] [in February]] [[[[[flights] [from Denver]] [to Miami]] [in February]] [on a Friday]] Etc.

26 The Point If you have a rule like –VP -> V NP –It only cares that the thing after the verb is an NP. It doesn’t have to know about the internal affairs of that NP

27 The Point VP -> V NP I hate flights from Denver flights from Denver to Miami flights from Denver to Miami in February flights from Denver to Miami in February on a Friday flights from Denver to Miami in February on a Friday under $300 flights from Denver to Miami in February on a Friday under $300 with lunch