File size: 1,313 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
26
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2016-2025 PyThaiNLP Project
# SPDX-FileType: SOURCE
# SPDX-License-Identifier: Apache-2.0

import unittest

from pythainlp.classify import GzipModel


class ClsTestCaseX(unittest.TestCase):
    def test_GzipModel(self):
        training_data = [
            ("รายละเอียดตามนี้เลยค่าา ^^", "Neutral"),
            ("กลัวพวกมึงหาย อดกินบาบิก้อน", "Neutral"),
            ("บริการแย่มากก เป็นหมอได้ไง😤", "Negative"),
            ("ขับรถแย่มาก", "Negative"),
            ("ดีนะครับ", "Positive"),
            ("ลองแล้วรสนี้อร่อย... ชอบๆ", "Positive"),
            ("ฉันรู้สึกโกรธ เวลามือถือแบตหมด", "Negative"),
            ("เธอภูมิใจที่ได้ทำสิ่งดี ๆ และดีใจกับเด็ก ๆ", "Positive"),
            ("นี่เป็นบทความหนึ่ง", "Neutral"),
        ]
        model = GzipModel(training_data)
        self.assertEqual(model.predict("ฉันดีใจ", k=1), "Positive")