1 | ;; -*- coding:euc-jp -*- |
---|
2 | ;; |
---|
3 | ;; test for mecab module |
---|
4 | ;; |
---|
5 | |
---|
6 | (use gauche.test) |
---|
7 | |
---|
8 | (test-start "mecab") |
---|
9 | (use text.mecab) |
---|
10 | (test-module 'text.mecab) |
---|
11 | |
---|
12 | (test-section "naoya_t") |
---|
13 | ;; |
---|
14 | ;; primitive things |
---|
15 | ;; |
---|
16 | (test-section "[gauche] write-object") |
---|
17 | (let1 mecab (mecab-new2 "") |
---|
18 | (test* "display" "#<mecab>" (with-output-to-string (lambda () (display mecab))))) |
---|
19 | |
---|
20 | (test-section "[gauche] reader-ctor") |
---|
21 | (let1 mecab #,(<mecab> "") ;; with reader-ctor |
---|
22 | (test* "#,(<mecab> \"\")" #t (mecab? mecab)) |
---|
23 | (mecab-destroy mecab)) |
---|
24 | (let1 mecab #,(<mecab> "-Ochasen") ;; with reader-ctor |
---|
25 | (test* "#,(<mecab> \"-Ochasen\")" #t (mecab? mecab)) |
---|
26 | (mecab-destroy mecab)) |
---|
27 | |
---|
28 | (let* ([m (mecab-new2 "")] |
---|
29 | [node (mecab-sparse-tonode m "")] |
---|
30 | [dinfo (mecab-dictionary-info m)]) |
---|
31 | (test-section "[gauche] mecab?") |
---|
32 | (test* "<mecab>" #t (mecab? m)) |
---|
33 | (test* "<mecab-node>" #f (mecab? node)) |
---|
34 | (test* "<mecab-dictionary-info>" #f (mecab? dinfo)) |
---|
35 | (test* "#f" #f (mecab? #f)) |
---|
36 | |
---|
37 | (test-section "[gauche] mecab-node?") |
---|
38 | (test* "<mecab>" #f (mecab-node? m)) |
---|
39 | (test* "<mecab-node>" #t (mecab-node? node)) |
---|
40 | (test* "<mecab-dictionary-info>" #f (mecab-node? dinfo)) |
---|
41 | (test* "#f" #f (mecab-node? #f)) |
---|
42 | |
---|
43 | (test-section "[gauche] mecab-dictionary-info?") |
---|
44 | (test* "<mecab>" #f (mecab-dictionary-info? m)) |
---|
45 | (test* "<mecab-node>" #f (mecab-dictionary-info? node)) |
---|
46 | (test* "<mecab-dictionary-info>" #t (mecab-dictionary-info? dinfo)) |
---|
47 | (test* "#f" #f (mecab-dictionary-info? #f)) |
---|
48 | |
---|
49 | (mecab-destroy m)) |
---|
50 | |
---|
51 | (test-section "mecab-new") |
---|
52 | (let1 m (mecab-new '()) |
---|
53 | (test* "is-a? <mecab>" #t (is-a? m <mecab>)) |
---|
54 | (test* "mecab?" #t (mecab? m)) |
---|
55 | |
---|
56 | (test-section "mecab-destroy") |
---|
57 | (test* "mecab-destroyed?" #f (mecab-destroyed? m)) |
---|
58 | (mecab-destroy m) |
---|
59 | (test* "mecab-destroyed?" #t (mecab-destroyed? m)) |
---|
60 | ) |
---|
61 | |
---|
62 | (test-section "mecab-new2") |
---|
63 | (let1 m (mecab-new2 "") |
---|
64 | (test* "is-a? <mecab>" #t (is-a? m <mecab>)) |
---|
65 | (test* "mecab?" #t (mecab? m)) |
---|
66 | (mecab-destroy m)) |
---|
67 | |
---|
68 | (test-section "mecab-version") |
---|
69 | (test* "mecab-version" "0.98pre1" (mecab-version)) |
---|
70 | |
---|
71 | (test-section "mecab-strerror") |
---|
72 | |
---|
73 | (mecab-new2 "") |
---|
74 | (test* "at mecab-new2 (ok)" "" (mecab-strerror #f)) |
---|
75 | |
---|
76 | (mecab-new2 "-d //") |
---|
77 | ;; "tagger.cpp(149) [load_dictionary_resource(param)] param.cpp(71) [ifs] no such file or directory: //dicrc" |
---|
78 | (test* "at mecab-new (err)" #f (string=? "" (mecab-strerror #f))) |
---|
79 | |
---|
80 | (let1 m (mecab-new2 "") |
---|
81 | (mecab-sparse-tostr m "��Ĥ���") |
---|
82 | (test* "noerr" "" (mecab-strerror m)) |
---|
83 | (mecab-destroy m)) |
---|
84 | |
---|
85 | (let1 m (mecab-new2 "") |
---|
86 | (test-section "mecab-sparse-tostr") |
---|
87 | (test* "��Ĥ���" |
---|
88 | (string-join '("������,*,*,*,*,������� "��\t���ʽ���,*,*,*,��,��,��" |
---|
89 | "���\t��ƻ��Ω,*,*,��ƻ졦�������,������,������,������" |
---|
90 | "��\t�����,*,*,*,*,��,��,��" |
---|
91 | "EOS" |
---|
92 | "") "\n") |
---|
93 | (mecab-sparse-tostr m "��Ĥ���")) |
---|
94 | |
---|
95 | (test-section "mecab-sparse-tostr2") |
---|
96 | (test* "\"��Ĥ���\", len=6" |
---|
97 | (string-join '("������,*,*,*,*,������� "��\t���ʽ���,*,*,*,��,��,��" |
---|
98 | "EOS" |
---|
99 | "") "\n") |
---|
100 | (mecab-sparse-tostr2 m "��Ĥ���" 6)) |
---|
101 | |
---|
102 | (test-section "mecab-sparse-tonode, mecab-node-***") |
---|
103 | (let1 node (mecab-sparse-tonode m "��Ĥ���") |
---|
104 | (test* "mecab-node?" #t (mecab-node? node)) |
---|
105 | (test* "no previous node" #f (mecab-node-prev node)) |
---|
106 | (test* "next node" #t (mecab-node? (mecab-node-next node))) |
---|
107 | (test* "enext" #f (mecab-node? (mecab-node-enext node))) |
---|
108 | (test* "bnext" #f (mecab-node? (mecab-node-bnext node))) |
---|
109 | (test* "surface" "" (mecab-node-surface node)) |
---|
110 | (test* "feature" "BOS/EOS,*,*,*,*,*,*,*,*" (mecab-node-feature node)) |
---|
111 | (test* "length" 0 (mecab-node-length node)) |
---|
112 | (test* "rlength" 0 (mecab-node-rlength node)) |
---|
113 | (test* "id" 0 (mecab-node-id node)) |
---|
114 | (test* "rc-attr" 0 (mecab-node-rc-attr node)) |
---|
115 | (test* "lc-attr" 0 (mecab-node-lc-attr node)) |
---|
116 | (test* "posid" 0 (mecab-node-posid node)) |
---|
117 | (test* "char-type" 0 (mecab-node-char-type node)) |
---|
118 | (test* "stat" 'mecab-bos-node (mecab-node-stat node)) |
---|
119 | (test* "best?" #t (mecab-node-best? node)) |
---|
120 | (test* "alpha" 0.0 (mecab-node-alpha node)) |
---|
121 | (test* "beta" 0.0 (mecab-node-beta node)) |
---|
122 | (test* "prob" 0.0 (mecab-node-prob node)) |
---|
123 | (test* "wcost" 0 (mecab-node-wcost node)) |
---|
124 | (test* "cost" 0 (mecab-node-cost node)) |
---|
125 | |
---|
126 | (set! node (mecab-node-next node)) |
---|
127 | (test* "mecab-node?" #t (mecab-node? node)) |
---|
128 | (test* "previous node" #t (mecab-node? (mecab-node-prev node))) |
---|
129 | (test* "next node" #t (mecab-node? (mecab-node-next node))) |
---|
130 | (test* "enext" #t (mecab-node? (mecab-node-enext node))) |
---|
131 | (test* "bnext" #f (mecab-node? (mecab-node-bnext node))) |
---|
132 | (test* "surface" "��mecab-node-surface node)) |
---|
133 | (test* "feature" "̾���,*,*,*,*,�������(mecab-node-feature node)) |
---|
134 | (test* "length" 3 (mecab-node-length node)) |
---|
135 | (test* "rlength" 3 (mecab-node-rlength node)) |
---|
136 | (test* "id" 1 (mecab-node-id node)) |
---|
137 | (test* "rc-attr" 1285 (mecab-node-rc-attr node)) |
---|
138 | (test* "lc-attr" 1285 (mecab-node-lc-attr node)) |
---|
139 | (test* "posid" 38 (mecab-node-posid node)) |
---|
140 | (test* "char-type" 2 (mecab-node-char-type node)) |
---|
141 | (test* "stat" 'mecab-nor-node (mecab-node-stat node)) |
---|
142 | (test* "best?" #t (mecab-node-best? node)) |
---|
143 | (test* "alpha" 0.0 (mecab-node-alpha node)) |
---|
144 | (test* "beta" 0.0 (mecab-node-beta node)) |
---|
145 | (test* "prob" 0.0 (mecab-node-prob node)) |
---|
146 | (test* "wcost" 7439 (mecab-node-wcost node)) |
---|
147 | (test* "cost" 7156 (mecab-node-cost node)) |
---|
148 | ) |
---|
149 | |
---|
150 | (test-section "mecab-sparse-tonode2") |
---|
151 | (let1 node (mecab-sparse-tonode2 m "��Ĥ���" 6) |
---|
152 | (test* "mecab-node?" #t (mecab-node? node)) |
---|
153 | (test* "feature" "BOS/EOS,*,*,*,*,*,*,*,*" (mecab-node-feature node)) |
---|
154 | (test* "stat" 'mecab-bos-node (mecab-node-stat node)) |
---|
155 | |
---|
156 | (set! node (mecab-node-next node)) |
---|
157 | (test* "mecab-node?" #t (mecab-node? node)) |
---|
158 | (test* "surface" "��mecab-node-surface node)) |
---|
159 | (test* "feature" "̾���,*,*,*,*,�������(mecab-node-feature node)) |
---|
160 | (test* "stat" 'mecab-nor-node (mecab-node-stat node)) |
---|
161 | |
---|
162 | (set! node (mecab-node-next node)) |
---|
163 | (test* "mecab-node?" #t (mecab-node? node)) |
---|
164 | (test* "surface" "��" (mecab-node-surface node)) |
---|
165 | (test* "feature" "���ʽ���,*,*,*,��,��,��" (mecab-node-feature node)) |
---|
166 | (test* "stat" 'mecab-nor-node (mecab-node-stat node)) |
---|
167 | |
---|
168 | (set! node (mecab-node-next node)) |
---|
169 | (test* "mecab-node?" #t (mecab-node? node)) |
---|
170 | (test* "feature" "BOS/EOS,*,*,*,*,*,*,*,*" (mecab-node-feature node)) |
---|
171 | (test* "stat" 'mecab-eos-node (mecab-node-stat node)) |
---|
172 | (test* "no next node" #f (mecab-node-next node)) |
---|
173 | ) |
---|
174 | ; (test-section "mecab-format-node") |
---|
175 | ; (let1 node (mecab-sparse-tonode m "��Ĥ���") |
---|
176 | ; (test* "BOS" "" (mecab-format-node mecab node))) |
---|
177 | (mecab-destroy m)) |
---|
178 | |
---|
179 | (let ([m (mecab-new2 "-l 1")] ;; |
---|
180 | [input "��Ĥ���"]) |
---|
181 | (test-section "mecab-nbest-sparse-tostr") |
---|
182 | (test* #`",|input|, N=1" |
---|
183 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\n���\t��ƻ��Ω,*,*,��ƻ졦�������,������,������,������\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
184 | (mecab-nbest-sparse-tostr m 1 input)) |
---|
185 | (test* #`",|input|, N=2" |
---|
186 | (string-append |
---|
187 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\n���\t��ƻ��Ω,*,*,��ƻ졦�������,������,������,������\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
188 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\n���\t��ƻ��Ω,*,*,��ƻ졦�������,������,������,������\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
189 | ) |
---|
190 | (mecab-nbest-sparse-tostr m 2 input)) |
---|
191 | (test* #`",|input|, N=3" |
---|
192 | (string-append |
---|
193 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\n���\t��ƻ��Ω,*,*,��ƻ졦�������,������,������,������\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
194 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\n���\t��ƻ��Ω,*,*,��ƻ졦�������,������,������,������\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
195 | "������,*,*,*,*,����,����\n��\t���ʽ���,*,*,*,��,��,��\n���\t��ƻ��Ω,*,*,��ƻ졦�������,������,������,������\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
196 | ) |
---|
197 | (mecab-nbest-sparse-tostr m 3 input)) |
---|
198 | |
---|
199 | (test-section "mecab-nbest-sparse-tostr2") |
---|
200 | (test* #`",|input|, N=1" |
---|
201 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\nEOS\n" |
---|
202 | (mecab-nbest-sparse-tostr2 m 1 input 6)) |
---|
203 | (test* #`",|input|, N=2" |
---|
204 | (string-append |
---|
205 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\nEOS\n" |
---|
206 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\nEOS\n" |
---|
207 | ) |
---|
208 | (mecab-nbest-sparse-tostr2 m 2 input 6)) |
---|
209 | (test* #`",|input|, N=3" |
---|
210 | (string-append |
---|
211 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\nEOS\n" |
---|
212 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\nEOS\n" |
---|
213 | "������,*,*,*,*,����,����\n��\t���ʽ���,*,*,*,��,��,��\nEOS\n" |
---|
214 | ) |
---|
215 | (mecab-nbest-sparse-tostr2 m 3 input 6)) |
---|
216 | |
---|
217 | (test-section "mecab-nbest-init") |
---|
218 | (test* "init" 1 (mecab-nbest-init m input)) |
---|
219 | (test-section "mecab-nbest-next-tostr") |
---|
220 | (test* "#1" |
---|
221 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\n���\t��ƻ��Ω,*,*,��ƻ졦�������,������,������,������\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
222 | (mecab-nbest-next-tostr m)) |
---|
223 | (test* "#2" |
---|
224 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\n���\t��ƻ��Ω,*,*,��ƻ졦�������,������,������,������\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
225 | (mecab-nbest-next-tostr m)) |
---|
226 | (test* "#3" |
---|
227 | "������,*,*,*,*,����,����\n��\t���ʽ���,*,*,*,��,��,��\n���\t��ƻ��Ω,*,*,��ƻ졦�������,������,������,������\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
228 | (mecab-nbest-next-tostr m)) |
---|
229 | (test* "#4" |
---|
230 | "������,*,*,*,*,���������\t���³��*,*,*,*,��,��,��\n���\t��ƻ��Ω,*,*,��ƻ졦�������,������,������,������\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
231 | (mecab-nbest-next-tostr m)) |
---|
232 | (test* "#5" |
---|
233 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\n�\t��ƻ��Ω,*,*,��ƻ졦�������,����³,���,����,����\n��\tư����,*,*,��,Ϣ��������,��\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
234 | (mecab-nbest-next-tostr m)) |
---|
235 | (test* "#6" |
---|
236 | "������,*,*,*,*,���������\t���³��*,*,*,*,��,��,��\n���\t��ƻ��Ω,*,*,��ƻ졦�������,������,������,������\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
237 | (mecab-nbest-next-tostr m)) |
---|
238 | (test* "#7" |
---|
239 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\n�\t��ƻ��Ω,*,*,��ƻ졦�������,����³,���,����,����\n��\tư����,*,*,��,Ϣ��������,��\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
240 | (mecab-nbest-next-tostr m)) |
---|
241 | (test* "#8" |
---|
242 | "������,*,*,*,*,���������\t�³��,*,*,*,*,��,��,��\n���\t��ƻ��Ω,*,*,��ƻ졦�������,������,������,������\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
243 | (mecab-nbest-next-tostr m)) |
---|
244 | (test* "#9" |
---|
245 | "������,*,*,*,*,����,����\n��\t���³��*,*,*,*,��,��,��\n���\t��ƻ��Ω,*,*,��ƻ졦�������,������,������,������\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
246 | (mecab-nbest-next-tostr m)) |
---|
247 | (test* "#10" |
---|
248 | "������,*,*,*,*,����,����\n��\t���ʽ���,*,*,*,��,��,��\n�\t��ƻ��Ω,*,*,��ƻ졦�������,����³,���,����,����\n��\tư����,*,*,��,Ϣ��������,��\n��\t�����,*,*,*,*,��,��,��\nEOS\n" |
---|
249 | (mecab-nbest-next-tostr m)) |
---|
250 | (dotimes (i 733) |
---|
251 | (mecab-nbest-next-tostr m)) |
---|
252 | (test* "#744" |
---|
253 | "������,*,*,*,*,����,����\n��\tư����,��ʡ���,�������죲,�����,��\n�\t̾����̾��ϰ��,*,*,�,����,����\n��\tư����,*,*,��,̤��������,��\n��\t̾�����³,*,*,*,*,*\nEOS\n" |
---|
254 | (mecab-nbest-next-tostr m)) |
---|
255 | ;; no more results... |
---|
256 | (test* "#745" #f (mecab-nbest-next-tostr m)) |
---|
257 | (test* "mecab-strerror" #f (string=? "" (mecab-strerror m))) |
---|
258 | |
---|
259 | (test-section "mecab-nbest-init2") |
---|
260 | (test* "init2" 1 (mecab-nbest-init2 m input 6)) |
---|
261 | (test* "#1" |
---|
262 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\nEOS\n" |
---|
263 | (mecab-nbest-next-tostr m)) |
---|
264 | (test* "#2" |
---|
265 | "������,*,*,*,*,���������\t���ʽ���,*,*,*,��,��,��\nEOS\n" |
---|
266 | (mecab-nbest-next-tostr m)) |
---|
267 | (test* "#3" |
---|
268 | "������,*,*,*,*,����,����\n��\t���ʽ���,*,*,*,��,��,��\nEOS\n" |
---|
269 | (mecab-nbest-next-tostr m)) |
---|
270 | (dotimes (i 8) (mecab-nbest-next-tostr m)) |
---|
271 | (test* "#12" |
---|
272 | "������,*,*,*,*,����,����\n��\tư����,��ʡ���,�������죲,�����,��\nEOS\n" |
---|
273 | (mecab-nbest-next-tostr m)) |
---|
274 | ;; no more results... |
---|
275 | (test* "#13" #f (mecab-nbest-next-tostr m)) |
---|
276 | (test* "mecab-strerror" #f (string=? "" (mecab-strerror m))) |
---|
277 | |
---|
278 | (test-section "mecab-nbest-next-tonode") |
---|
279 | (mecab-nbest-init m input) |
---|
280 | (test* "#1" #t (mecab-node? (mecab-nbest-next-tonode m))) |
---|
281 | (dotimes (i 742) (mecab-nbest-next-tonode m)) |
---|
282 | (test* "#744" #t (mecab-node? (mecab-nbest-next-tonode m))); EOS |
---|
283 | ;; no more results... |
---|
284 | (test* "#745" #f (mecab-node? (mecab-nbest-next-tonode m))) |
---|
285 | (test* "mecab-strerror" #f (string=? "" (mecab-strerror m))) |
---|
286 | |
---|
287 | (mecab-destroy m)) |
---|
288 | |
---|
289 | ;; |
---|
290 | ;; these values below may differ !!! |
---|
291 | (test-section "mecab-dictionary-info, mecab-dictionary-info-***") |
---|
292 | (let* ([m (mecab-new2 "")] |
---|
293 | [dinfo (mecab-dictionary-info m)]) |
---|
294 | (test* "mecab-dictionary-info?" #t (mecab-dictionary-info? dinfo)) |
---|
295 | (test* "mecab-dictionary-info-filename" |
---|
296 | "/usr/local/lib/mecab/dic/ipadic/sys.dic" (mecab-dictionary-info-filename dinfo)) |
---|
297 | (test* "mecab-dictionary-info-charset" |
---|
298 | "utf8" (mecab-dictionary-info-charset dinfo)) |
---|
299 | (test* "mecab-dictionary-info-size" |
---|
300 | 392126 (mecab-dictionary-info-size dinfo)) |
---|
301 | (test* "mecab-dictionary-info-type" 'mecab-sys-dic (mecab-dictionary-info-type dinfo)) |
---|
302 | (test* "mecab-dictionary-info-lsize" |
---|
303 | 1316 (mecab-dictionary-info-lsize dinfo)) |
---|
304 | (test* "mecab-dictionary-info-rsize" |
---|
305 | 1316 (mecab-dictionary-info-rsize dinfo)) |
---|
306 | (test* "mecab-dictionary-info-version" |
---|
307 | 102 (mecab-dictionary-info-version dinfo)) |
---|
308 | ; (let1 next-dinfo (mecab-dictionary-info-next dinfo) |
---|
309 | ; (test* "has next?" #t (mecab-dictionary-info? next-dinfo))) |
---|
310 | (mecab-destroy m)) |
---|
311 | |
---|
312 | (let1 m (mecab-new2 "") |
---|
313 | (test-section "mecab-get[set]-partial: �ʬ��θ��ߤΥ⡼��0/1)") |
---|
314 | (test* "default partial mode" 0 (mecab-get-partial m)) |
---|
315 | (mecab-set-partial m 1) |
---|
316 | (test* "set to 1" 1 (mecab-get-partial m)) |
---|
317 | (mecab-set-partial m 0) |
---|
318 | (test* "set to 0" 0 (mecab-get-partial m)) |
---|
319 | |
---|
320 | (test-section "mecab-get[set]-theta: ���ե������β���ѥ�����") |
---|
321 | (test* "default theta" 0.75 (mecab-get-theta m)) |
---|
322 | (mecab-set-theta m 1.0) |
---|
323 | (test* "set to 1.0" 1.0 (mecab-get-theta m)) |
---|
324 | (mecab-set-theta m 0.5) |
---|
325 | (test* "set to 0.5" 0.5 (mecab-get-theta m)) |
---|
326 | |
---|
327 | (test-section "mecab-get[set]-lattice-level: ����������0/1/2)") |
---|
328 | (test* "default lattice level" 0 (mecab-get-lattice-level m)) |
---|
329 | (mecab-set-lattice-level m 1) |
---|
330 | (test* "set to 1" 1 (mecab-get-lattice-level m)) |
---|
331 | (mecab-set-lattice-level m 2) |
---|
332 | (test* "set to 2" 2 (mecab-get-lattice-level m)) |
---|
333 | (mecab-set-lattice-level m 0) |
---|
334 | (test* "set to 0" 0 (mecab-get-lattice-level m)) |
---|
335 | |
---|
336 | (test-section "mecab-get[set]-all-morphs: ��ϥ⡼��0/1)") |
---|
337 | (test* "default all-morphs" 0 (mecab-get-all-morphs m)) |
---|
338 | (mecab-set-all-morphs m 1) |
---|
339 | (test* "set to 1" 1 (mecab-get-all-morphs m)) |
---|
340 | (mecab-set-all-morphs m 0) |
---|
341 | (test* "set to 0" 0 (mecab-get-all-morphs m)) |
---|
342 | ) |
---|
343 | |
---|
344 | ;;;;;;;;;; |
---|
345 | ;; |
---|
346 | ;; TO DO |
---|
347 | ;; |
---|
348 | ;;(test-section "mecab-do") |
---|
349 | ;;(test-section "mecab-dict-index") |
---|
350 | ;;(test-section "mecab-dict-gen") |
---|
351 | ;;(test-section "mecab-cost-train") |
---|
352 | ;;(test-section "mecab-system-eval") |
---|
353 | ;;(test-section "mecab-test-gen") |
---|
354 | |
---|
355 | ;;; |
---|
356 | ;;; tagger (message passing) |
---|
357 | ;;; |
---|
358 | (test-section "tagger") |
---|
359 | (let1 tagger (mecab-tagger "") |
---|
360 | (test* "tagger'parse-to-string" |
---|
361 | (string-join '("���\t̾���ǽ,*,*,*,*,���,���祦,���硼" |
---|
362 | "��������*,*,*,*,���� "��\tư���Ω,*,*,������������������,��" |
---|
363 | "�ʤ�\t���,*,*,��졦�ʥ�,����ʤ�,�ʥ�,�ʥ�" |
---|
364 | "��t���³��*,*,*,*,������ |
---|
365 | "��t������*,*,*,*,������ |
---|
366 | "EOS" |
---|
367 | "") "\n") |
---|
368 | ([tagger'parse-to-string] "����⤷�ʤ��Ȥ�)) |
---|
369 | |
---|
370 | (let1 node ([tagger'parse-to-node] "����⤷�ʤ��Ȥ�) |
---|
371 | (test* "mecab-node?" #t (mecab-node? node)) |
---|
372 | (test* "mecab-node-surface" "" (mecab-node-surface node)) |
---|
373 | (test* "mecab-node-feature" "BOS/EOS,*,*,*,*,*,*,*,*" (mecab-node-feature node)) |
---|
374 | (test* "mecab-node-cost" 0 (mecab-node-cost node)) |
---|
375 | |
---|
376 | (set! node (mecab-node-next node)) |
---|
377 | (test* "mecab-node?" #t (mecab-node? node)) |
---|
378 | (test* "mecab-node-surface" "���" (mecab-node-surface node)) |
---|
379 | (test* "mecab-node-feature" "̾���ǽ,*,*,*,*,���,���祦,���硼" (mecab-node-feature node)) |
---|
380 | (test* "mecab-node-cost" 3947 (mecab-node-cost node)) |
---|
381 | ;;(test* "format-node" "" ([tagger'format-node] node)) |
---|
382 | |
---|
383 | (set! node (mecab-node-next node)) |
---|
384 | (test* "mecab-node?" #t (mecab-node? node)) |
---|
385 | (test* "mecab-node-surface" "��(mecab-node-surface node)) |
---|
386 | (test* "mecab-node-feature" "������*,*,*,*,����(mecab-node-feature node)) |
---|
387 | (test* "mecab-node-cost" 5553 (mecab-node-cost node)) |
---|
388 | |
---|
389 | (set! node (mecab-node-next node)) |
---|
390 | (test* "mecab-node?" #t (mecab-node? node)) |
---|
391 | (test* "mecab-node-surface" "��" (mecab-node-surface node)) |
---|
392 | (test* "mecab-node-feature" "ư���Ω,*,*,������������������,��" (mecab-node-feature node)) |
---|
393 | (test* "mecab-node-cost" 11566 (mecab-node-cost node)) |
---|
394 | |
---|
395 | (set! node (mecab-node-next node)) |
---|
396 | (test* "mecab-node?" #t (mecab-node? node)) |
---|
397 | (test* "mecab-node-surface" "�ʤ�" (mecab-node-surface node)) |
---|
398 | (test* "mecab-node-feature" "���,*,*,��졦�ʥ�,����ʤ�,�ʥ�,�ʥ�" (mecab-node-feature node)) |
---|
399 | (test* "mecab-node-cost" 3601 (mecab-node-cost node)) |
---|
400 | |
---|
401 | (set! node (mecab-node-next node)) |
---|
402 | (test* "mecab-node?" #t (mecab-node? node)) |
---|
403 | (test* "mecab-node-surface" "�� (mecab-node-surface node)) |
---|
404 | (test* "mecab-node-feature" "���³��*,*,*,*,������ (mecab-node-feature node)) |
---|
405 | (test* "mecab-node-cost" 4716 (mecab-node-cost node)) |
---|
406 | |
---|
407 | (set! node (mecab-node-next node)) |
---|
408 | (test* "mecab-node?" #t (mecab-node? node)) |
---|
409 | (test* "mecab-node-surface" "�� (mecab-node-surface node)) |
---|
410 | (test* "mecab-node-feature" "������*,*,*,*,������ (mecab-node-feature node)) |
---|
411 | (test* "mecab-node-cost" 10676 (mecab-node-cost node)) |
---|
412 | |
---|
413 | (set! node (mecab-node-next node)) |
---|
414 | (test* "mecab-node?" #t (mecab-node? node)) |
---|
415 | (test* "mecab-node-surface" "" (mecab-node-surface node)) |
---|
416 | (test* "mecab-node-feature" "BOS/EOS,*,*,*,*,*,*,*,*" (mecab-node-feature node)) |
---|
417 | (test* "mecab-node-cost" 8292 (mecab-node-cost node)) |
---|
418 | |
---|
419 | (set! node (mecab-node-next node)) |
---|
420 | (test* "mecab-node?" #f (mecab-node? node)) |
---|
421 | )) |
---|
422 | |
---|
423 | (test-end) |
---|