-
Notifications
You must be signed in to change notification settings - Fork 87
/
test.py
executable file
·48 lines (35 loc) · 1.23 KB
/
test.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================
#
# Copyright (c) 2017 <stakeholder> All Rights Reserved
#
#
# Author: Hai Liang Wang
# Date: 2018-07-22:16:27:53
#
#===============================================================================
"""
TODO: Module comments at here
"""
__copyright__ = "Copyright (c) 2017 . All Rights Reserved"
__author__ = "Hai Liang Wang"
__date__ = "2017-07-22:16:27:53"
import os
import sys
import unittest
curdir = os.path.dirname(os.path.abspath(__file__))
from hmm import Tokenizer
import util as helper
class HMMSegTest(unittest.TestCase):
def setUp(self):
self.T = Tokenizer()
def test_punctuation(self):
print('作为市长,我也体会到这种危险。 ==> ', '/'.join(self.T.cut('作为市长,我也体会到这种危险。', punctuation = False)))
def test_basecase(self):
print('长春市长春节致词。 ==>', '/'.join(self.T.cut('长春市长春节致词。', punctuation = True)))
def test_oov(self):
print('OOV:', ' '.join(self.T.cut('温济泽')))
print('OOV:', ' '.join(self.T.cut('桑新')))
if __name__ == '__main__':
unittest.main()