"""The classic MapReduce job: count the frequency of words.
"""
from mrjob.job import MRJob
class MRWordFreqCount(MRJob):
def mapper(self, _, line):
yield (line, 1)
def reducer(self, keyword, counts):
total_tally = sum(counts)
yield (keyword, total_tally)
if __name__ == '__main__':
MRWordFreqCount.run()
--
You received this message because you are subscribed to the Google Groups "mrjob" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mrjob+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mrjob/fa126fb1-cb2f-47db-98c0-267e7e6cabc6%40googlegroups.com.
MRJob.
SORT_VALUES
= NoneSet this to True
if you would like reducers to receive the values associated with any key in sorted order (sorted by their encoded value). Also known as secondary sort.
To unsubscribe from this group and stop receiving emails from it, send an email to mr...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to mrjob+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mrjob/b776d5fb-fc5b-4706-98c0-c333a5357adf%40googlegroups.com.