I am trying to print the top 10 frequent words using the following code. However, its not working. Any idea on how to fix it?
def reducer_count_words(self, word, counts):
    # send all (num_occurrences, word) pairs to the same reducer.
    # num_occurrences is so we can easily use Python's max() function.
    yield None, (sum(counts), word)
# discard the key; it is just None
def reducer_find_max_10_words(self, _, word_count_pairs):
    # each item of word_count_pairs is (count, word),
    # so yielding one results in key=counts, value=word
        tmp = sorted(word_count_pairs)[0:10]
        yield tmp
 
     
     
    