def mapper(key, value): words = key.split() for word in words: Wmr.emit(word, 1)
def reducer(key, values): count = 0 for value in values: count += int(value) Wmr.emit(key, count)