Esempio n. 1
0
    def test_spell(self):
        self.assertEqual(spell(None), "")
        self.assertEqual(spell(""), "")
        self.assertIsNotNone(spell("เน้ร"))
        self.assertIsNotNone(spell("เกสมร์"))

        self.assertEqual(correct(None), "")
        self.assertEqual(correct(""), "")
        self.assertIsNotNone(correct("ทดสอง"))

        checker = NorvigSpellChecker(dict_filter="")
        self.assertIsNotNone(checker.dictionary())
        self.assertGreaterEqual(checker.prob("มี"), 0)
Esempio n. 2
0
    def test_spell(self):
        self.assertEqual(spell(None), "")
        self.assertEqual(spell(""), "")
        self.assertIsNotNone(spell("เน้ร"))
        self.assertIsNotNone(spell("เกสมร์"))

        self.assertEqual(correct(None), "")
        self.assertEqual(correct(""), "")
        self.assertIsNotNone(correct("ทดสอง"))

        checker = NorvigSpellChecker(dict_filter="")
        self.assertIsNotNone(checker.dictionary())
        self.assertGreaterEqual(checker.prob("มี"), 0)
Esempio n. 3
0
    def test_word_correct(self):
        self.assertEqual(correct(None), "")
        self.assertEqual(correct(""), "")
        self.assertEqual(correct("1"), "1")
        self.assertEqual(correct("05"), "05")
        self.assertEqual(correct("56"), "56")
        self.assertEqual(correct("1.01"), "1.01")

        result = correct("ทดสอง")
        self.assertIsInstance(result, str)
        self.assertNotEqual(result, "")
Esempio n. 4
0
    def test_word_correct(self):
        self.assertEqual(correct(None), "")
        self.assertEqual(correct(""), "")
        self.assertEqual(correct("1"), "1")
        self.assertEqual(correct("05"), "05")
        self.assertEqual(correct("56"), "56")
        self.assertEqual(correct("1.01"), "1.01")

        result = correct("ทดสอง")
        self.assertIsInstance(result, str)
        self.assertNotEqual(result, "")

        result = correct("ทดสอง", engine="phunspell")
        self.assertIsInstance(result, str)
        self.assertNotEqual(result, "")

        result = correct("ทดสอง", engine="symspellpy")
        self.assertIsInstance(result, str)
        self.assertNotEqual(result, "")