algorithms for nlp
play

Algorithms for NLP CS 11-711 Fall 2020 Lecture 11: Syntactic - PowerPoint PPT Presentation

Algorithms for NLP CS 11-711 Fall 2020 Lecture 11: Syntactic parsing and context-free grammars Emma Strubell Announcements Fridays recitation will be a P2 Q&A + questions to work through. 2 Ambiguity I saw the woman with the


  1. Dependency parsing root dobj Recovering shallow semantics poss det nsubj My dog ate a sausage root D PN N V N ■ Some semantic information can be (approximately) derived from syntactic information ■ Subjects (nsubj) are (often) agents : initiators / doers of an action ■ Direct objects (dobj) are (often) patients : affected entities ■ Even for agents and patients, consider: ■ Mary is baking a cake in the oven 12

  2. Dependency parsing root dobj Recovering shallow semantics poss det nsubj My dog ate a sausage root D PN N V N ■ Some semantic information can be (approximately) derived from syntactic information ■ Subjects (nsubj) are (often) agents : initiators / doers of an action ■ Direct objects (dobj) are (often) patients : affected entities ■ Even for agents and patients, consider: ■ Mary is baking a cake in the oven ■ A cake is baking in the oven 12

  3. Dependency parsing root dobj Recovering shallow semantics poss det nsubj My dog ate a sausage root D PN N V N ■ Some semantic information can be (approximately) derived from syntactic information ■ Subjects (nsubj) are (often) agents : initiators / doers of an action ■ Direct objects (dobj) are (often) patients : affected entities ■ Even for agents and patients, consider: ■ Mary is baking a cake in the oven ■ A cake is baking in the oven ■ In general, it is not trivial even for the most shallow forms of semantics 12

  4. Dependency parsing root dobj Recovering shallow semantics poss det nsubj My dog ate a sausage root D PN N V N ■ Some semantic information can be (approximately) derived from syntactic information ■ Subjects (nsubj) are (often) agents : initiators / doers of an action ■ Direct objects (dobj) are (often) patients : affected entities ■ Even for agents and patients, consider: ■ Mary is baking a cake in the oven ■ A cake is baking in the oven ■ In general, it is not trivial even for the most shallow forms of semantics ■ e.g. prepositions: in can encode direction, position, temporal information, … 12

  5. Constituency and dependency representations 13

  6. Constituency and dependency representations ■ Constituency trees can (potentially) be converted to dependency trees. 13

  7. Constituency and dependency representations ■ Constituency trees can (potentially) be converted to dependency trees. ■ Dependency trees can (potentially) be converted to constituency trees. 13

  8. Constituency trees ■ Internal nodes correspond to phrases . ■ S : a sentence ■ NP (noun phrase): My dog, a sandwich, lakes, … ■ VP (verb phrase): ate a sausage, barked, … ■ PP (prepositional phrases): with a friend, in a car, … ■ Nodes immediately above words are part-of-speech tags (or preterminals ). ■ PN : pronoun ■ D : determiner ■ V : verb ■ N : noun ■ P : preposition 14

  9. Constituency tests 15

  10. Constituency tests ■ How do we know what nodes go in the tree? 15

  11. Constituency tests ■ How do we know what nodes go in the tree? ■ Classic constituency tests: 15

  12. Constituency tests ■ How do we know what nodes go in the tree? ■ Classic constituency tests: ■ Replacement 15

  13. Constituency tests ■ How do we know what nodes go in the tree? ■ Classic constituency tests: ■ Replacement ■ Substitution by proform 15

  14. Constituency tests ■ How do we know what nodes go in the tree? ■ Classic constituency tests: ■ Replacement ■ Substitution by proform ■ Movement: Clefting, preposing, passive 15

  15. Constituency tests ■ How do we know what nodes go in the tree? ■ Classic constituency tests: ■ Replacement ■ Substitution by proform ■ Movement: Clefting, preposing, passive ■ Modification 15

  16. Constituency tests ■ How do we know what nodes go in the tree? ■ Classic constituency tests: ■ Replacement ■ Substitution by proform ■ Movement: Clefting, preposing, passive ■ Modification ■ Coordination / conjunction 15

  17. Constituency tests ■ How do we know what nodes go in the tree? ■ Classic constituency tests: ■ Replacement ■ Substitution by proform ■ Movement: Clefting, preposing, passive ■ Modification ■ Coordination / conjunction ■ Ellipsis / deletion 15

  18. Conflicting tests 16

  19. Conflicting tests ■ Constituency is not always clear. 16

  20. Conflicting tests ■ Constituency is not always clear. ■ Coordination: He went to and came from the store. 16

  21. Conflicting tests ■ Constituency is not always clear. ■ Coordination: He went to and came from the store. ■ Phonological reduction: I will go → I’ll go I want to go → I wanna go a le centre → au centre La velocité des ondes sismiques 16

  22. Morphology + syntax + semantics 17

  23. Morphology + syntax + semantics ■ Syntax : The study of the patterns of formation of sentences and phrases from a word. 17

  24. Morphology + syntax + semantics ■ Syntax : The study of the patterns of formation of sentences and phrases from a word. ■ Borders with semantics and morphology are sometimes blurred. 17

  25. Morphology + syntax + semantics ■ Syntax : The study of the patterns of formation of sentences and phrases from a word. ■ Borders with semantics and morphology are sometimes blurred. Afyonkarahisarlıla ş tırabildiklerimizdenmi ş sinizcesinee 17

  26. Morphology + syntax + semantics ■ Syntax : The study of the patterns of formation of sentences and phrases from a word. ■ Borders with semantics and morphology are sometimes blurred. Afyonkarahisarlıla ş tırabildiklerimizdenmi ş sinizcesinee as if you are one of the people that we thought to be originating from Afyonkarahisar 17

  27. Context-free grammars (CFGs) 18

  28. Context-free grammars (CFGs) ■ Context-free grammars (CFGs) : a formalism for parsing. 18

  29. Context-free grammars (CFGs) ■ Context-free grammars (CFGs) : a formalism for parsing. Grammar (CFG) ROOT → S NP → NP PP S → NP VP VP → VBP NP NP → DT NN VP → VBP NP PP NP → NN NNS PP → IN NP 18

  30. Context-free grammars (CFGs) ■ Context-free grammars (CFGs) : a formalism for parsing. Grammar (CFG) Lexicon ROOT → S NP → NP PP NN → interest S → NP VP VP → VBP NP NNS → raises VBP → interest NP → DT NN VP → VBP NP PP VBP → raises NP → NN NNS PP → IN NP … 18

  31. Context-free grammars (CFGs) ■ Context-free grammars (CFGs) : a formalism for parsing. Grammar (CFG) Lexicon ROOT → S NP → NP PP NN → interest S → NP VP VP → VBP NP NNS → raises VBP → interest NP → DT NN VP → VBP NP PP VBP → raises NP → NN NNS PP → IN NP … ■ Other grammar formalisms: LFG, HPSG, TAG, CCG, … 18

  32. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 19

  33. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 20

  34. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 20

  35. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 21

  36. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 21

  37. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 22

  38. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 22

  39. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 23

  40. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 23

  41. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 24

  42. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 24

  43. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 25

  44. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 25

  45. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 26

  46. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 26

  47. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 27

  48. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 28

  49. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 28

  50. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 29

  51. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 29

  52. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 30

  53. Context-free grammars (CFGs) Grammar (CFG) Lexicon S → NP VP N → girl N → telescope VP → V N → sandwich VP → V NP PN → I VP → VP PP V → saw V → ate NP → NP PP P → with NP → D N P → in NP → PN D → a D → the PP → P NP 30

  54. Context-free grammars (CFGs) ■ CFG: Formal definition. A 4-tuple ( N , Σ , R , S ): N a set of non-terminal symbols (or variables ) Σ a set of terminal symbols (disjoint from N ) R a set of rules or productions, each of the form A → β , where A is a non-terminal, β is a string of symbols from the infinite set of strings ( Σ ∪ N ) ∗ S a designated start symbol and a member of N 31

  55. Context-free grammars (CFGs) ■ CFG: Formal definition. A 4-tuple ( N , Σ , R , S ): VP , NP , S, PP , … V, N, P… N a set of non-terminal symbols (or variables ) Σ a set of terminal symbols (disjoint from N ) R a set of rules or productions, each of the form A → β , where A is a non-terminal, β is a string of symbols from the infinite set of strings ( Σ ∪ N ) ∗ S a designated start symbol and a member of N 31

  56. Context-free grammars (CFGs) ■ CFG: Formal definition. A 4-tuple ( N , Σ , R , S ): VP , NP , S, PP , … V, N, P… saw, telescope, N a set of non-terminal symbols (or variables ) the, girl, … Σ a set of terminal symbols (disjoint from N ) R a set of rules or productions, each of the form A → β , where A is a non-terminal, β is a string of symbols from the infinite set of strings ( Σ ∪ N ) ∗ S a designated start symbol and a member of N 31

  57. Context-free grammars (CFGs) ■ CFG: Formal definition. A 4-tuple ( N , Σ , R , S ): VP , NP , S, PP , … V, N, P… saw, telescope, N a set of non-terminal symbols (or variables ) the, girl, … Σ a set of terminal symbols (disjoint from N ) R a set of rules or productions, each of the form A → β , NP → NP PP , … where A is a non-terminal, β is a string of symbols from the infinite set of strings ( Σ ∪ N ) ∗ S a designated start symbol and a member of N 31

Recommend


More recommend