-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathonlyfilereadwrite.py
More file actions
58 lines (42 loc) · 1.67 KB
/
Copy pathonlyfilereadwrite.py
File metadata and controls
58 lines (42 loc) · 1.67 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
51
52
53
54
55
56
57
58
import naturalprocessingwordnet
import re
from sentencecounter import gettempwords,getallline,getline
print ("## IT'S STARTING OF ONLYFILE READWRITE SCRIPT ##")
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):
if word in open('list of negative words.txt').read():
createnegfile('destinationnegfile.txt',word)
elif word in open('list of positive words.txt').read():
createnegfile('destinationposfile.txt',word)
def searchwordinnegfile(word,sourcename):
opennegdictionary = open("list of negative words.txt")
readnegline = opennegdictionary.readline()
readnegline = readnegline.split()
for w in readnegline:
if w == word:
createnegfile('destinationnegfile.txt',word)
def searchwordinposfile(word,sourcename):
openposdictionary = open("list of positive words.txt")
readposline = openposdictionary.readline()
readposline = readposline.split()
for w in readposline:
if w == word:
createnegfile('destinationposfile.txt',word)
print (gettempwords())
print (gettempwords().__format__)
print (gettempwords().__getitem__)
print (len(gettempwords()))
for i in range(0,(len(gettempwords()))):
print (gettempwords()[i])
print ("Ent of For loop")
#print the word in sorted words
print (sorted(gettempwords()))
#print the array size
print(gettempwords().__sizeof__())
print ("the 2nd word is :"+ gettempwords()[0])
# # words = ['abort','aborted','abnormal','abound','abundant','accessable']
# for word in gettempwords():
# searchword(word,'a.txt')