Skip to content

Commit 1c2d5d6

Browse files
committed
Fixed initial dictionary problems
It was creating the wrong path for the initial dictionary name. Also an initial dictionary is no longer required.
1 parent 723d2dd commit 1c2d5d6

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

codespell.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from enchant.checker import SpellChecker
1111
from enchant.tokenize import EmailFilter, URLFilter
12-
from enchant import DictWithPWL
12+
from enchant import Dict
1313

1414
from comment_parser import comment_parser
1515

@@ -171,6 +171,7 @@ def parse_args():
171171
dest='prefixes',
172172
help='Add word prefix (multiples allowed)')
173173

174+
174175
parser.add_argument('--miss', '-m', action='store_true', default=False,
175176
dest='miss', help='Only output the misspelt words')
176177

@@ -193,13 +194,14 @@ def add_dict(enchant_dict, filename):
193194

194195
def main():
195196
args = parse_args()
196-
# print(args)
197197

198-
initial_dct = Path(__file__) / 'additional_dictionary.txt'
198+
sitk_dict = Dict('en_US')
199+
200+
initial_dct = Path(__file__).parent / 'additional_dictionary.txt'
199201
if not initial_dct.exists():
200202
initial_dct = None
201-
202-
sitk_dict = DictWithPWL('en_US', initial_dct)
203+
else:
204+
add_dict(sitk_dict, str(initial_dct))
203205

204206
if args.dict is not None:
205207
for d in args.dict:
@@ -282,4 +284,4 @@ def main():
282284

283285

284286
if __name__ == '__main__':
285-
main()
287+
main()

0 commit comments

Comments
 (0)