File size: 681 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
24
25
# -*- 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 import rhyme, thai_word_tone_detector


class UtilTestCaseX(unittest.TestCase):
    def test_rhyme(self):
        self.assertIsInstance(rhyme("แมว"), list)
        self.assertGreater(len(rhyme("แมว")), 2)

    def test_thai_word_tone_detector(self):
        self.assertIsNotNone(thai_word_tone_detector("คนดี"))
        self.assertEqual(
            thai_word_tone_detector("ราคา"), [("รา", "m"), ("คา", "m")]
        )