-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapper.py
30 lines (25 loc) · 1014 Bytes
/
mapper.py
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
#!/usr/bin/env python
# import sys because we need to read and write data to STDIN and STDOUT
import sys
dictBest = ["Best", "best", "Very Good", "very good", "Amazing", "amazing"]
dictGood = ["Good", "good", "Do", "do"]
dictAverage = ["Average", "average", "Ok", "ok"]
dictBad = ["Bad", "bad", "issues", "Don't", "don't"]
dictWorst = ["Worst", "worst", "Very Bad", "very bad", "Useless","useless" ]
# reading entire line from STDIN (standard input)
for line in sys.stdin:
# to remove leading and trailing whitespace
line = line.strip()
# split the line into words
words = line.split()
for word in words:
if(word in dictBest):
print '%s\t%s' % ("Best", "1")
elif(word in dictGood):
print '%s\t%s' % ("Good", "1")
elif(word in dictAverage):
print '%s\t%s' % ("Average", "1")
elif(word in dictBad):
print '%s\t%s' % ("Bad", "1")
elif(word in dictWorst):
print '%s\t%s' % ("Worst", "1")