Fixed small issue with dicts

This commit is contained in:
Manuel Cortez 2019-12-03 12:06:36 -06:00
parent 17bfa4b260
commit 0bf0fd9f27
3 changed files with 2 additions and 6 deletions

View File

@ -74,8 +74,6 @@ class SpellChecker(object):
if len(suggestions) == 0: if len(suggestions) == 0:
continue continue
for s in suggestions: for s in suggestions:
print(s.term)
print(s.distance)
if s.distance == 0: if s.distance == 0:
valid_word = False valid_word = False
if valid_word == False: if valid_word == False:
@ -90,8 +88,6 @@ class SpellChecker(object):
else: else:
context = " ".join(self.transformed_words[word-5:word+5]) context = " ".join(self.transformed_words[word-5:word+5])
self.word_index = word self.word_index = word
# print(self.word)
# print(suggestions[0].distance)
yield (suggestions, context, word) yield (suggestions, context, word)
def replace(self, suggestion): def replace(self, suggestion):

View File

@ -19,7 +19,7 @@ class spellChecker(object):
self.checker = checker.SpellChecker() self.checker = checker.SpellChecker()
log.debug("Using language: %s" % (languageHandler.getLanguage(),)) log.debug("Using language: %s" % (languageHandler.getLanguage(),))
try: try:
self.checker.set_language(languageHandler.curLang) self.checker.set_language(languageHandler.curLang::2])
except ValueError: except ValueError:
log.exception("Dictionary for language %s not found." % (languageHandler.curLang,)) log.exception("Dictionary for language %s not found." % (languageHandler.curLang,))
wx_ui.dict_not_found_error() wx_ui.dict_not_found_error()

View File

@ -61,7 +61,7 @@ def setup():
del sm del sm
log.debug("Loading dictionaries for spelling correction...") log.debug("Loading dictionaries for spelling correction...")
# Let's copy dictionary files for the selected language just in case it is not present already. # Let's copy dictionary files for the selected language just in case it is not present already.
checker.prepare_dicts(languageHandler.curLang) checker.prepare_dicts(languageHandler.curLang[:2])
call_threaded(checker.load_dicts) call_threaded(checker.load_dicts)
r = mainController.Controller() r = mainController.Controller()
call_threaded(r.login) call_threaded(r.login)