コード例 #1
0
    def testRuEn_01(self):
        self._copyDict('ru_RU')
        self._copyDict('en_US')
        checker = SpellChecker(['ru_RU', 'en_US'], [self._pathToDicts])
        self.assertTrue(checker.check('Проверка'))
        self.assertTrue(checker.check('cat'))
        self.assertFalse(checker.check('ывпывапыяа'))
        self.assertFalse(checker.check('adfasdfasd'))

        finder = DictsFinder([self._pathToDicts])
        langs = sorted(finder.getLangList())

        self.assertEqual(langs, ["en_US", "ru_RU"])
コード例 #2
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))
コード例 #3
0
 def testRu_yo_01(self):
     self._copyDict('ru_YO')
     checker = SpellChecker(['ru_YO'], [self._pathToDicts])
     self.assertTrue(checker.check('ёж'))
コード例 #4
0
 def testNumbers_02(self):
     self._copyDict('ru_RU')
     checker = SpellChecker(['ru_RU'], [self._pathToDicts])
     checker.skipWordsWithNumbers = False
     self.assertFalse(checker.check('ыяаывфафыа123'))
コード例 #5
0
 def testEn_01(self):
     self._copyDict('en_US')
     checker = SpellChecker(['en_US'], [self._pathToDicts])
     self.assertTrue(checker.check('test'))
     self.assertFalse(checker.check('asdfasfffadsf'))
コード例 #6
0
 def testRu_01(self):
     self._copyDict('ru_RU')
     checker = SpellChecker(['ru_RU'], [self._pathToDicts])
     self.assertTrue(checker.check('Проверка'))
     self.assertFalse(checker.check('ывпывапыяа'))
コード例 #7
0
 def testEmpty_03(self):
     checker = SpellChecker([], [self._pathToDicts])
     self.assertTrue(checker.check('ывпаывапыв'))
コード例 #8
0
 def testEmpty_02(self):
     checker = SpellChecker([], [])
     self.assertTrue(checker.check('ывпаывапыв'))
コード例 #9
0
 def testEmpty_01(self):
     self._copyDict('ru_RU')
     checker = SpellChecker(['ru_RU'], [])
     self.assertTrue(checker.check('ывпаывапыв'))