-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUnique_Trims.py
More file actions
35 lines (30 loc) · 790 Bytes
/
Copy pathUnique_Trims.py
File metadata and controls
35 lines (30 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import MapReduce
import sys
"""
Word Count Example in the Simple Python MapReduce Framework
"""
mr = MapReduce.MapReduce()
check=[]
# =============================
# Do not modify above this line
def mapper(record):
# key: document identifier
# value: document contents
key = record[0]
value = record[1]
value = value[:-10]
mr.emit_intermediate(key,value)
def reducer(key, list_of_values):
# key: word
# value: list of occurrence counts
# word : remove characters
word = ""
for v in list_of_values:
if v not in check:
check.append(v)
mr.emit((v))
# Do not modify below this line
# =============================
if __name__ == '__main__':
inputdata = open(sys.argv[1])
mr.execute(inputdata, mapper, reducer)