1 //
2 // MeCab -- Yet Another Part-of-Speech and Morphological Analyzer
3 //
4 // Copyright(C) 2001-2006 Taku Kudo <taku@chasen.org>
5 // Copyright(C) 2004-2006 Nippon Telegraph and Telephone Corporation
6 #if defined(_WIN32) && !defined(__CYGWIN__)
7 #include <windows.h>
8 #endif
9
10 #include "mecab.h"
11 #include "tokenizer.h"
12 #include "utils.h"
13
14 #ifdef HAVE_CONFIG_H
15 #include "config.h"
16 #endif
17
18 namespace {
19 const char kUnknownError[] = "Unknown Error";
20 const size_t kErrorBufferSize = 256;
21 }
22
23 #if defined(_WIN32) && !defined(__CYGWIN__)
24 namespace {
25 DWORD g_tls_index = TLS_OUT_OF_INDEXES;
26 }
27
getGlobalError()28 const char *getGlobalError() {
29 LPVOID data = ::TlsGetValue(g_tls_index);
30 return data == NULL ? kUnknownError : reinterpret_cast<const char *>(data);
31 }
32
setGlobalError(const char * str)33 void setGlobalError(const char *str) {
34 char *data = reinterpret_cast<char *>(::TlsGetValue(g_tls_index));
35 if (data == NULL) {
36 return;
37 }
38 strncpy(data, str, kErrorBufferSize - 1);
39 data[kErrorBufferSize - 1] = '\0';
40 }
41
42 HINSTANCE DllInstance = 0;
43
44 extern "C" {
DllMain(HINSTANCE hinst,DWORD dwReason,LPVOID)45 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID) {
46 LPVOID data = 0;
47 if (!DllInstance) {
48 DllInstance = hinst;
49 }
50 switch (dwReason) {
51 case DLL_PROCESS_ATTACH:
52 if ((g_tls_index = ::TlsAlloc()) == TLS_OUT_OF_INDEXES) {
53 return FALSE;
54 }
55 // Not break in order to initialize the TLS.
56 case DLL_THREAD_ATTACH:
57 data = (LPVOID)::LocalAlloc(LPTR, kErrorBufferSize);
58 if (data) {
59 ::TlsSetValue(g_tls_index, data);
60 }
61 break;
62 case DLL_THREAD_DETACH:
63 data = ::TlsGetValue(g_tls_index);
64 if (data) {
65 ::LocalFree((HLOCAL)data);
66 }
67 break;
68 case DLL_PROCESS_DETACH:
69 data = ::TlsGetValue(g_tls_index);
70 if (data) {
71 ::LocalFree((HLOCAL)data);
72 }
73 ::TlsFree(g_tls_index);
74 g_tls_index = TLS_OUT_OF_INDEXES;
75 break;
76 default:
77 break;
78 }
79 return TRUE;
80 }
81 }
82 #else // _WIN32
83 namespace {
84 #ifdef HAVE_TLS_KEYWORD
85 __thread char kErrorBuffer[kErrorBufferSize];
86 #else
87 char kErrorBuffer[kErrorBufferSize];
88 #endif
89 }
90
getGlobalError()91 const char *getGlobalError() {
92 return kErrorBuffer;
93 }
94
setGlobalError(const char * str)95 void setGlobalError(const char *str) {
96 strncpy(kErrorBuffer, str, kErrorBufferSize - 1);
97 kErrorBuffer[kErrorBufferSize - 1] = '\0';
98 }
99 #endif
100
mecab_new(int argc,char ** argv)101 mecab_t* mecab_new(int argc, char **argv) {
102 MeCab::Tagger *tagger = MeCab::createTagger(argc, argv);
103 if (!tagger) {
104 MeCab::deleteTagger(tagger);
105 return 0;
106 }
107 return reinterpret_cast<mecab_t *>(tagger);
108 }
109
mecab_new2(const char * arg)110 mecab_t* mecab_new2(const char *arg) {
111 MeCab::Tagger *tagger = MeCab::createTagger(arg);
112 if (!tagger) {
113 MeCab::deleteTagger(tagger);
114 return 0;
115 }
116 return reinterpret_cast<mecab_t *>(tagger);
117 }
118
mecab_version()119 const char *mecab_version() {
120 return MeCab::Tagger::version();
121 }
122
mecab_strerror(mecab_t * tagger)123 const char* mecab_strerror(mecab_t *tagger) {
124 if (!tagger) {
125 return MeCab::getLastError();
126 }
127 return reinterpret_cast<MeCab::Tagger *>(tagger)->what();
128 }
129
mecab_destroy(mecab_t * tagger)130 void mecab_destroy(mecab_t *tagger) {
131 MeCab::Tagger *ptr = reinterpret_cast<MeCab::Tagger *>(tagger);
132 MeCab::deleteTagger(ptr);
133 ptr = 0;
134 }
135
mecab_get_partial(mecab_t * tagger)136 int mecab_get_partial(mecab_t *tagger) {
137 return reinterpret_cast<MeCab::Tagger *>(tagger)->partial();
138 }
139
mecab_set_partial(mecab_t * tagger,int partial)140 void mecab_set_partial(mecab_t *tagger, int partial) {
141 reinterpret_cast<MeCab::Tagger *>(tagger)->set_partial(partial);
142 }
143
mecab_get_theta(mecab_t * tagger)144 float mecab_get_theta(mecab_t *tagger) {
145 return reinterpret_cast<MeCab::Tagger *>(tagger)->theta();
146 }
147
mecab_set_theta(mecab_t * tagger,float theta)148 void mecab_set_theta(mecab_t *tagger, float theta) {
149 reinterpret_cast<MeCab::Tagger *>(tagger)->set_theta(theta);
150 }
151
mecab_get_lattice_level(mecab_t * tagger)152 int mecab_get_lattice_level(mecab_t *tagger) {
153 return reinterpret_cast<MeCab::Tagger *>(tagger)->lattice_level();
154 }
155
mecab_set_lattice_level(mecab_t * tagger,int level)156 void mecab_set_lattice_level(mecab_t *tagger, int level) {
157 reinterpret_cast<MeCab::Tagger *>(tagger)->set_lattice_level(level);
158 }
159
mecab_get_all_morphs(mecab_t * tagger)160 int mecab_get_all_morphs(mecab_t *tagger) {
161 return static_cast<int>(
162 reinterpret_cast<MeCab::Tagger *>(tagger)->all_morphs());
163 }
164
mecab_set_all_morphs(mecab_t * tagger,int all_morphs)165 void mecab_set_all_morphs(mecab_t *tagger, int all_morphs) {
166 reinterpret_cast<MeCab::Tagger *>(tagger)->set_all_morphs(all_morphs);
167 }
168
mecab_sparse_tostr(mecab_t * tagger,const char * str)169 const char* mecab_sparse_tostr(mecab_t *tagger, const char *str) {
170 return reinterpret_cast<MeCab::Tagger *>(tagger)->parse(str);
171 }
172
mecab_sparse_tostr2(mecab_t * tagger,const char * str,size_t len)173 const char* mecab_sparse_tostr2(mecab_t *tagger, const char *str, size_t len) {
174 return reinterpret_cast<MeCab::Tagger *>(tagger)->parse(str, len);
175 }
176
mecab_sparse_tostr3(mecab_t * tagger,const char * str,size_t len,char * out,size_t len2)177 char* mecab_sparse_tostr3(mecab_t *tagger, const char *str, size_t len,
178 char *out, size_t len2) {
179 return const_cast<char *>(
180 reinterpret_cast<MeCab::Tagger *>(tagger)->parse(
181 str, len, out, len2));
182 }
183
mecab_sparse_tonode(mecab_t * tagger,const char * str)184 const mecab_node_t* mecab_sparse_tonode(mecab_t *tagger, const char *str) {
185 return reinterpret_cast<const mecab_node_t *>(
186 reinterpret_cast<MeCab::Tagger *>(tagger)->parseToNode(str));
187 }
188
mecab_sparse_tonode2(mecab_t * tagger,const char * str,size_t len)189 const mecab_node_t* mecab_sparse_tonode2(mecab_t *tagger,
190 const char *str, size_t len) {
191 return reinterpret_cast<const mecab_node_t *>(
192 reinterpret_cast<MeCab::Tagger *>(tagger)->parseToNode(str, len));
193 }
194
mecab_nbest_sparse_tostr(mecab_t * tagger,size_t N,const char * str)195 const char* mecab_nbest_sparse_tostr(mecab_t *tagger, size_t N,
196 const char *str) {
197 return reinterpret_cast<MeCab::Tagger *>(tagger)->parseNBest(N, str);
198 }
199
mecab_nbest_sparse_tostr2(mecab_t * tagger,size_t N,const char * str,size_t len)200 const char* mecab_nbest_sparse_tostr2(mecab_t *tagger, size_t N,
201 const char* str, size_t len) {
202 return reinterpret_cast<MeCab::Tagger *>(
203 tagger)->parseNBest(N, str, len);
204 }
205
mecab_nbest_sparse_tostr3(mecab_t * tagger,size_t N,const char * str,size_t len,char * out,size_t len2)206 char* mecab_nbest_sparse_tostr3(mecab_t *tagger, size_t N,
207 const char *str, size_t len,
208 char *out, size_t len2) {
209 return const_cast<char *>(
210 reinterpret_cast<MeCab::Tagger *>(
211 tagger)->parseNBest(N, str, len, out, len2));
212 }
213
mecab_nbest_init(mecab_t * tagger,const char * str)214 int mecab_nbest_init(mecab_t *tagger, const char *str) {
215 return reinterpret_cast<
216 MeCab::Tagger *>(tagger)->parseNBestInit(str);
217 }
218
mecab_nbest_init2(mecab_t * tagger,const char * str,size_t len)219 int mecab_nbest_init2(mecab_t *tagger, const char *str, size_t len) {
220 return reinterpret_cast<
221 MeCab::Tagger *>(tagger)->parseNBestInit(str, len);
222 }
223
mecab_nbest_next_tostr(mecab_t * tagger)224 const char* mecab_nbest_next_tostr(mecab_t *tagger) {
225 return reinterpret_cast<MeCab::Tagger *>(tagger)->next();
226 }
227
mecab_nbest_next_tostr2(mecab_t * tagger,char * out,size_t len2)228 char* mecab_nbest_next_tostr2(mecab_t *tagger, char *out, size_t len2) {
229 return const_cast<char *>(
230 reinterpret_cast<MeCab::Tagger *>(tagger)->next(out, len2));
231 }
232
mecab_nbest_next_tonode(mecab_t * tagger)233 const mecab_node_t* mecab_nbest_next_tonode(mecab_t *tagger) {
234 return reinterpret_cast<const mecab_node_t *>(
235 reinterpret_cast<MeCab::Tagger *>(tagger)->nextNode());
236 }
237
mecab_format_node(mecab_t * tagger,const mecab_node_t * n)238 const char* mecab_format_node(mecab_t *tagger, const mecab_node_t* n) {
239 return reinterpret_cast<MeCab::Tagger *>(tagger)->formatNode(n);
240 }
241
mecab_dictionary_info(mecab_t * tagger)242 const mecab_dictionary_info_t *mecab_dictionary_info(mecab_t *tagger) {
243 return reinterpret_cast<const mecab_dictionary_info_t *>(
244 reinterpret_cast<MeCab::Tagger *>(tagger)->dictionary_info());
245 }
246
mecab_parse_lattice(mecab_t * mecab,mecab_lattice_t * lattice)247 int mecab_parse_lattice(mecab_t *mecab, mecab_lattice_t *lattice) {
248 return static_cast<int>(
249 reinterpret_cast<MeCab::Tagger *>(mecab)->parse(
250 reinterpret_cast<MeCab::Lattice *>(lattice)));
251 }
252
mecab_lattice_new()253 mecab_lattice_t *mecab_lattice_new() {
254 return reinterpret_cast<mecab_lattice_t *>(MeCab::createLattice());
255 }
256
mecab_lattice_destroy(mecab_lattice_t * lattice)257 void mecab_lattice_destroy(mecab_lattice_t *lattice) {
258 MeCab::Lattice *ptr = reinterpret_cast<MeCab::Lattice *>(lattice);
259 MeCab::deleteLattice(ptr);
260 ptr = 0;
261 }
262
mecab_lattice_clear(mecab_lattice_t * lattice)263 void mecab_lattice_clear(mecab_lattice_t *lattice) {
264 reinterpret_cast<MeCab::Lattice *>(lattice)->clear();
265 }
266
mecab_lattice_is_available(mecab_lattice_t * lattice)267 int mecab_lattice_is_available(mecab_lattice_t *lattice) {
268 return static_cast<int>(
269 reinterpret_cast<MeCab::Lattice *>(lattice)->is_available());
270 }
mecab_lattice_get_bos_node(mecab_lattice_t * lattice)271 mecab_node_t *mecab_lattice_get_bos_node(mecab_lattice_t *lattice) {
272 return reinterpret_cast<mecab_node_t *>(
273 reinterpret_cast<MeCab::Lattice *>(lattice)->bos_node());
274 }
275
mecab_lattice_get_eos_node(mecab_lattice_t * lattice)276 mecab_node_t *mecab_lattice_get_eos_node(mecab_lattice_t *lattice) {
277 return reinterpret_cast<mecab_node_t *>(
278 reinterpret_cast<MeCab::Lattice *>(lattice)->eos_node());
279 }
280
mecab_lattice_get_all_begin_nodes(mecab_lattice_t * lattice)281 mecab_node_t **mecab_lattice_get_all_begin_nodes(mecab_lattice_t *lattice) {
282 return reinterpret_cast<mecab_node_t **>(
283 reinterpret_cast<MeCab::Lattice *>(lattice)->begin_nodes());
284 }
285
mecab_lattice_get_all_end_nodes(mecab_lattice_t * lattice)286 mecab_node_t **mecab_lattice_get_all_end_nodes(mecab_lattice_t *lattice) {
287 return reinterpret_cast<mecab_node_t **>(
288 reinterpret_cast<MeCab::Lattice *>(lattice)->end_nodes());
289 }
290
mecab_lattice_get_begin_nodes(mecab_lattice_t * lattice,size_t pos)291 mecab_node_t *mecab_lattice_get_begin_nodes(mecab_lattice_t *lattice,
292 size_t pos) {
293 return reinterpret_cast<mecab_node_t *>(
294 reinterpret_cast<MeCab::Lattice *>(lattice)->begin_nodes(pos));
295 }
296
mecab_lattice_get_end_nodes(mecab_lattice_t * lattice,size_t pos)297 mecab_node_t *mecab_lattice_get_end_nodes(mecab_lattice_t *lattice,
298 size_t pos) {
299 return reinterpret_cast<mecab_node_t *>(
300 reinterpret_cast<MeCab::Lattice *>(lattice)->end_nodes(pos));
301 }
302
mecab_lattice_get_sentence(mecab_lattice_t * lattice)303 const char *mecab_lattice_get_sentence(mecab_lattice_t *lattice) {
304 return reinterpret_cast<MeCab::Lattice *>(lattice)->sentence();
305 }
306
mecab_lattice_set_sentence(mecab_lattice_t * lattice,const char * sentence)307 void mecab_lattice_set_sentence(mecab_lattice_t *lattice,
308 const char *sentence) {
309 reinterpret_cast<MeCab::Lattice *>(lattice)->set_sentence(sentence);
310 }
311
mecab_lattice_set_sentence2(mecab_lattice_t * lattice,const char * sentence,size_t len)312 void mecab_lattice_set_sentence2(mecab_lattice_t *lattice,
313 const char *sentence, size_t len) {
314 reinterpret_cast<MeCab::Lattice *>(lattice)->set_sentence(
315 sentence, len);
316 }
317
mecab_lattice_get_size(mecab_lattice_t * lattice)318 size_t mecab_lattice_get_size(mecab_lattice_t *lattice) {
319 return reinterpret_cast<MeCab::Lattice *>(lattice)->size();
320 }
321
mecab_lattice_get_z(mecab_lattice_t * lattice)322 double mecab_lattice_get_z(mecab_lattice_t *lattice) {
323 return reinterpret_cast<MeCab::Lattice *>(lattice)->Z();
324 }
325
mecab_lattice_set_z(mecab_lattice_t * lattice,double Z)326 void mecab_lattice_set_z(mecab_lattice_t *lattice, double Z) {
327 reinterpret_cast<MeCab::Lattice *>(lattice)->set_Z(Z);
328 }
329
mecab_lattice_get_theta(mecab_lattice_t * lattice)330 double mecab_lattice_get_theta(mecab_lattice_t *lattice) {
331 return reinterpret_cast<MeCab::Lattice *>(lattice)->theta();
332 }
333
mecab_lattice_set_theta(mecab_lattice_t * lattice,double theta)334 void mecab_lattice_set_theta(mecab_lattice_t *lattice, double theta) {
335 reinterpret_cast<MeCab::Lattice *>(lattice)->set_theta(theta);
336 }
337
mecab_lattice_next(mecab_lattice_t * lattice)338 int mecab_lattice_next(mecab_lattice_t *lattice) {
339 return static_cast<int>(
340 reinterpret_cast<MeCab::Lattice *>(lattice)->next());
341 }
342
mecab_lattice_get_request_type(mecab_lattice_t * lattice)343 int mecab_lattice_get_request_type(mecab_lattice_t *lattice) {
344 return reinterpret_cast<MeCab::Lattice *>(lattice)->request_type();
345 }
346
mecab_lattice_has_request_type(mecab_lattice_t * lattice,int request_type)347 int mecab_lattice_has_request_type(mecab_lattice_t *lattice,
348 int request_type) {
349 return reinterpret_cast<MeCab::Lattice *>(
350 lattice)->has_request_type(request_type);
351 }
352
mecab_lattice_set_request_type(mecab_lattice_t * lattice,int request_type)353 void mecab_lattice_set_request_type(mecab_lattice_t *lattice,
354 int request_type) {
355 reinterpret_cast<MeCab::Lattice *>(
356 lattice)->set_request_type(request_type);
357 }
358
mecab_lattice_add_request_type(mecab_lattice_t * lattice,int request_type)359 void mecab_lattice_add_request_type(mecab_lattice_t *lattice,
360 int request_type) {
361 reinterpret_cast<MeCab::Lattice *>(
362 lattice)->add_request_type(request_type);
363 }
364
mecab_lattice_remove_request_type(mecab_lattice_t * lattice,int request_type)365 void mecab_lattice_remove_request_type(mecab_lattice_t *lattice,
366 int request_type) {
367 return reinterpret_cast<MeCab::Lattice *>(
368 lattice)->remove_request_type(request_type);
369 }
370
mecab_lattice_new_node(mecab_lattice_t * lattice)371 mecab_node_t *mecab_lattice_new_node(mecab_lattice_t *lattice) {
372 return reinterpret_cast<mecab_node_t *>(
373 reinterpret_cast<MeCab::Lattice *>(lattice)->newNode());
374 }
375
mecab_lattice_tostr(mecab_lattice_t * lattice)376 const char *mecab_lattice_tostr(mecab_lattice_t *lattice) {
377 return reinterpret_cast<MeCab::Lattice *>(lattice)->toString();
378 }
379
mecab_lattice_tostr2(mecab_lattice_t * lattice,char * buf,size_t size)380 const char *mecab_lattice_tostr2(mecab_lattice_t *lattice,
381 char *buf, size_t size) {
382 return reinterpret_cast<MeCab::Lattice *>(
383 lattice)->toString(buf, size);
384 }
mecab_lattice_nbest_tostr(mecab_lattice_t * lattice,size_t N)385 const char *mecab_lattice_nbest_tostr(mecab_lattice_t *lattice,
386 size_t N) {
387 return reinterpret_cast<MeCab::Lattice *>(
388 lattice)->enumNBestAsString(N);
389 }
mecab_lattice_nbest_tostr2(mecab_lattice_t * lattice,size_t N,char * buf,size_t size)390 const char *mecab_lattice_nbest_tostr2(mecab_lattice_t *lattice,
391 size_t N, char *buf, size_t size) {
392 return reinterpret_cast<MeCab::Lattice *>(
393 lattice)->enumNBestAsString(N, buf, size);
394 }
395
mecab_lattice_has_constraint(mecab_lattice_t * lattice)396 int mecab_lattice_has_constraint(mecab_lattice_t *lattice) {
397 return static_cast<bool>(reinterpret_cast<MeCab::Lattice *>(
398 lattice)->has_constraint());
399 }
400
mecab_lattice_get_boundary_constraint(mecab_lattice_t * lattice,size_t pos)401 int mecab_lattice_get_boundary_constraint(mecab_lattice_t *lattice,
402 size_t pos) {
403 return reinterpret_cast<MeCab::Lattice *>(
404 lattice)->boundary_constraint(pos);
405 }
406
mecab_lattice_get_feature_constraint(mecab_lattice_t * lattice,size_t pos)407 const char *mecab_lattice_get_feature_constraint(mecab_lattice_t *lattice,
408 size_t pos) {
409 return reinterpret_cast<MeCab::Lattice *>(
410 lattice)->feature_constraint(pos);
411 }
412
mecab_lattice_set_boundary_constraint(mecab_lattice_t * lattice,size_t pos,int boundary_type)413 void mecab_lattice_set_boundary_constraint(mecab_lattice_t *lattice,
414 size_t pos, int boundary_type) {
415 return reinterpret_cast<MeCab::Lattice *>(
416 lattice)->set_boundary_constraint(pos, boundary_type);
417 }
418
mecab_lattice_set_feature_constraint(mecab_lattice_t * lattice,size_t begin_pos,size_t end_pos,const char * feature)419 void mecab_lattice_set_feature_constraint(mecab_lattice_t *lattice,
420 size_t begin_pos, size_t end_pos,
421 const char *feature) {
422 return reinterpret_cast<MeCab::Lattice *>(
423 lattice)->set_feature_constraint(begin_pos, end_pos, feature);
424 }
425
mecab_lattice_set_result(mecab_lattice_t * lattice,const char * result)426 void mecab_lattice_set_result(mecab_lattice_t *lattice,
427 const char *result) {
428 return reinterpret_cast<MeCab::Lattice *>(lattice)->set_result(result);
429 }
430
mecab_lattice_strerror(mecab_lattice_t * lattice)431 const char *mecab_lattice_strerror(mecab_lattice_t *lattice) {
432 return reinterpret_cast<MeCab::Lattice *>(lattice)->what();
433 }
434
mecab_model_new(int argc,char ** argv)435 mecab_model_t *mecab_model_new(int argc, char **argv) {
436 MeCab::Model *model = MeCab::createModel(argc, argv);
437 if (!model) {
438 MeCab::deleteModel(model);
439 return 0;
440 }
441 return reinterpret_cast<mecab_model_t *>(model);
442 }
443
mecab_model_new2(const char * arg)444 mecab_model_t *mecab_model_new2(const char *arg) {
445 MeCab::Model *model = MeCab::createModel(arg);
446 if (!model) {
447 MeCab::deleteModel(model);
448 return 0;
449 }
450 return reinterpret_cast<mecab_model_t *>(model);
451 }
452
mecab_model_destroy(mecab_model_t * model)453 void mecab_model_destroy(mecab_model_t *model) {
454 MeCab::Model *ptr = reinterpret_cast<MeCab::Model *>(model);
455 MeCab::deleteModel(ptr);
456 ptr = 0;
457 }
458
mecab_model_new_tagger(mecab_model_t * model)459 mecab_t *mecab_model_new_tagger(mecab_model_t *model) {
460 return reinterpret_cast<mecab_t *>(
461 reinterpret_cast<MeCab::Model *>(model)->createTagger());
462 }
463
mecab_model_new_lattice(mecab_model_t * model)464 mecab_lattice_t *mecab_model_new_lattice(mecab_model_t *model) {
465 return reinterpret_cast<mecab_lattice_t *>(
466 reinterpret_cast<MeCab::Model *>(model)->createLattice());
467 }
468
mecab_model_swap(mecab_model_t * model,mecab_model_t * new_model)469 int mecab_model_swap(mecab_model_t *model, mecab_model_t *new_model) {
470 return static_cast<int>(
471 reinterpret_cast<MeCab::Model *>(model)->swap(
472 reinterpret_cast<MeCab::Model *>(new_model)));
473 }
474
mecab_model_dictionary_info(mecab_model_t * model)475 const mecab_dictionary_info_t* mecab_model_dictionary_info(
476 mecab_model_t *model) {
477 return reinterpret_cast<const mecab_dictionary_info_t *>(
478 reinterpret_cast<MeCab::Model *>(model)->dictionary_info());
479 }
480
mecab_model_transition_cost(mecab_model_t * model,unsigned short rcAttr,unsigned short lcAttr)481 int mecab_model_transition_cost(mecab_model_t *model,
482 unsigned short rcAttr,
483 unsigned short lcAttr) {
484 return reinterpret_cast<MeCab::Model *>(model)->transition_cost(
485 rcAttr, lcAttr);
486 }
487
mecab_model_lookup(mecab_model_t * model,const char * begin,const char * end,mecab_lattice_t * lattice)488 mecab_node_t *mecab_model_lookup(mecab_model_t *model,
489 const char *begin,
490 const char *end,
491 mecab_lattice_t *lattice) {
492 return reinterpret_cast<mecab_node_t *>(
493 reinterpret_cast<MeCab::Model *>(model)->lookup(
494 begin, end,
495 reinterpret_cast<MeCab::Lattice *>(lattice)));
496 }
497