-
Notifications
You must be signed in to change notification settings - Fork 2
/
sentParser.py
47 lines (40 loc) · 875 Bytes
/
sentParser.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def main():
createParseDict()
def createParseDict():
f = open('subjclueslen1-HLTEMNLP05.tff','r')
dt = {}
for line in f:
line = line.split()
s = line[2].split('=')[1]
pol = ''
if line[5].split('=')[1] == 'positive':
pol = 1
else:
pol = -1
strength = ''
if line[0].split('=')[1] == 'strongsubj':
strength = 2
else:
strength = 1
dt[s] = pol*strength
return dt
<<<<<<< HEAD
def createSimpDict(txt):
f = open(txt, 'r')
=======
def createSimpDict(fname):
f = open(fname, 'r')
>>>>>>> 3c29d345d3c85f838c31cadec81f5a68f23538ee
dt = {}
for line in f:
line = line.split()
dt[line[0]] = float(line[1])
return dt
def createEDict():
f=open('sentEnhancers.txt', 'r')
dt={}
for line in f:
line=line.split()
dt[line[0]]=float(line[1])
return dt
if __name__ == '__main__': main()