Question: python 3 class: class Input An object of this class represents information about the input data. This class should implement (at least) the following methods:
python 3 class:

class Input An object of this class represents information about the input data. This class should implement (at least) the following methods: . init_(self) uses input ) to read in the name of an input file, opens the file, and initializes an attribute of the object with the file object returned by open () word list self : reads in the contents o the input le, splits t into a list o words, remo es any punctuation at either end of the word un tuation characters side he wor si d not e removed), discards any empty strings that may result, and returns the resulting list. class Ngrams An object of this class represents n-gram information about the input list of words. This class should implement (at least) the following methods . init(self) : uses input) to read in the value of n for computing n-grams and initializes an attribute of the object with this value. It also initializes the data structure that will be used to keep track of the number of times each n-gram occurs in the input. . update (self, ngram) updates the count for the n-gram ngram . process wordlist (self, wordlist) processes the list of words wordlist read from the input file to compute the number of times each n-gram occurs in wordlist. print_max_ngrams (self) : prints out the n-grams that have the highest number of occurrences according to the output format specified above (see Output) class Input An object of this class represents information about the input data. This class should implement (at least) the following methods: . init_(self) uses input ) to read in the name of an input file, opens the file, and initializes an attribute of the object with the file object returned by open () word list self : reads in the contents o the input le, splits t into a list o words, remo es any punctuation at either end of the word un tuation characters side he wor si d not e removed), discards any empty strings that may result, and returns the resulting list. class Ngrams An object of this class represents n-gram information about the input list of words. This class should implement (at least) the following methods . init(self) : uses input) to read in the value of n for computing n-grams and initializes an attribute of the object with this value. It also initializes the data structure that will be used to keep track of the number of times each n-gram occurs in the input. . update (self, ngram) updates the count for the n-gram ngram . process wordlist (self, wordlist) processes the list of words wordlist read from the input file to compute the number of times each n-gram occurs in wordlist. print_max_ngrams (self) : prints out the n-grams that have the highest number of occurrences according to the output format specified above (see Output)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
