我是 MRJob 和 MR 的新手,我想知道 MRJob MR 的传统字数 python 示例:
from mrjob.job import MRJob
class MRWordCounter(MRJob):
def mapper(self, key, line):
for word in line.split():
yield word, 1
def reducer(self, word, occurrences):
yield word, sum(occurrences)
if __name__ == '__main__':
MRWordCounter.run()
是否可以将word, sum(occurrences)
元组存储到字典中而不是产生它们,以便我以后可以访问它们?这样做的语法是什么?谢谢!