File size: 783 Bytes
e4b9a7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2016-2025 PyThaiNLP Project
# SPDX-FileType: SOURCE
# SPDX-License-Identifier: Apache-2.0

"""
Unit tests for pythainlp.util module.
"""

import unittest

from pythainlp.util.spell_words import spell_word


class SpellWordTestCase(unittest.TestCase):
    def test_spell_word(self):
        self.assertEqual(spell_word("เสือ"), ["สอ", "เอือ", "เสือ"])
        self.assertEqual(spell_word("เสื้อ"), ["สอ", "เอือ", "ไม้โท", "เสื้อ"])
        self.assertEqual(spell_word("คน"), ["คอ", "นอ", "คน"])
        self.assertEqual(
            spell_word("คนดี"), ["คอ", "นอ", "คน", "ดอ", "อี", "ดี", "คนดี"]
        )