1 / 25

LING 388: Language and Computers

LING 388: Language and Computers. Sandiway Fong Lecture 29. Today’s Topic. Finally, a working translator… Relevant files: g29.pl English grammar j29.pl Japanese grammar translator29.pl translator (the “glue”). Last Time.

symona
Download Presentation

LING 388: Language and Computers

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. LING 388: Language and Computers Sandiway Fong Lecture29

  2. Today’s Topic • Finally, a working translator… • Relevant files: • g29.pl English grammar • j29.pl Japanese grammar • translator29.pl translator (the “glue”)

  3. Last Time • We made extensive modifications to the English grammar to convert it to produce predicate-argument structures instead of syntax trees …

  4. Last Time • Passives:

  5. Last Time • Object wh-question:

  6. Last Time • Subject wh-question: • wh-question + passive:

  7. Last Time • Subject-auxiliary verb inversion: yes-no question:

  8. g29.pl • Three cases: • Examples: • What did John buy • whnpdosupportnpvp_objwh • Who bought a book • whnpempty_npvp • What was bought by John • whnpempty_npvp_passive

  9. g29.pl • Two cases: • Examples: • Did John buy a book • dosupportnpvp • Was a book bought by John • v_auxnpvp_auxraised

  10. g29.pl • Two cases: • Examples: • John bought a book • npvp • a book was bought by John • npvp_passive

  11. g29.pl • Conversion table: Ending  TENSE (morpheme) Needed when TENSE and the main verb are separated • Example: a book was bought by John • Ending V+vbn • vbd_sgbuy+vbn V+TENSE buy+past

  12. g29.pl • Conversion table: Ending  TENSE (morpheme) • Example: was a book bought by John • Ending V+vbn • vbd_sgbuy+vbn V+TENSE buy+past

  13. g29.pl • Conversion table: Ending  TENSE (morpheme) • Example: what was bought by John • Ending V+vbn • vbd_sgbuy+vbn V+TENSE buy+past

  14. g29.pl • The English grammar must also work in generation mode:

  15. g29.pl • Parse: • Generate sentence from predicate-argument structure:

  16. g29.pl • Prevent infinite loop during generation: • comment out relative clause NP rules

  17. g29.pl • Parse: • Generate sentence from predicate-argument structure:

  18. Modules • To operate the translator, we must load in both grammars simultaneously but keep them separate. • Symbol naming problem: • we have separate grammar rules for our two languages, some of them share the same names, e.g. np, nn, vp etc. • SWI Prolog supports namespaces called modules first line of code in the file

  19. Modules • Japanese module:

  20. Modules • Translator (translator29.pl): tells Prolog to load the English grammar not a grammar rule, Prolog code (: - )

  21. Exercise 1 • Use e2j(E,J) to translate the Japanese sentence taroo-gahon-o kaimashita • what happens? • (how many parses do we get?)

  22. Exercise 2 • Use e2j(E,J) to translate the Japanese sentence taroo-gahon-o kaimashita • hon can mean book or books • How would you modify the translate table to get both forms?

  23. Exercise 3 • English passive sentence a book was bought doesn’t translate (yet) • Why not? • Hint: add to the translate table

  24. Exercise 4 • Modify the translate table to make these wh-questions work: • Who bought a book? • What did John buy? • Dare-gahon-o kaimashitaka • Nani-o taroo-gakaimashitaka

  25. Exercise 5 • Do yes/no-questions work in the translator? • Did John buy a book? • Was a book bought by John? • Taroo-gahon-o kaimashitaka

More Related