Skip to content

Commit e22d87e

Browse files
committed
more imporved code at desktop/swift-typo
1 parent a8ee955 commit e22d87e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

python/SpellFix/fNr.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import sys
22
from os import walk
33
from spellCheck import *
4+
import ntpath
5+
from os.path import expanduser
6+
home = expanduser("~")
47

58
keywords = [f.rstrip().lower() for f in open('keywords.txt', 'r')]
69
print keywords
@@ -15,16 +18,19 @@ def printDetails(filePath):
1518
for line in open(filePath, 'r'):
1619
lineNo += 1
1720
lines = re.findall('[a-z]+', line.lower())
21+
cmt = ''
22+
if line.startswith('//'): cmt = ' //-- cmt'
1823
for word in lines:
1924
word = word.rstrip().lower()
2025
if word in keywords: continue
2126
a = correct(word)
2227
if a != word:
23-
wordChange = 'Line: '+str(lineNo)+' => '+word+' != '+a+'\n'
28+
wordChange = 'Line: '+str(lineNo)+' => '+word+' != '+a+cmt+'\n'
2429
val += wordChange
2530
print wordChange
2631
val += "\n\n----------------------------------------------------------\n\n"
27-
file_op = open(filePath+".gds.txt", "w")
32+
head, tail = ntpath.split(filePath)
33+
file_op = open(home+'/Desktop/swift-typo/'+tail+".gds.txt", "w")
2834
file_op.write(val)
2935
file_op.close()
3036

python/SpellFix/spellCheck.pyc

290 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)