-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest_cws.py
67 lines (41 loc) · 3.26 KB
/
test_cws.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
56
57
58
59
60
61
62
63
64
65
66
from tokenization import CWSNewTokenizer
tokenizer = CWSNewTokenizer('res/wubi_cws_22675_0.65.vocab', 'res/wubi_cws_22675_0.65.model', 'res/wubi_cws_22675_0.65.cws_vocab')
print (0.65)
print(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!'))
print(tokenizer.convert_tokens_to_ids(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!')))
print ()
tokenizer = CWSNewTokenizer('res/wubi_cws_22675_0.7.vocab', 'res/wubi_cws_22675_0.7.model', 'res/wubi_cws_22675_0.7.cws_vocab')
print (0.7)
print(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!'))
print(tokenizer.convert_tokens_to_ids(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!')))
print ()
tokenizer = CWSNewTokenizer('res/wubi_cws_22675_0.75.vocab', 'res/wubi_cws_22675_0.75.model', 'res/wubi_cws_22675_0.75.cws_vocab')
print (0.75)
print(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!'))
print(tokenizer.convert_tokens_to_ids(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!')))
print ()
tokenizer = CWSNewTokenizer('res/wubi_cws_22675_0.8.vocab', 'res/wubi_cws_22675_0.8.model', 'res/wubi_cws_22675_0.8.cws_vocab')
print (0.8)
print(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!'))
print(tokenizer.convert_tokens_to_ids(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!')))
print ()
tokenizer = CWSNewTokenizer('res/pinyin_cws_22675_0.65.vocab', 'res/pinyin_cws_22675_0.65.model', 'res/pinyin_cws_22675_0.65.cws_vocab')
print (0.65)
print(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!'))
print(tokenizer.convert_tokens_to_ids(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!')))
print ()
tokenizer = CWSNewTokenizer('res/pinyin_cws_22675_0.7.vocab', 'res/pinyin_cws_22675_0.7.model', 'res/pinyin_cws_22675_0.7.cws_vocab')
print (0.7)
print(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!'))
print(tokenizer.convert_tokens_to_ids(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!')))
print ()
tokenizer = CWSNewTokenizer('res/pinyin_cws_22675_0.75.vocab', 'res/pinyin_cws_22675_0.75.model', 'res/pinyin_cws_22675_0.75.cws_vocab')
print (0.75)
print(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!'))
print(tokenizer.convert_tokens_to_ids(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!')))
print ()
tokenizer = CWSNewTokenizer('res/pinyin_cws_22675_0.8.vocab', 'res/pinyin_cws_22675_0.8.model', 'res/pinyin_cws_22675_0.8.cws_vocab')
print (0.8)
print(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!'))
print(tokenizer.convert_tokens_to_ids(tokenizer.tokenize('如今把事实指出,愈使魑魅魍魉无所遁形于光天化日之下了!')))
print ()