forked from neelamgehlot/MWP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeVerbDict.py
More file actions
37 lines (31 loc) · 1.2 KB
/
makeVerbDict.py
File metadata and controls
37 lines (31 loc) · 1.2 KB
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
36
37
def makeVerbDictionary(fileName):
verbDict = dict()
lines = []
with open(fileName) as tagged_file:
lines = tagged_file.readlines()
for i in range(0, len(lines)):
# print lines[i]
if lines[i].rstrip("\n").strip(" ") == "<vc>":
for j in range(i + 1, len(lines)):
if lines[j]=='\n':
continue
if lines[j].rstrip("\n").strip(" ") == "</vc>":
i = j
break
else:
line = lines[j].rstrip("\n").strip(" ")
temp = line.split(" ")
verb = temp[0].strip(" ")
category = temp[1].strip(" ")
# print verb,
# print category
if verb in verbDict:
verbDict[verb][int(category)] += 1
else:
verbDict[verb] = list(1 for i in range(0, 6))
verbDict[verb][5] = 5
verbDict[verb][int(category)] += 1
verbDict[verb][5] += 1
else:
continue
return verbDict