1 / 88

Pushpak Bhattacharyya CSE Dept., IIT Bombay 1 st and 11 th Oct, 2012

CS460/626 : Natural Language Processing/Speech, NLP and the Web Lecture 19, 24: Algorithmics of Probabilistic Parsing; HMM-PCFG correspondence. Pushpak Bhattacharyya CSE Dept., IIT Bombay 1 st and 11 th Oct, 2012. Shared Sub-Problems: Example. CKY Parsing: CNF.

macy-carney
Download Presentation

Pushpak Bhattacharyya CSE Dept., IIT Bombay 1 st and 11 th Oct, 2012

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS460/626 : Natural Language Processing/Speech, NLP and the WebLecture 19, 24:Algorithmics of Probabilistic Parsing; HMM-PCFG correspondence Pushpak BhattacharyyaCSE Dept., IIT Bombay 1st and 11th Oct, 2012

  2. Shared Sub-Problems: Example

  3. CKY Parsing: CNF • CKY parsing requires that the grammar consist of ε-free, binary rules = Chomsky Normal Form • All rules of the form: • A  BC or Aa • What does the tree look like? • What if my CFG isn’t in CNF? A → B C D → w

  4. CKY Algorithm

  5. Illustrating CYK [Cocke, Younger, Kashmi] Algo • DT  the 1.0 • NN  gunman 0.5 • NN  building 0.5 • VBD  sprayed 1.0 • NNS  bullets 1.0 • S  NP VP 1.0 • NP  DT NN 0.5 • NP  NNS 0.3 • NP  NP PP 0.2 • PP  P NP 1.0 • VP  VP PP 0.6 • VP  VBD NP 0.4

  6. CYK: Start with (0,1) 0The1 gunman 2 sprayed 3 the 4 building 5 with 6 bullets 7.

  7. CYK: Keep filling diagonals 0The 1gunman2 sprayed 3 the 4 building 5 with 6 bullets 7.

  8. CYK: Try getting higher level structures 0The1gunman2 sprayed 3 the 4 building 5 with 6 bullets 7.

  9. CYK: Diagonal continues 0The 1 gunman 2sprayed3 the 4 building 5 with 6 bullets 7.

  10. CYK (cont…) 0The 1 gunman 2 sprayed 3 the 4 building 5 with 6 bullets 7.

  11. CYK (cont…) 0The 1 gunman 2 sprayed 3the4 building 5 with 6 bullets 7.

  12. CYK (cont…) 0The 1 gunman 2 sprayed 3 the 4building5 with 6 bullets 7.

  13. CYK: starts filling the 5th column 0The 1 gunman 2 sprayed 3the4building5 with 6 bullets 7.

  14. CYK (cont…) 0The 1 gunman 2sprayed3the4building5 with 6 bullets 7.

  15. CYK (cont…) 0The 1gunman2sprayed3the4building5 with 6 bullets 7.

  16. CYK: S found, but NO termination! 0The1gunman2sprayed3the4building5 with 6 bullets 7.

  17. CYK (cont…) 0The 1 gunman 2 sprayed 3 the 4 building 5with6 bullets 7.

  18. CYK (cont…) 0The 1 gunman 2 sprayed 3 the 4 building 5 with 6 bullets 7.

  19. CYK: Control moves to last column 0The 1 gunman 2 sprayed 3 the 4 building 5 with 6bullets7.

  20. CYK (cont…) 0The 1 gunman 2 sprayed 3 the 4 building 5with6bullets7.

  21. CYK (cont…) 0The 1 gunman 2 sprayed 3the4building5with6bullets7.

  22. CYK (cont…) 0The 1 gunman 2sprayed3the4building5with6bullets7.

  23. CYK: filling the last column 0The 1 gunman 2sprayed3the4building5with6bullets7.

  24. CYK: terminates with S in (0,7) 0The1gunman2sprayed3the4building5with6bullets7.

  25. CYK: Start with (0,1) 0The1 gunman 2 sprayed 3 the 4 building 5 with 6 bullets 7.

  26. CYK: Keep filling diagonals 0The 1gunman2 sprayed 3 the 4 building 5 with 6 bullets 7.

  27. CYK: Try getting higher level structures 0The1gunman2 sprayed 3 the 4 building 5 with 6 bullets 7.

  28. CYK: Diagonal continues 0The 1 gunman 2sprayed3 the 4 building 5 with 6 bullets 7.

  29. CYK (cont…) 0The 1 gunman 2 sprayed 3 the 4 building 5 with 6 bullets 7.

  30. CYK (cont…) 0The 1 gunman 2 sprayed 3the4 building 5 with 6 bullets 7.

  31. CYK (cont…) 0The 1 gunman 2 sprayed 3 the 4building5 with 6 bullets 7.

  32. CYK: starts filling the 5th column 0The 1 gunman 2 sprayed 3the4building5 with 6 bullets 7.

  33. CYK (cont…) 0The 1 gunman 2sprayed3the4building5 with 6 bullets 7.

  34. CYK (cont…) 0The 1gunman2sprayed3the4building5 with 6 bullets 7.

  35. CYK: S found, but NO termination! 0The1gunman2sprayed3the4building5 with 6 bullets 7.

  36. CYK (cont…) 0The 1 gunman 2 sprayed 3 the 4 building 5with6 bullets 7.

  37. CYK (cont…) 0The 1 gunman 2 sprayed 3 the 4 building 5 with 6 bullets 7.

  38. CYK: Control moves to last column 0The 1 gunman 2 sprayed 3 the 4 building 5 with 6bullets7.

  39. CYK (cont…) 0The 1 gunman 2 sprayed 3 the 4 building 5with6bullets7.

  40. CYK (cont…) 0The 1 gunman 2 sprayed 3the4building5with6bullets7.

  41. CYK (cont…) 0The 1 gunman 2sprayed3the4building5with6bullets7.

  42. CYK: filling the last column 0The 1 gunman 2sprayed3the4building5with6bullets7.

  43. CYK: terminates with S in (0,7) 0The1gunman2sprayed3the4building5with6bullets7.

  44. CYK: Extracting the Parse Tree • The parse tree is obtained by keeping back pointers. S (0-7) NP (0-2) VP (2-7) DT (0-1) NN (1-2) NP (3-7) VBD (2-3) NP (3-5) PP (5-7) gunman The DT (3-4) NN (4-5) P (5-6) NP (6-7) sprayed NNS (6-7) with the building bullets

  45. Probabilistic parse tree construction

  46. Probabilistic Context Free Grammars • DT  the 1.0 • NN  gunman 0.5 • NN  building 0.5 • VBD  sprayed 1.0 • NNS  bullets 1.0 • S  NP VP 1.0 • NP  DT NN 0.5 • NP  NNS 0.3 • NP  NP PP 0.2 • PP  P NP 1.0 • VP  VP PP 0.6 • VP  VBD NP 0.4

  47. Another Parse t2 S1.0 • The gunman sprayed the building with bullets. P (t2) = 1.0 * 0.5 * 1.0 * 0.5 * 0.4 * 1.0 * 0.2 * 0.5 * 1.0 * 0.5 * 1.0 * 1.0 * 0.3 * 1.0 = 0.0015 NP0.5 VP0.4 NN0.5 DT1.0 VBD1.0 NP0.2 The gunman sprayed NP0.5 PP1.0 DT1.0 NN0.5 P1.0 NP0.3 NNS1.0 the building with bullets

  48. Example Parse t1` S1.0 P (t1) = 1.0 * 0.5 * 1.0 * 0.5 * 0.6 * 0.4 * 1.0 * 0.5 * 1.0 * 0.5 * 1.0 * 1.0 * 0.3 * 1.0 = 0.00225 • The gunman sprayed the building with bullets. NP0.5 VP0.6 NN0.5 DT1.0 PP1.0 VP0.4 P1.0 NP0.3 NP0.5 VBD1.0 The gunman DT1.0 NN0.5 with NNS1.0 sprayed the building bullets

  49. Interesting Probabilities N1 What is the probability of having a NP at this position such that it will derive “the building” ? - Inside Probabilities NP The gunman sprayed the building with bullets 1 2 3 4 5 6 7 Outside Probabilities What is the probability of starting from N1 and deriving “The gunman sprayed”, a NP and “with bullets” ? -

  50. Interesting Probabilities • Random variables to be considered • The non-terminal being expanded. E.g., NP • The word-span covered by the non-terminal. E.g., (4,5) refers to words “the building” • While calculating probabilities, consider: • The rule to be used for expansion : E.g., NP  DT NN • The probabilities associated with the RHS non-terminals : E.g., DT subtree’s inside/outside probabilities & NN subtree’s inside/outside probabilities

More Related