-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathfilereadable.py
More file actions
50 lines (34 loc) · 1.55 KB
/
Copy pathfilereadable.py
File metadata and controls
50 lines (34 loc) · 1.55 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
38
39
40
41
42
43
44
45
46
47
48
49
50
import naturalprocessingwordnet
from sentencecounter import gettempwords,filename,getline
def createnegfile(filename,word):
# filename = input("Enter destination file name in string format :")
f = open(filename,'a')
f.writelines(word +"\n")
def searchword(word, sourcename):
counter = 0
if word in open('list of negative words.txt').read():
createnegfile('destinationnegfile.txt',word)
counter = counter + 1
else:
for item in naturalprocessingwordnet.getsynonyms(word):
if item in open('list of negative words.txt').read():
createnegfile('destinationnegfile.txt', word)
counter = counter + 1
if word in open('list of positive words.txt').read():
createnegfile('destinationposfile.txt',word)
counter = counter + 1
else:
for item in naturalprocessingwordnet.getsynonyms(word):
if item in open('list of positive words.txt').read():
createnegfile('destinationposfile.txt', word)
counter = counter + 1
if counter == 0:
createnegfile('destinationneufile.txt', word)
for word in gettempwords():
searchword(word, filename)
print('*'*50)
for i in range(0,(gettempwords().__len__())):
searchword(sorted(gettempwords())[i],filename)
# print('*'*50)
# for i in range(0,5):
# print(sorted(gettempwords())[i])