Esempio n. 1
0
    def getSpellChecker(self):
        langlist = self._getDictsFromConfig()
        spellDirList = outwiker.core.system.getSpellDirList()

        spellChecker = SpellChecker(langlist, spellDirList)
        spellChecker.addCustomDict(os.path.join(spellDirList[-1], CUSTOM_DICT_FILE_NAME))

        return spellChecker
Esempio n. 2
0
    def getSpellChecker(self):
        langlist = self._getDictsFromConfig()
        spellDirList = outwiker.core.system.getSpellDirList()

        spellChecker = SpellChecker(langlist, spellDirList)
        spellChecker.addCustomDict(os.path.join(spellDirList[-1], CUSTOM_DICT_FILE_NAME))

        return spellChecker
Esempio n. 3
0
    def testUserDict_01(self):
        word = 'ывпывапыяа'
        dictname = 'mydict.dic'

        self._copyDict('ru_RU')
        checker = SpellChecker(['ru_RU'], [self._pathToDicts])
        self.assertTrue(checker.check('Проверка'))
        self.assertFalse(checker.check(word))

        checker.addCustomDict(os.path.join(self._pathToDicts, dictname))
        checker.addToCustomDict(0, word)
        self.assertTrue(checker.check(word))

        checker2 = SpellChecker(['ru_RU'], [self._pathToDicts])
        checker2.addCustomDict(os.path.join(self._pathToDicts, dictname))
        self.assertTrue(checker2.check(word))