Ling187/287: Grammar Engineering

Homework Assignment for Week 6

Due: Friday, March 6 (by noon)
Submit assignments electronically to all three teachers (ron.kaplan "at" microsoft.com, tracy.king "at" microsoft.com, mforst "at" parc.com)


Turn in: 1. the final sequence of manually developed transfer rules. Please name it name-eng-rules-week6.pl
2. answers to the questions in Exercise 2.1
3. the final list of phrase pairs that you use for the induction of translation rules. Please name it name-eng-phrases-week6.txt
4. the output of a translation run over mt-sentences-week6.txt. Please name it with name-translations-week6.txt
Exercises on:
PART 1: Manual transfer rule development
PART 2: MT with transfer rule induction

Please save the file spanish-mt.tar.gz, which we have sent you as an attachment to an email, and unpack it. You will end up with a new directory called spanish-mt/.


PART 1: Manual transfer rule development

Please create an alias called xlerc for the file xlerc_manual. Then open an Emacs window and start a shell in it by entering `M-X shell' (i.e. `Esc-X shell' on most keyboards).

EXERCISE 1 -- Writing transfer rules manually

The transfer rules in mt-rules-week6.pl can translate sentences 1, 2, and 4 in mt-sentences-week6.txt. Please try this out by starting xle from spanish-mt/ and entering the following commands:

  xfr-testfile mt-sentences-week6-leftside.txt 1

  xfr-testfile mt-sentences-week6-leftside.txt 2

  xfr-testfile mt-sentences-week6-leftside.txt 4

  ...
Each of this command will produce the four usual windows plus one additional window with an English f-structure that is the result of the transfer of the Spanish f-structure. You will get the final translation by selecting `Generate from this f-structure' in the `Commands' menu of this additional window.

Note: Please ignore the warnings complaining about the library libxle-lm. We cannot use it in all operating systems at the moment, and we don't really need it either.

Note: Email us if these instructions do not allow you to parse the Spanish sentences, transfer them into English f-structures and generate from these. The transfer system depends on a number of settings which should normally all be set right, but it is sufficient that one is off for the system not to work.

Once you can translate sentences 1, 2, and 4, your task is to add transfer rules to mt-rules-week6.pl so that sentences 3, 5, 6, and 7 also receive the translations given in mt-sentences-week6.txt. Note: You can use the predefined macros and templates given in mt-rules-week6.pl; they are designed to make your life easier. However, in this Exercise, it is up to you whether you use these mechanisms or not; the first goal is to get the right translations.

EXERCISE 2 -- Transfer rule macros and templates

If you haven't done so already in Exercise 1, go through the macros and templates defined at the top of mt-rules-week6.pl and try to understand how they work. Then rewrite the rules you added in Exercise 2, so that you at least once make use of a template and a macro in these rules. (Rules that consist of a simple template call do count.)

PART 2: MT with transfer rule induction

Please create an alias called xlerc for the file xlerc_extractor.

EXERCISE 1: Running the system

Please start xle from spanish-mt/. The sequence of commands in xlerc_extractor parses both sides of the phrase pairs in mt-phrases-week6.txt and automatically induces transfer rules from these pairs; these are saved to spanish-mt/rules.pl. Then the system tries to translate the sentences in mt-sentences-week6-leftside.txt. You will see that it can translate sentences 1, 2, and 4 correctly and sentence 3 almost correctly.

Note: Ignore the warnings complaining about the library libxle-lm. We cannot use it in all operating systems at the moment, and we don't really need it either.

Compare rules.pl to your version of mt-rules-week6.pl. Can you find systematic differences between the rules you wrote and the ones the sytem infers? Which are these differences? Which rules deal with head switching? Which ones deal with argument switching?

EXERCISE 2: Extending the phrase dictionary

The objective in this exercise is again to cover all seven sentence pairs given in mt-sentences-week6.txt. However, this time we will not define new transfer rules directly, but we will extend the phrase dictionary from which the system induces transfer rules.

Make yourself familiar with the dummy categories used in mt-phrases-week6.txt. They are defined in spanish-2009-02-26/spanish-lex.lfg, where you may also find a few additional dummy categories that are not used in the initial version of mt-phrases-week6.txt, but may be helpful for its extension.

Finally, extend mt-phrases-week6.txt with phrases that you believe to be suitable for the induction of transfer rules that can translate all seven sentences in mt-sentences-week6-leftside.txt.

Note: For the translation of individual sentences, you can use the following commands in this setup.

  translate {NP1Subj ronca.}

  translate-testfile mt-sentences-week6-leftside.txt 4

  ...

Turn in: 1. the final sequence of manually developed transfer rules. Please name it with name-mt-rules-week6.pl.
2. answers to the questions in Exercise 2.1
3. the final version of the phrase dictionary. Please name it with name-mt-phrases-week6.txt.
4. the output of a translation run over mt-sentences-week6.txt. Please name it with name-translations-week6.txt


If you have any questions, you can send us email (ron.kaplan "at" microsoft.com, tracy.king "at" microsoft.com, mforst "at" parc.com), call us (Ron: 650-245-6865, Tracy: 415-848-7276, Martin: 650-812-4788), or set up office hours with us.