We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8f2cd32 commit 122b2b8Copy full SHA for 122b2b8
word_count_map_reduce.py
@@ -0,0 +1,17 @@
1
+class WordCount:
2
+
3
+ # @param {str} line a text, for example "Bye Bye see you next"
4
+ def mapper(self, _, line):
5
+ # Write your code here
6
+ # Please use 'yield key, value'
7
+ words = line.split()
8
+ for word in words:
9
+ yield word, 1
10
11
12
+ # @param key is from mapper
13
+ # @param values is a set of value with the same key
14
+ def reducer(self, key, values):
15
16
17
+ yield key, len(values)
0 commit comments