|
|
|
@ -21,8 +21,7 @@ class ConcreteWordFrequencyController(WordFrequencyController):
|
|
|
|
|
self.word_freq = get_frequencies(self.word_list)
|
|
|
|
|
self.word_freq = sort_dict(self.word_freq)
|
|
|
|
|
def print_word_freqs(self, number):
|
|
|
|
|
for (w, c) in self.word_freq[:number]:
|
|
|
|
|
print(w, '-', c)
|
|
|
|
|
print_word_freqs( self.word_freq,number)
|
|
|
|
|
|
|
|
|
|
#定义享元工厂
|
|
|
|
|
class WordFrequencyControllerFactory():
|
|
|
|
|