Question
In this task, you are required to define a class for analysing the number of occurrences for each of the letters (i.e. A to Z)
In this task, you are required to define a class for analysing the number of occurrences for each of the letters (i.e. A to Z) and numerals (i.e. 0 to 9) from the decoded sequences. This class should have one instance variable which is a dictionary structure that is used for keeping track of the number of occurrences for each of the letters and numerals decoded by the Morse Code decoder in Task 1.
The implementation of this character analyser class should include the following three methods:
__init__(self): This is the constructor that is required for creating instances of this class. You should
define and initialise the dictionary structure for characters (i.e. the instance variable) in the constructor.
__str__(self): Re-define this method to present the number of occurrences for each of the letters and numerals in a readable format. You should return a formatted string in this method.
analyse_characters(self, decoded_sequence): This is the method that performs the analysis on the decoded sequences at the character level. This method should accept a decoded sequence as the argument, and attempt to count the occurrences for each of the letters and numerals encountered in the given decoded sequence. The counts should be updated in the dictionary structure defined in the constructor.
Table 1 defines the set of Morse Code representation used in this assignment Character Morse Code Character Morse Code Character Morse Code 10 0 01 1000 1010 100 0110 1101 010 00111 00011 00001 0010 110 10000 11000 11100 001 0001 011 1001 1011 1100 0111 101 0100 010101 110011 001100 Table 1: Morse Code representation for this assignment (letters, numerals, and punctuations)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started