Learning to read numbers

One of the skills we all picked up when learning to read was the skill of reading numbers out loud as words. For example, we all know that to read the number 915 out loud we say "nine hundred fifteen". In this exercise you will train a model to convert numbers from digits to words.

What to base your code on

The model you will construct will use the architecture we saw in the English to Spanish translation example. On that page you will find an "Open in Colab" button - click that button to load the notebook in Colab. In this exercise you are going to modify the notebook to do digit to word translation on numbers.

Generating training data

You should remove the portion of the notebook that loads the English/Spanish sentence pairs. Instead, you are going to form your own list of pairs. For each of the integers in the range from 0 to 999 you are going to construct a tuple. The first member of the tuple is the digit representation of the integer with extra spaces inserted between the digits to make the digit sequence easier to tokenize. The second member is the representation of that integer in words. For example, for the integer 115 you will generate the pair

('9 1 5','nine hundred fifteen')

Put all of your pairs in the text_pairs variable, just as the original notebook did.

Configuring the model

Near the top of the notebook you will find a cell that sets up the parameters to use in building the model. You should adjust many of the parameters downward since the task we are training the model on is not nearly as complex as training it to translate English to Spanish.

Turning in your work

To submit your work for grading, first save your work in Colab. Then, go to the file menu in Colab and select the Download command to download your notebook to your computer. Send me that notebook as an attachment to an email message.