dependency grammars and parser
play

Dependency Grammars and Parser LING 571 Deep Processing for NLP - PowerPoint PPT Presentation

Dependency Grammars and Parser LING 571 Deep Processing for NLP October 16, 2019 Shane Steinert-Threlkeld 1 Ambiguity of the Week 2 Roadmap Dependency Grammars Definition Motivation: Limitations of Context-Free Grammars


  1. Dependency Grammars and Parser LING 571 — Deep Processing for NLP October 16, 2019 Shane Steinert-Threlkeld 1

  2. Ambiguity of the Week 2

  3. Roadmap ● Dependency Grammars ● Definition ● Motivation: ● Limitations of Context-Free Grammars ● Dependency Parsing ● By conversion to CFG ● By Graph-based models ● By transition-based parsing ● HW4 + Mid-term evaluation 3

  4. Dependency Grammar ● [P]CFGs : ● Phrase-Structure Grammars ● Focus on modeling constituent structure ● Dependency grammars : ● Syntactic structure described in terms of ● Words ● Syntactic/semantic relations between words 4

  5. Dependency Parse ● A Dependency parse is a tree,* where: ● Nodes correspond to words in string ● Edges between nodes represent dependency relations ● Relations may or may not be labeled (aka typed) ● *: in very special cases, can argue for cycles 5

  6. Dependency Parse Example: 
 They hid the letter on the shelf hid Argument Dependencies Abbreviation Description nsubj dobj nsubj nominal subject csubj clausal subject They letter dobj direct object iobj indirect object det on pobj object of preposition Modifier Dependencies shelf the Abbreviation Description det tmod temporal modifier appos appositional modifier det determiner the prep prepositional modifier 6

  7. Dependency Parse Example: 
 They hid the letter on the shelf hid Argument Dependencies Abbreviation Description nsubj dobj nsubj nominal subject csubj clausal subject They letter dobj direct object iobj indirect object det on pobj object of preposition Modifier Dependencies shelf the Abbreviation Description det tmod temporal modifier appos appositional modifier det determiner the prep prepositional modifier 7

  8. Dependency Parse Example: 
 They hid the letter on the shelf hid Argument Dependencies Abbreviation Description nsubj dobj nsubj nominal subject csubj clausal subject They letter dobj direct object iobj indirect object det on pobj object of preposition Modifier Dependencies shelf the Abbreviation Description det tmod temporal modifier appos appositional modifier det determiner the prep prepositional modifier 8

  9. Dependency Parse Example: 
 They hid the letter on the shelf hid Argument Dependencies Abbreviation Description nsubj dobj nsubj nominal subject csubj clausal subject They letter dobj direct object iobj indirect object det on pobj object of preposition Modifier Dependencies shelf the Abbreviation Description det tmod temporal modifier appos appositional modifier det determiner the prep prepositional modifier 9

  10. Alternative Representation 10

  11. Why Dependency Grammar? ● More natural representation for many tasks ● Clear encapsulation of predicate-argument structure ● Phrase structure may obscure, e.g. wh -movement ● Good match for question-answering, relation extraction ● Who did what to whom ? ● = ( Subject ) did ( theme ) to ( patient ) ● Helps with parallel relations between roles in questions , and roles in answers 11

  12. Why Dependency Grammar? ● Easier handling of flexible or free word order ● How does CFG handle variation in word order? S S PP NP VP NP VP PP Prep NP Pron Verb Adv Pron Verb Adv Prep NP N I called-in sick I called-in sick on N On Tuesday Tuesday S → PP NP VP S → NP VP PP 12

  13. Why Dependency Grammar? ● English has relatively fixed word order ● Big problem for languages with freer word order S S PP NP VP NP VP PP Prep NP Pron Verb Adv Pron Verb Adv Prep NP N I called-in sick I called-in sick on N On Tuesday Tuesday S → PP NP VP S → NP VP PP 13

  14. Why Dependency Grammar? ● How do dependency structures represent the difference? ● Same structure ● Relationships are between words, order insensitive called-in I sick on = temporal modifier Tuesday I called in sick on Tuesday 14

  15. Why Dependency Grammar? ● How do dependency structures represent the difference? ● Same structure ● Relationships are between words, order insensitive call-in did I sick when = temporal modifier when did I call in sick? 15

  16. Natural Efficiencies ● Phrase Structures: ● Must derive full trees of many non-terminals ● Dependency Structures: ● For each word, identify ● Syntactic head, h ● Dependency label, d ● Inherently lexicalized ● Strong constraints hold between pairs of words 16

  17. Visualization ● Web demos: ● displaCy: https://explosion.ai/demos/displacy ● Stanford CoreNLP: http://corenlp.run/ ● spaCy and stanfordnlp Python packages have good built-in parsers ● LaTeX: tikz-dependency (https://ctan.org/pkg/tikz-dependency) 17

  18. Resources ● Universal Dependencies: ● Consistent annotation scheme (i.e. same POS, dependency labels) ● Treebanks for >70 languages ● Sizes: German, Czech, Japanese, Russian, French, Arabic, … 18

  19. Summary ● Dependency grammars balance complexity and expressiveness ● Sufficiently expressive to capture predicate-argument structure ● Sufficiently constrained to allow efficient parsing ● Still not perfect ● “On Tuesday I called in sick” vs. “I called in sick on Tuesday” ● These feel pragmatically different (e.g. topically), might want to represent difference syntactically. 19

  20. Roadmap ● Dependency Grammars ● Definition ● Motivation: ● Limitations of Context-Free Grammars ● Dependency Parsing ● By conversion from CFG ● By Graph-based models ● By transition-based parsing 20

  21. Conversion: PS → DS ● Can convert Phrase Structure (PS) to Dependency Structure (DS) ● …without the dependency labels ● Algorithm: ● Identify all head children in PS ● Make head of each non-head-child depend on head of head-child ● Use a head percolation table to determine headedness 21

  22. Conversion: PS → DS 22

  23. Conversion: PS → DS had news impact economic little on markets financial 23

  24. Conversion: PS → DS had news 24

  25. Conversion: PS → DS had news economic 25

  26. Conversion: PS → DS had impact news economic 26

  27. Conversion: PS → DS had impact news economic little 27

  28. Conversion: PS → DS had impact news on economic little 28

  29. Conversion: PS → DS had impact news on economic little markets 29

  30. Conversion: PS → DS had impact news on economic little markets financial 30

  31. Head Percolation Table ● Finding the head of an NP: ● If the rightmost word is preterminal, return ● …else search Right → Left for first child which is NN, NNP, NNPS… ● …else search Left → Right for first child which is NP ● …else search Right → Left for first child which is $, ADJP, PRN ● …else search Right → Left for first child which is CD ● …else search Right → Left for first child which is JJ, JJS, RB or QP ● …else return rightmost word. From J&M Page 411, via Collins (1999) 31

  32. Conversion: DS → PS ● Can map any projective dependency tree to PS tree ● Projective: ● Does not contain “crossing” dependencies w.r.t. word order root punc tmp att issue att sbj vc att A hearing is scheduled on the issue today . 32

  33. Non-Projective DS is hearing scheduled . on today A = Projection issue the A hearing is scheduled on the issue today . 33

  34. Projective DS had news effect . Economic little on = Projection markets financial Economic news had little effect on financial markets . 34

  35. More Non-Projective Parses root John saw a dog yesterday which was a Yorkshire Terrier root O to nové většinou nemá ani zájem a taky na to většinou nemá peníze He is mostly not even interested in the new things and in most cases, he has no money for it either. From McDonald et. al, 2005 35

  36. Conversion: DS → PS ● For each node w with outgoing arcs… ● …convert the subtree w and its dependents t 1 ,…, t n to a new subtree: ● Nonterminal: X w ● Child: w ● Subtrees t 1 ,…, t n in original sentence order 36

  37. Conversion: DS → PS root punc obj pc att sbj att att att Economic news had little effect on financial markets . 37

  38. Conversion: DS → PS root punc obj pc att sbj att att att Economic news had little effect on financial markets . 38

  39. Conversion: DS → PS root punc obj pc att sbj att att att Economic news had little effect on financial markets . 39

  40. Conversion: DS → PS root punc obj pc att sbj att att att Economic news had little effect on financial markets . 40

  41. Conversion: DS → PS ● What about labeled dependencies? ● Can attach labels to nonterminals associated with non-heads ● e.g. X little → X little:nmod ● Doesn’t create typical PS trees ● Does create fully lexicalized, labeled, context-free trees ● Can be parsed with any standard CFG parser 41

  42. ROOT X barked root X dog barked X at X . at X cat . X the dog The dog barked at the cat . X the cat the the Example from J. Moore, 2013 42

  43. Roadmap ● Dependency Grammars ● Definition ● Motivation: ● Limitations of Context-Free Grammars ● Dependency Parsing ● By conversion to CFG ● By Graph-based models ● By transition-based parsing 43

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend