600.465 - Intro to NLP - J. Eisner1 Syntactic Attributes Morphology, heads, gaps, etc. Note: The properties of nonterminal symbols are often called “features.”

Slides:



Advertisements
Similar presentations
Welcome to English 2 When Actions Happen Names of Words
Advertisements

Intro to NLP - J. Eisner1 Learning in the Limit Golds Theorem.
The Perfect Tenses, Part 1. The Present Perfect What does it look like?
Present Perfect Simple & Continuous
Intro to NLP - J. Eisner1 Modeling Grammaticality [mostly a blackboard lecture]
Medieval Art Skills and Principles
 Christel Kemke 2007/08 COMP 4060 Natural Language Processing Feature Structures and Unification.
Lexical Functional Grammar History: –Joan Bresnan (linguist, MIT and Stanford) –Ron Kaplan (computational psycholinguist, Xerox PARC) –Around 1978.
Grammars, constituency and order A grammar describes the legal strings of a language in terms of constituency and order. For example, a grammar for a fragment.
Long Distance Dependencies (Filler-Gap Constructions) and Relative Clauses October 10, : Grammars and Lexicons Lori Levin (Examples from Kroeger.
Grammatical Relations and Lexical Functional Grammar Grammar Formalisms Spring Term 2004.
GRAMMAR & PARSING (Syntactic Analysis) NLP- WEEK 4.
Intro to NLP - J. Eisner1 Syntactic Features Morphology, heads, gaps, etc.
Natural Language Processing - Feature Structures - Feature Structures and Unification.
Honors Compilers An Introduction to Grammars Feb 12th 2002.
Episode 8a. Passives and remaining issues CAS LX 522 Syntax I.
 Christel Kemke 2007/08 COMP 4060 Natural Language Processing Feature Structures and Unification.
Introduction to Syntax, with Part-of-Speech Tagging Owen Rambow September 17 & 19.
1 Introduction to Computational Linguistics Eleni Miltsakaki AUTH Fall 2005-Lecture 2.
Natural Language Query Interface Mostafa Karkache & Bryce Wenninger.
1 CONTEXT-FREE GRAMMARS. NLE 2 Syntactic analysis (Parsing) S NPVP ATNNSVBD NP AT NNthechildrenate thecake.
1 CSC 594 Topics in AI – Applied Natural Language Processing Fall 2009/ Outline of English Syntax.
Syntax: Part II More Structures.
The students will be able to know:
Verbs What IS a verb? Basically, it’s shows action. Verbs can be words like run, jump, eat, drive, etc. In order to be proper, all sentences MUST contain.
Unit One: Parts of Speech
VERBS.
Linguistic Theory Lecture 3 Movement. A brief history of movement Movements as ‘special rules’ proposed to capture facts that phrase structure rules cannot.
11 CS 388: Natural Language Processing: Syntactic Parsing Raymond J. Mooney University of Texas at Austin.
ASL 1 Unit 5 Talking About Activities MRS. SHELDON CREEKVIEW HIGH SCHOOL.
Syntax The number of words in a language is finite
Embedded Clauses in TAG
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.
1 Features and Unification Chapter 15 October 2012 Lecture #10.
Extending X-bar Theory DPs, TPs, and CPs. The Puzzle of Determiners  Specifier RuleXP  (YP) X’ – requires the specifier to be phrasal – *That the book.
LING 388: Language and Computers Sandiway Fong Lecture 17.
1 Statistical Parsing Chapter 14 October 2012 Lecture #9.
Some Probability Theory and Computational models A short overview.
LING 388: Language and Computers Sandiway Fong Lecture 18.
Verb tenses.
Context Free Grammars Reading: Chap 9, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Rada Mihalcea.
Verbals. A gerund is a verbal that ends in -ing and functions as a noun. The term verbal indicates that a gerund, like the other two kinds of verbals,
ENGLISH SYNTAX Introduction to Transformational Grammar.
Parsing Introduction Syntactic Analysis I. Parsing Introduction 2 The Role of the Parser The Syntactic Analyzer, or Parser, is the heart of the front.
Action Verbs 1. Examples: Mary likes chocolate. John went to the store. Words that express the action in a sentence. Tells what someone or something does(present),
Rules, Movement, Ambiguity
1 LIN 1310B Introduction to Linguistics Prof: Nikolay Slavkov TA: Qinghua Tang CLASS 16, March 6, 2007.
CPSC 422, Lecture 27Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 27 Nov, 16, 2015.
1 Introduction to Computational Linguistics Eleni Miltsakaki AUTH Spring 2006-Lecture 2.
◦ Process of describing the structure of phrases and sentences Chapter 8 - Phrases and sentences: grammar1.
SYNTAX 1 NOV 9, 2015 – DAY 31 Brain & Language LING NSCI Fall 2015.
1 Some English Constructions Transformational Framework October 2, 2012 Lecture 7.
Expanding verb phrases
Grammar 101 How to be awesome. Clauses A clause has a subject/verb form. A subject is who or what is doing the stuff. A verb is what is being done by.
Week 3. Clauses and Trees English Syntax. Trees and constituency A sentence has a hierarchical structure Constituents can have constituents of their own.
Week 12. NP movement Text 9.2 & 9.3 English Syntax.
Lecture 1 Sentences Verbs.
Week 10 X-bar syntax: More on Clauses English Syntax.
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
Non-finite forms of the verb
Morphology, heads, gaps, etc.
Week 10 X-bar syntax: More on Clauses
Modeling Grammaticality
ALL ABOUT VERBS GRAMMAR SUMMARY.
Writing: Grammar and Usage
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
Theory of Computation Languages.
LING/C SC/PSYC 438/538 Lecture 24 Sandiway Fong.
Modeling Grammaticality
Presentation transcript:

Intro to NLP - J. Eisner1 Syntactic Attributes Morphology, heads, gaps, etc. Note: The properties of nonterminal symbols are often called “features.” However, we will use the alternative name “attributes.” (We’ll use “features” to refer only to the features that get weights in a machine learning model, e.g., a log-linear model.)

Intro to NLP - J. Eisner2 3 views of a context-free rule  generation (production): S  NP VP  parsing (comprehension): S  NP VP  verification (checking): S = NP VP  Today you should keep the third, declarative perspective in mind.  Each phrase has  an interface (S) saying where it can go  an implementation (NP VP) saying what’s in it  To let the parts of the tree coordinate more closely with one another, enrich the interfaces: S[attributes…] = NP[attributes…] VP[attributes…]

Intro to NLP - J. Eisner3 Examples NPVerb VPNP S A roller coaster thrills every teenager Verb  thrills VP  Verb NP S  NP VP

Intro to NLP - J. Eisner4 morphology of a single word: Verb [head=thrill, tense=present, num=sing, person=3,…]  thrills projection of attributes up to a bigger phrase VP [head= , tense= , num=  …]  V [head= , tense= , num=  …] NP provided  is in the set TRANSITIVE-VERBS agreement between sister phrases: S [head= , tense=  ]  NP [num= ,…] VP [head= , tense= , num=  …] 3 Common Ways to Use Attributes

Intro to NLP - J. Eisner5 3 Common Ways to Use Attributes NPVerb VPNP S A roller coaster thrills every teenager Verb [head=thrill, tense=present, num=sing, person=3,…]  thrills VP [head= , tense= , num=  …]  V [head= , tense= , num=  …] NP S [head= , tense=  ]  NP [num= ,…] VP [head= , tense= , num=  …] num=sing (generation perspective) thrills

Intro to NLP - J. Eisner6 NPVerb VPNP S A roller coaster thrills every teenager Verb [head=thrill, tense=present, num=sing, person=3,…]  thrills VP [head= , tense= , num=  …]  V [head= , tense= , num=  …] NP S [head= , tense=  ]  NP [num= ,…] VP [head= , tense= , num=  …] num=sing (comprehension perspective) num=sing thrills 3 Common Ways to Use Attributes

Det The N plan to VP V swallow NP Wanda V has V been V thrilling NP Otto NP VP S N

Det The N plan to VP V swallow NP Wanda V has V been V thrilling NP Otto NP VP S N [num=1] NP [n=1]  Det N [n=1] N [n=1]  N [n=1] VP N [n=1]  plan VP [n=1]  V [n=1] VP V [n=1]  has S  NP [n=1] VP [n=1]

Det The N plan to VP V swallow NP Wanda V has V been V thrilling NP Otto NP VP S N [num=1] NP [n=  ]  Det N [n=  ] N [n=  ]  N [n=  ] VP N [n=1]  plan VP [n=  ]  V [n=  ] VP V [n= 1 ]  has S  NP [n=  ] VP [n=  ]

Det The N plan to VP V swallow NP Wanda V has V been V thrilling NP Otto NP VP S N NP [h=  ]  Det N [h=  ] N [h=  ]  N [h=  ] VP N [h=plan]  plan [head=plan]

Det The N plan to VP V swallow NP Wanda V has V been V thrilling NP Otto NP VP S N NP [h=  ]  Det N [h=  ] N [h=  ]  N [h=  ] VP N [h=plan]  plan [head=plan] [head=swallow][head=Wanda] [head=Otto][head=swallow] [head=thrill]

Det The N plan to VP V swallow NP Wanda V has V been V thrilling NP Otto NP VP S N NP [h=  ]  Det N [h=  ] N [h=  ]  N [h=  ] VP N [h=plan]  plan [head=plan] [head=swallow][head=Wanda] [head=Otto][head=swallow] [head=thrill]  Morphology (e.g.,word endings)  N [h=plan,n=1]  plan N [h=plan,n=2+]  plans  N [h=thrill,tense=prog]  thrilling N [h=thrill,tense=past]  thrilled N [h=go,tense=past]  went  Why use heads?

Det The N plan to VP V swallow NP Wanda V has V been V thrilling NP Otto NP VP S N NP [h=  ]  Det N [h=  ] N [h=  ]  N [h=  ] VP N [h=plan]  plan [head=plan] [head=swallow][head=Wanda] [head=Otto][head=swallow] [head=thrill]  Subcategorization (i.e., transitive vs. intransitive)  When is VP  V NP ok? VP [h=  ]  V [h=  ] NP restrict to   TRANSITIVE_VERBS  When is N  N VP ok? N [h=  ]  N [h=  ] VP restrict to   {plan, plot, hope,…}  Why use heads?

Det The N plan to VP V swallow NP Wanda V has V been V thrilling NP Otto NP VP S N NP [h=  ]  Det N [h=  ] N [h=  ]  N [h=  ] VP N [h=plan]  plan [head=plan] [head=swallow][head=Wanda] [head=Otto][head=swallow] [head=thrill]  Selectional restrictions  VP [h=  ]  V [h=  ] NP  I.e., VP [h=  ]  V [h=  ] NP [h=  ]  Don’t fill template in all ways: VP [h=thrill]  V [h=thrill] NP [h=Otto] *VP [h=thrill]  V [h=thrill] NP [h=plan]  Why use heads? leave out, or low prob

Log-Linear Models of Rule Probabilities  What is the probability of this rule? S[head=thrill, tense=pres, animate=no…]  NP[head=plan, num=1, …] VP[head=thrill, tense=pres, num=1, …]  We have many related rules.  p(NP[…] VP[…] | S[…]) = (1/Z) exp  k  k  f k (S[…]  NP[…] VP[…])  We are choosing among all rules that expand S[…].  If a rule has positively-weighted features, they raise its probability. Negatively-weighted features lower it.  Which features fire will depend on the attributes!

Log-Linear Models of Rule Probabilities S[head=thrill, tense=pres, …]  NP[head=plan, num=1, animate=no, …] VP[head=thrill, tense=pres, num=1, …]  Some features that might fire on this …  The raw rule without attributes is S  NP VP.  Is that good? Does this feature have positive weight?  The NP and the VP agree in number. Is that good?  The head of the NP is “plan.” Is that good?  The verb “thrill” will get a subject.  The verb “thrill” will get an inanimate subject.  The verb “thrill” will get a subject headed by “plan.”  Is that good? Is “plan” a good subject for “thrill”?

Post-Processing  You don’t have to handle everything with tons of attributes on the nonterminals  Sometimes easier to compose your grammar with a post-processor: 1.Use your CFG + randsent to generate some convenient internal version of the sentence. 2.Run that sentence through a post-processor to clean it up for external presentation. 3.The post-processor can even fix stuff up across constituent boundaries! We’ll see a good family of postprocessors later: finite- state transducers.

’ll Simpler Grammar + Post-Processing CAPS we will meet CAPS smith, 59,, the chief,. NP proper Appositive NP Appositive NP Verb VP S NP ROOT We meet Smith,., the chief59 ROOT  CAPS S.NP proper  CAPS smith

already Simpler Grammar + Post-Processing CAPS CAPS smith already meet -ed me ’s child -s. NP proper NP genitive NP VP Adverb VP S ROOT met Smith Verb mychildren.

What Do These Enhancements Give You? And What Do They Cost?  In a sense, nothing and nothing!  Can automatically convert our new fancy CFG to an old plain CFG.  This is reassuring …  We haven’t gone off into cloud-cuckoo land where “ooh, look what languages I can invent.”  Even fancy CFGs can’t describe crazy non-human languages such as the language consisting only of prime numbers.  Because we already know that plain CFGs can’t do that.  We can still use our old algorithms, randsent and parse.  Just convert to a plain CFG and run the algorithms on that.  But we do get a benefit!  Attributes and post-processing allow simpler grammars.  Same log-linear features are shared across many rules.  A language learner thus has fewer things to learn.

Analogy: What Does Dyna Give You?  In a sense, nothing and nothing!  We can automatically convert our fancy Dyna program to plain old machine code.  This is reassuring …  A standard computer can still run Dyna. No special hardware or magic wands are required.  But we do get a benefit!  High-level programming languages allow shorter programs that are easier to write, understand, and modify.

What Do These Enhancements Give You? And What Do They Cost?  In a sense, nothing and nothing!  We can automatically convert our new fancy CFG to an old plain CFG.  Nonterminals with attributes  more nonterminals  S[head= , tense=  ]  NP[num= ,…] VP[head= , tense= , num=  …]  Can write out versions of this rule for all values of , ,   Now rename NP[num=1,…] to NP_num_1_...  So we just get a plain CFG with a ton of rules and nonterminals  Post-processing  more nonterminal attributes  Example: Post-processor changes “a” to “an” before a vowel  But we could handle this using a “starts with vowel” attribute instead  The determiner must “agree” with the vowel status of its Nbar  This kind of conversion can always be done! (automatically!)  At least for post-processors that are finite-state transducers  And then we can convert these attributes to nonterminals as above

Intro to NLP - J. Eisner23 Part of the English Tense System PresentPastFutureInfinitive Simple eatsatewill eatto eat Perfect has eaten had eaten will have eaten to have eaten progressive is eatingwas eating will be eating to be eating Perfect+ progressive has been eating had been eating will have been eating to have been eating

Tenses by Post-Processing: “Affix-hopping” (Chomsky) Mary jumpsMary [–s jump] Mary has jumpedMary [-s have] [-en jump] Mary is jumpingMary [-s be] [-ing jump] Mary has been jumpingMary [-s have] [-en be] [-ing jump] where -s denotes “3 rd person singular present tense” on following verb (by an –s suffix) -en denotes “past participle” (often uses –en or –ed suffix) -ing denotes “present participle” Etc. Agreement, meaning Could we instead describe the patterns via attributes?

The plan … V has V been NP VP S V thrilling NP Otto VP [head=plan] [head=Otto][tense=prog,head=thrill] [tense=prog, head=thrill] [tense=perf,head=thrill] [tense=pres,head=thrill]  Let’s distinguish the different kinds of VP by tense …

V thrills NP Otto [head=Otto] [tense=pres,head=thrill] The plan … NPVP S [head=plan][tense=pres,head=thrill]  Present tense past thrilled Past

V thrills NP Otto [head=Otto] [tense=pres,head=thrill] The plan … NPVP S [head=plan][tense=pres,head=thrill]  Present tense past thrilled Past eat ate

V thrills NP Otto [head=Otto] [tense=pres,head=thrill] The plan … NPVP S [head=plan][tense=pres,head=thrill]  Present tense (again)

The plan … NPVP S [head=plan][tense=pres,head=thrill] V has VP [tense=perf,head=thrill][tense=pres,head=have] V thrilled NP Otto [head=Otto] [tense=perf,head=thrill]  Present perfect tense

The plan … NPVP S [head=plan][tense=pres,head=thrill] V has VP [tense=perf,head=thrill][tense=pres,head=have] V thrilled NP Otto [head=Otto] [tense=perf,head=thrill]  Present perfect tense

The plan … NPVP S [head=plan][tense=pres,head=thrill] V has VP [tense=perf,head=thrill][tense=pres,head=have] V thrilled NP Otto [head=Otto] [tense=perf,head=thrill]  Present perfect tense eat eaten  The yellow material makes it a perfect tense – what effects? not ate – why?

The plan … NPVP S [head=plan][tense=pres,head=thrill] V has VP [tense=perf,head=thrill][tense=pres,head=have] V thrilled NP Otto [head=Otto] [tense=perf,head=thrill]  Present perfect tense past had Past

V thrills NP Otto [head=Otto] [tense=pres,head=thrill] The plan … NPVP S [head=plan][tense=pres,head=thrill]  Present tense (again)

The plan … NPVP S [head=plan][tense=pres,head=thrill] V is VP [tense=prog,head=thrill][tense=pres,head=be ] V thrilling NP Otto [head=Otto] [tense=prog,head=thrill]  Present progressive tense

The plan … NPVP S [head=plan][tense=pres,head=thrill] V is VP [tense=prog,head=thrill][tense=pres,head=be ] V thrilling NP Otto [head=Otto] [tense=prog,head=thrill]  Present progressive tense past was Past

The plan … NPVP S [head=plan][tense=pres,head=thrill] V has VP [tense=perf,head=thrill][tense=pres,head=have] V thrilled NP Otto [head=Otto] [tense=perf,head=thrill]  Present perfect tense (again)

The plan … V has V been NP VP S V thrilling NP Otto VP [head=plan] [head=Otto][tense=prog,head=thrill] [tense=prog, head=thrill] [tense=perf,head=thrill] [tense=pres,head=thrill] [tense=pres,head=have] [tense=perf,head=be]  Present perfect progressive tense

The plan … V has V been NP VP S V thrilling NP Otto VP [head=plan] [head=Otto][tense=prog,head=thrill] [tense=prog, head=thrill] [tense=perf,head=thrill] [tense=pres,head=thrill] [tense=pres,head=have] [tense=perf,head=be]  Present perfect progressive tense

The plan … V has V been NP VP S V thrilling NP Otto VP [head=plan] [head=Otto][tense=prog,head=thrill] [tense=prog, head=thrill] [tense=perf,head=thrill] [tense=pres,head=thrill] [tense=pres,head=have] [tense=perf,head=be]  Present perfect progressive tense past had Past

V has V been NP VP S V thrilling NP Otto VP [head=plan] [head=Otto][tense=prog,head=thrill] [tense=prog, head=thrill] [tense=perf,head=thrill] [tense=pres,head=thrill] [tense=pres,head=have] [tense=perf,head=be]  Present perfect progressive tense cond Conditional VP [tense=pres,head=thrill] cond The plan … VP [tense=stem,head=thrill] V would [tense=cond,head=will] stem have

V been VP V thrilling NP Otto VP [head=Otto][tense=prog,head=thrill] [tense=prog, head=thrill] [tense=perf,head=thrill] [tense=perf,head=be]  So what pattern do all progressives follow? V is VP V thrilling NP Otto VP [head=Otto][tense=prog,head=thrill] [tense=prog, head=thrill] [tense=pres,head=thrill] [tense=pres,head=be] V was VP V eating NP Otto VP [head=Otto][tense=prog,head=eat] [tense=prog, head=eat] [tense=past,head=eat] [tense=past,head=be]

V been [head=Otto][tense=prog,head=thrill] [tense=prog, head=thrill] [tense=perf,head=thrill] [tense=perf,head=be]  So what pattern do all progressives follow? V is VP V thrilling NP Otto VP [head=Otto][tense=prog,head=thrill] [tense=prog, head=thrill] [tense=pres,head=thrill] [tense=pres,head=be] V was VP V eating NP Otto VP [head=Otto][tense=prog,head=eat] [tense=prog, head=eat] [tense=past,head=eat] [tense=past,head=be]      VP V -ing NP Otto VP

V been [head=Otto][tense=prog,head=thrill] [tense=prog, head=thrill] [tense=perf,head=thrill] [tense=perf,head=be] Progressive:VP [tense= , head= , …]  V [tense= , stem=be …] VP [tense=prog, head=  …] Perfect:VP [tense= , head= , …]  V [tense= , stem=have …] VP [tense=perf, head=  …] Future orVP [tense= , head= , …]  V [tense= , stem=will …] conditional:VP [tense=stem, head=  …] Infinitive:VP [tense=inf, head= , …]  to VP [tense=stem, head=  …] Etc. As well as the “ordinary” rules: VP[tense= , head= , …]  V[tense= , head= , …] NP V[tense=past, head=have …]  had      VP V -ing NP Otto VP

Intro to NLP - J. Eisner44 Gaps (“deep” grammar!)  Pretend “kiss” is a pure transitive verb.  Is “the president kissed” grammatical?  If so, what type of phrase is it?  the sandwich that  I wonder what  What else has the president kissed e Sally said the president kissed e Sally consumed the pickle with e Sally consumed e with the pickle

Intro to NLP - J. Eisner45 Gaps  Object gaps:  the sandwich that  I wonder what  What else has the president kissed e Sally said the president kissed e Sally consumed the pickle with e Sally consumed e with the pickle  Subject gaps:  the sandwich that  I wonder what  What else has e kissed the president Sally said e kissed the president [how could you tell the difference?]

Intro to NLP - J. Eisner46 Gaps  All gaps are really the same – a missing NP:  the sandwich that  I wonder what  What else has the president kissed e Sally said the president kissed e Sally consumed the pickle with e Sally consumed e with the pickle Phrases with missing NP: X[missing=NP] or just X/NP for short e kissed the president Sally said e kissed the president

NP what S/NP VP CP NP he VP/NP V was VP/NP V wonder [wh=yes] NP what NP V was V kissing NP him VP S CP [wh=yes] VP V wonder V kissing NP/NP what else could go here? e what else could go here? [wh=yes] /NP e

NP what S/NP VP CP NP he VP/NP V was VP/NP V wonder [wh=yes] Comp that V was V kissing NP VP S CP [wh=no] NP the sandwich V kissing NP/NP what else could go here? e what else could go here? [wh=yes] NP he /NP e

NP what S/NP VP CP NP he VP/NP V was VP/NP V wonder [wh=yes] Comp that V was V kissing NP the sandwich VP S CP [wh=no] VP V believe V kissing NP/NP what else could go here? e what else could go here? [wh=yes] NP he

Comp that V was V kissing NP VP S CP [wh=no] NP the sandwich NP he /NP e To indicate what fills a gap, people sometimes “coindex” the gap and its filler. i i i i i i i  Each phrase has a unique index such as “i”.  In some theories, coindexation is used to help extract a meaning from the tree.  In other theories, it is just an aid to help you follow the example. the money i I spend e i on the happiness j I hope to buy e j which violin i is this sonata j easy to play e j on e i

 Lots of attributes (tense, number, person, gaps, vowels, commas, wh, etc., etc....)  Sorry, that’s just how language is …  You know too much to write it down easily! He gone has