-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathstackk.py
51 lines (51 loc) · 1.39 KB
/
stackk.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
47
48
49
50
51
import codecs
import re
import time
import os
os.chdir('files//wiki_00.txt')
inputfile=open('wiki_00.txt', 'r', encoding='utf-8')
outputfile=open('new1.txt','w',encoding='utf-8')
pfn=open('sample.txt','r',encoding='utf-8')
pread=pfn.read()
psplit=pread.split("\n")
txt=" ".join(psplit)
iread=inputfile.read()
isplit=iread.split("\n")
for words in isplit:
ss=words.split(" ")
for word in ss:
word=re.sub('<','',word)
word=re.sub('>','',word)
word=re.sub(']','',word)
word=re.sub('=','',word)
word=re.sub('/','',word)
word=re.sub(':','',word)
word=re.sub('"','',word)
word=re.sub('\.','',word)
word=re.sub(',','',word)
word=re.sub(';','',word)
word=re.sub('\[','',word)
word=re.sub('{','',word)
word=re.sub('}','',word)
word=re.sub('\+','',word)
word=re.sub('-','',word)
word=re.sub('_','',word)
word=re.sub('\*','',word)
word=re.sub('&','',word)
word=re.sub('^','',word)
word=re.sub('%','',word)
word=re.sub('$','',word)
word=re.sub('#','',word)
word=re.sub('@','',word)
word=re.sub('~','',word)
word=re.sub('`','',word)
if(re.search("[0-9]+",word)):
word=re.sub("[0-9]+","",word)
if(re.search("[a-zA-Z]+",word)):
word=re.sub("[a-zA-Z]+","",word)
if(re.search(" "+word+" ",txt) and not re.search(" "+" ",txt)):
print(word+"_pfn ",file=outputfile,end='')
else:
print(word+" ",file=outputfile,end='')
print('done')
num = input('how long to wait')