Question: Imporant Note: The following program should be solved only using python 3 Define a class called TextAnalysis. This class should have one attribute called text

Imporant Note: The following program should be solved only using python 3

Imporant Note: The following program should be solved only using python 3

Define a class called TextAnalysis. This class should have one attribute called text on which the text analysis will be performed. Additional attributes can be used, as required. Define a constructor for this class (i.e., the init ( ) method). The constructor should have one additional argument called filename. The constructor should open the file associated with the provided filename. The file will be UTF-8 encoded. Exception handling should be used, as appropriate Contents of the file should be stored in the text attribute so that the file does not need to be accessed again over the lifetime of the TextAnalysis object o Define a method called getLongestWord) which takes no extra arguments. This method should find the longest word(s) within the text (contained within the text attribute) . The method should return a tuple containing the longest word(s); that is, the tuple will contain multiple words in the event of a tie or a single word if there is no tie. The returned word(s) should not contain any spaces or special characters. Sample Test Cases: Input: "Never-underestimate-the-power-of-human-stupidity. Output: (underestimate') Input: "Hateful to me as the gates of Hades is that man who hides one thing in his heart and speaks another." Output: ('hateful', another')

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!