// return only words greater than weight
max_word_frequency = max(word_frequencies)
return tuple(word for word, frequency in word_counts.items()
if frequency/max_word_frequency > weight)
def _is_bonus_word(self, word):
return word in self._bonus_words
After Change
def _compute_significant_words(self, document, weight):
// keep only stems contained in bonus words
words = map(self.stem_word, document.words)
words = filter(self._is_bonus_word, words)
// compute frequencies of bonus words in document
word_counts = Counter(words)