Assignment 6: Morphological inflection
This is a draft, please do not work on this assignment before it is released
Deadline: Aug 16, 2021 12:00 CEST
Late deadline: Aug 21, 2021 12:00 CEST
Morphological inflection is the task of finding the inflected form of a word from its base form (lemma). In this assignment, we will work with a specific form of inflection generation: predicting plural forms of German nouns from their base (singular) forms.
The morphological inflection task has attracted interest in cognitive science, particularly predicting past tenses of English verbs, for a long time. The task is particularly interesting, since most morphological processes include irregular and regular forms (also sub-regularities), that are explained differently by different theories of human language processing and learning. The task is also interesting for practical purposes, for example, generating correct inflected form can be useful in machine translation to morphologically complex languages. Similarly, a good automatic method of inflection can also help second language learners. As a result, relevant (more general) tasks are also popular in computational linguistics. For example, a few variations of the task have been introduced in SIGMORPHON shared tasks.
The most typical approach for solving this task is using an encoder-decoder architecture that can process sequences. For this task, you are strongly recommended to use a sequence to sequence, also known as seq2seq, (gated) RNN. However, you can use any of the other methods/architectures covered in the class.
Data
The data from this assignment comes from multiple corpora. It includes some non-standard usage (regional, archaic, and sometimes simply wrong). As a result, some lemmas are pluralized multiple ways, and a certain level of error is unavoidable. Besides the lemma and the inflected form, the grammatical gender of the nouns are also provided in the data, which can be useful for the inflection task.
The data is simply a tab separated file containing lemma, gender and plural form of each noun.
Requirements
You can choose any machine learning method, and you are free to implement the inflection system the way you like. However, make sure that your code is readable and runs on a standard Python 3 environment.
There is only one requirement in the template.
The function inflect()
should train the model using
the given training data, and return the predicted plural forms
for the test data.
The following code from an external Python script should work without errors.
from a6 import inflect
pred = inflect(trn_lemma, trn_gender, trn_words, tst_lemma, tst_gender)
If tst_lemma
above is ['Jahr', 'Plan', 'Leistung']
and
the tst_gender
is ['Neut', 'Masc', 'Fem']
,
the return value should be ['Jahre', 'Pläne', 'Leistungen']
.
You should, of course, tune the hyperparameters and the architecture of your system. However, the above call should (re)train your system on the given data with optimum setup you determined, and return the best predictions for each given test instance.
Evaluation
Your system will be evaluated based on both your implementation and the success of the predictions in a test set that is not shared with you. The distributions of the training and test sets are similar.
For evaluation of the predictions,
we will use average normalized edit distance on a test set (not disclosed).
The function that calculates the score (str_distance()
)
is provided in the template.
The test set will be released after the assignment deadline.
In general, you will get
- 5 points if your implementation is correct (and readable)
- 2 points if the above command runs without errors in less than 15 minutes quad-core recent (but not high-end) CPU (e.g., 3GHz Intel i7).
- 3 points if the score of your system is better than a trivial baseline. The baseline yields a 0.14 average normalized edit distance on the (undisclosed) test set.
- +1 point if the average normalized edit distance of your system on the test set is better (lower) than 0.07.