-
Notifications
You must be signed in to change notification settings - Fork 3
/
test_mozcpy.py
55 lines (41 loc) · 1.56 KB
/
test_mozcpy.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
49
50
51
52
53
54
55
# -*- coding: utf-8 -*-
import os
import mozcpy
DICT_DIR = os.path.join(os.path.dirname(__file__), 'mozcpy', 'dic')
MECAB_ARGS = '-d %s' % DICT_DIR
def test__convert():
converter = mozcpy.Converter()
actual = converter._convert('いけがみです', 1, MECAB_ARGS)
assert isinstance(actual, str)
assert actual == '池上です'
actual = converter._convert('いけがみです', 2, MECAB_ARGS)
assert isinstance(actual, list)
assert len(actual) == 1
assert actual[0] == '池上です'
def test_convert():
converter = mozcpy.Converter()
actual = converter.convert('いけがみです')
assert isinstance(actual, str)
assert actual == '池上です'
actual = converter.convert('いけがみです', n_best=2)
assert isinstance(actual, list)
assert len(actual) == 1
assert actual[0] == '池上です'
def test_convert_wakati():
converter = mozcpy.Converter()
actual = converter.convert_wakati('いけがみです')
assert isinstance(actual, str)
assert actual == '池上 です'
actual = converter.convert_wakati('いけがみです', n_best=2)
assert isinstance(actual, list)
assert len(actual) == 1
assert actual[0] == '池上 です'
def test_wakati():
converter = mozcpy.Converter()
actual = converter.wakati('いけがみです')
assert isinstance(actual, str)
assert actual == 'いけがみ です'
actual = converter.wakati('いけがみです', n_best=2)
assert isinstance(actual, list)
assert len(actual) == 1
assert actual[0] == 'いけがみ です'