question archive Question 4) According to each method's documentation, complete the code of the TextProcessor class and its subclass TextAnalyzer
Subject:Computer SciencePrice:3.86 Bought12
Question 4) According to each method's documentation, complete the code of the TextProcessor class and its subclass TextAnalyzer.
In [16]:
class TextProcessor: def __init__(self, text): self.text = text def setStopWords(): ''' set stop words as recieved in the parameters ''' ## CODE HERE ## def getStopWords(): ''' return stop words ''' ## CODE HERE ## def getUniqWords(self): return set(self.__text.split()) def getFilteredText(self): ''' remove filter words from the text return filtered text ''' ## CODE HERE ## class TextAnalyzer: def __init__(): ''' Construct the class ''' ## CODE HERE ## def getWordFrequency(): ''' Call the getFilteredText() method Create a dictionary of words key = word and value= frequency return the dictionary ''' ## CODE HERE ##
Verify the correctness of your code using the following steps:
ta = TextAnalyzer("a quick brown fox " +
"a quick brown fox jumps " +
"a quick brown fox jumps over " +
"a quick brown fox jumps over the " +
"a quick brown fox jumps over the lazy " +
"a quick brown fox jumps over the lazy dog")
Purchased 12 times