Programming project 9

Download the archive pp9.zip. It contains all the files for this project.

In this task you build a decoder for the Morse alphabet using a decision tree.

I've already implemented the node class Morse and entered the decision tree for the 26 letters for you. Your first task is to implement the missing method decode. It should be recursive. Do not modify anything else in the code.

You can test the decode method interactively:

>>> from morse import morse_table
>>> morse_table.decode(".")
'E'
>>> morse_table.decode("-")
'T'
>>> morse_table.decode("---")
'O'

Your second task is to extend the decision tree, so that it also supports decoding the digits 0 to 9.

You can find the Morse code for the letters in the lecture slides, or look on Wikipedia.

Running the script morse.py will decode a few letters, digits, and sentences. You can use the unit tests in test_morse.py to test all required Morse symbols.

Submission: Upload your file morse.py to the submission server.