1 module bindbc.mecab.bindstatic; 2 3 version (BindMeCab_Static) : 4 5 public import bindbc.mecab.types; 6 7 extern (C) @nogc nothrow: 8 9 /* C interface */ 10 /* old mecab interface */ 11 /** 12 * C wrapper of MeCab::Tagger::create(argc, argv) 13 */ 14 mecab_t* mecab_new(int argc, char** argv); 15 16 /** 17 * C wrapper of MeCab::Tagger::create(arg) 18 */ 19 mecab_t* mecab_new2(const(char)* arg); 20 21 /** 22 * C wrapper of MeCab::Tagger::version() 23 */ 24 const(char)* mecab_version(); 25 26 /** 27 * C wrapper of MeCab::getLastError() 28 */ 29 const(char)* mecab_strerror(mecab_t* mecab); 30 31 /** 32 * C wrapper of MeCab::deleteTagger(tagger) 33 */ 34 void mecab_destroy(mecab_t* mecab); 35 36 /** 37 *C wrapper of MeCab::Tagger:set_partial() 38 */ 39 int mecab_get_partial(mecab_t* mecab); 40 41 /** 42 * C wrapper of MeCab::Tagger::partial() 43 */ 44 void mecab_set_partial(mecab_t* mecab, int partial); 45 46 /** 47 * C wrapper of MeCab::Tagger::theta() 48 */ 49 float mecab_get_theta(mecab_t* mecab); 50 51 /** 52 * C wrapper of MeCab::Tagger::set_theta() 53 */ 54 void mecab_set_theta(mecab_t* mecab, float theta); 55 56 /** 57 * C wrapper of MeCab::Tagger::lattice_level() 58 */ 59 int mecab_get_lattice_level(mecab_t* mecab); 60 61 /** 62 * C wrapper of MeCab::Tagger::set_lattice_level() 63 */ 64 void mecab_set_lattice_level(mecab_t* mecab, int level); 65 66 /** 67 * C wrapper of MeCab::Tagger::all_morphs() 68 */ 69 int mecab_get_all_morphs(mecab_t* mecab); 70 71 /** 72 * C wrapper of MeCab::Tagger::set_all_moprhs() 73 */ 74 void mecab_set_all_morphs(mecab_t* mecab, int all_morphs); 75 76 /** 77 * C wrapper of MeCab::Tagger::parse(MeCab::Lattice *lattice) 78 */ 79 int mecab_parse_lattice(mecab_t* mecab, mecab_lattice_t* lattice); 80 81 /** 82 * C wrapper of MeCab::Tagger::parse(char *str) 83 */ 84 const(char)* mecab_sparse_tostr(mecab_t* mecab, const(char)* str); 85 86 /** 87 * C wrapper of MeCab::Tagger::parse(char *str, size_t len) 88 */ 89 const(char)* mecab_sparse_tostr2(mecab_t* mecab, const(char)* str, size_t len); 90 91 /** 92 * C wrapper of MeCab::Tagger::parse(char *str, char *ostr, size_t olen) 93 */ 94 const(char)* mecab_sparse_tostr3(mecab_t* mecab, const(char)* str, size_t len, char* ostr, size_t olen); 95 96 /** 97 * C wrapper of MeCab::Tagger::parseToNode(char *str) 98 */ 99 const(mecab_node_t)* mecab_sparse_tonode(mecab_t* mecab, const(char)*); 100 101 /** 102 * C wrapper of MeCab::Tagger::parseToNode(char *str, size_t len) 103 */ 104 const(mecab_node_t)* mecab_sparse_tonode2(mecab_t* mecab, const(char)*, size_t); 105 106 /** 107 * C wrapper of MeCab::Tagger::parseNBest(size_t N, char *str) 108 */ 109 const(char)* mecab_nbest_sparse_tostr(mecab_t* mecab, size_t N, const(char)* str); 110 111 /** 112 * C wrapper of MeCab::Tagger::parseNBest(size_t N, char *str, size_t len) 113 */ 114 const(char)* mecab_nbest_sparse_tostr2(mecab_t* mecab, size_t N, const(char)* str, size_t len); 115 116 /** 117 * C wrapper of MeCab::Tagger::parseNBest(size_t N, char *str, char *ostr, size_t olen) 118 */ 119 const(char)* mecab_nbest_sparse_tostr3(mecab_t* mecab, size_t N, const(char)* str, size_t len, 120 char* ostr, size_t olen); 121 122 /** 123 * C wrapper of MeCab::Tagger::parseNBestInit(char *str) 124 */ 125 int mecab_nbest_init(mecab_t* mecab, const(char)* str); 126 127 /** 128 * C wrapper of MeCab::Tagger::parseNBestInit(char *str, size_t len) 129 */ 130 int mecab_nbest_init2(mecab_t* mecab, const(char)* str, size_t len); 131 132 /** 133 * C wrapper of MeCab::Tagger::next() 134 */ 135 const(char)* mecab_nbest_next_tostr(mecab_t* mecab); 136 137 /** 138 * C wrapper of MeCab::Tagger::next(char *ostr, size_t olen) 139 */ 140 char* mecab_nbest_next_tostr2(mecab_t* mecab, char* ostr, size_t olen); 141 142 /** 143 * C wrapper of MeCab::Tagger::nextNode() 144 */ 145 const(mecab_node_t)* mecab_nbest_next_tonode(mecab_t* mecab); 146 147 /** 148 * C wrapper of MeCab::Tagger::formatNode(const Node *node) 149 */ 150 const(char)* mecab_format_node(mecab_t* mecab, const(mecab_node_t)* node); 151 152 /** 153 * C wrapper of MeCab::Tagger::dictionary_info() 154 */ 155 const(mecab_dictionary_info_t)* mecab_dictionary_info(mecab_t* mecab); 156 157 /* lattice interface */ 158 /** 159 * C wrapper of MeCab::createLattice() 160 */ 161 mecab_lattice_t* mecab_lattice_new(); 162 163 /** 164 * C wrapper of MeCab::deleteLattice(lattice) 165 */ 166 void mecab_lattice_destroy(mecab_lattice_t* lattice); 167 168 /** 169 * C wrapper of MeCab::Lattice::clear() 170 */ 171 void mecab_lattice_clear(mecab_lattice_t* lattice); 172 173 /** 174 * C wrapper of MeCab::Lattice::is_available() 175 */ 176 int mecab_lattice_is_available(mecab_lattice_t* lattice); 177 178 /** 179 * C wrapper of MeCab::Lattice::bos_node() 180 */ 181 mecab_node_t* mecab_lattice_get_bos_node(mecab_lattice_t* lattice); 182 183 /** 184 * C wrapper of MeCab::Lattice::eos_node() 185 */ 186 mecab_node_t* mecab_lattice_get_eos_node(mecab_lattice_t* lattice); 187 188 /** 189 * C wrapper of MeCab::Lattice::begin_nodes() 190 */ 191 mecab_node_t** mecab_lattice_get_all_begin_nodes(mecab_lattice_t* lattice); 192 193 /** 194 * C wrapper of MeCab::Lattice::end_nodes() 195 */ 196 mecab_node_t** mecab_lattice_get_all_end_nodes(mecab_lattice_t* lattice); 197 198 /** 199 * C wrapper of MeCab::Lattice::begin_nodes(pos) 200 */ 201 mecab_node_t* mecab_lattice_get_begin_nodes(mecab_lattice_t* lattice, size_t pos); 202 203 /** 204 * C wrapper of MeCab::Lattice::end_nodes(pos) 205 */ 206 mecab_node_t* mecab_lattice_get_end_nodes(mecab_lattice_t* lattice, size_t pos); 207 208 /** 209 * C wrapper of MeCab::Lattice::sentence() 210 */ 211 char* mecab_lattice_get_sentence(mecab_lattice_t* lattice); 212 213 /** 214 * C wrapper of MeCab::Lattice::set_sentence(sentence) 215 */ 216 void mecab_lattice_set_sentence(mecab_lattice_t* lattice, const(char)* sentence); 217 218 /** 219 * C wrapper of MeCab::Lattice::set_sentence(sentence, len) 220 */ 221 void mecab_lattice_set_sentence2(mecab_lattice_t* lattice, const(char)* sentence, size_t len); 222 223 /** 224 * C wrapper of MeCab::Lattice::size() 225 */ 226 size_t mecab_lattice_get_size(mecab_lattice_t* lattice); 227 228 /** 229 * C wrapper of MeCab::Lattice::Z() 230 */ 231 double mecab_lattice_get_z(mecab_lattice_t* lattice); 232 233 /** 234 * C wrapper of MeCab::Lattice::set_Z() 235 */ 236 void mecab_lattice_set_z(mecab_lattice_t* lattice, double Z); 237 238 /** 239 * C wrapper of MeCab::Lattice::theta() 240 */ 241 double mecab_lattice_get_theta(mecab_lattice_t* lattice); 242 243 /** 244 * C wrapper of MeCab::Lattice::set_theta() 245 */ 246 void mecab_lattice_set_theta(mecab_lattice_t* lattice, double theta); 247 248 /** 249 * C wrapper of MeCab::Lattice::next() 250 */ 251 int mecab_lattice_next(mecab_lattice_t* lattice); 252 253 /** 254 * C wrapper of MeCab::Lattice::request_type() 255 */ 256 int mecab_lattice_get_request_type(mecab_lattice_t* lattice); 257 258 /** 259 * C wrapper of MeCab::Lattice::has_request_type() 260 */ 261 int mecab_lattice_has_request_type(mecab_lattice_t* lattice, int request_type); 262 263 /** 264 * C wrapper of MeCab::Lattice::set_request_type() 265 */ 266 void mecab_lattice_set_request_type(mecab_lattice_t* lattice, int request_type); 267 268 /** 269 * C wrapper of MeCab::Lattice::add_request_type() 270 */ 271 void mecab_lattice_add_request_type(mecab_lattice_t* lattice, int request_type); 272 273 /** 274 * C wrapper of MeCab::Lattice::remove_request_type() 275 */ 276 void mecab_lattice_remove_request_type(mecab_lattice_t* lattice, int request_type); 277 278 /** 279 * C wrapper of MeCab::Lattice::newNode(); 280 */ 281 mecab_node_t* mecab_lattice_new_node(mecab_lattice_t* lattice); 282 283 /** 284 * C wrapper of MeCab::Lattice::toString() 285 */ 286 const(char)* mecab_lattice_tostr(mecab_lattice_t* lattice); 287 288 /** 289 * C wrapper of MeCab::Lattice::toString(buf, size) 290 */ 291 const(char)* mecab_lattice_tostr2(mecab_lattice_t* lattice, char* buf, size_t size); 292 293 /** 294 * C wrapper of MeCab::Lattice::enumNBestAsString(N) 295 */ 296 const(char)* mecab_lattice_nbest_tostr(mecab_lattice_t* lattice, size_t N); 297 298 /** 299 * C wrapper of MeCab::Lattice::enumNBestAsString(N, buf, size) 300 */ 301 const(char)* mecab_lattice_nbest_tostr2(mecab_lattice_t* lattice, size_t N, char* buf, size_t size); 302 303 /** 304 * C wrapper of MeCab::Lattice::has_constraint() 305 */ 306 int mecab_lattice_has_constraint(mecab_lattice_t* lattice); 307 308 /** 309 * C wrapper of MeCab::Lattice::boundary_constraint(pos) 310 */ 311 int mecab_lattice_get_boundary_constraint(mecab_lattice_t* lattice, size_t pos); 312 313 /** 314 * C wrapper of MeCab::Lattice::feature_constraint(pos) 315 */ 316 const(char)* mecab_lattice_get_feature_constraint(mecab_lattice_t* lattice, size_t pos); 317 318 /** 319 * C wrapper of MeCab::Lattice::boundary_constraint(pos, type) 320 */ 321 void mecab_lattice_set_boundary_constraint(mecab_lattice_t* lattice, size_t pos, int boundary_type); 322 323 /** 324 * C wrapper of MeCab::Lattice::set_feature_constraint(begin_pos, end_pos, feature) 325 */ 326 void mecab_lattice_set_feature_constraint(mecab_lattice_t* lattice, 327 size_t begin_pos, size_t end_pos, const(char)* feature); 328 329 /** 330 * C wrapper of MeCab::Lattice::what() 331 */ 332 const(char)* mecab_lattice_strerror(mecab_lattice_t* lattice); 333 334 /* model interface */ 335 /** 336 * C wapper of MeCab::Model::create(argc, argv) 337 */ 338 mecab_model_t* mecab_model_new(int argc, char** argv); 339 340 /** 341 * C wapper of MeCab::Model::create(arg) 342 */ 343 mecab_model_t* mecab_model_new2(char* arg); 344 345 /** 346 * C wapper of MeCab::deleteModel(model) 347 */ 348 void mecab_model_destroy(mecab_model_t* model); 349 350 /** 351 * C wapper of MeCab::Model::createTagger() 352 */ 353 mecab_t* mecab_model_new_tagger(mecab_model_t* model); 354 355 /** 356 * C wapper of MeCab::Model::createLattice() 357 */ 358 mecab_lattice_t* mecab_model_new_lattice(mecab_model_t* model); 359 360 /** 361 * C wrapper of MeCab::Model::swap() 362 */ 363 int mecab_model_swap(mecab_model_t* model, mecab_model_t* new_model); 364 365 /** 366 * C wapper of MeCab::Model::dictionary_info() 367 */ 368 const(mecab_dictionary_info_t)* mecab_model_dictionary_info(mecab_model_t* model); 369 370 /** 371 * C wrapper of MeCab::Model::transition_cost() 372 */ 373 int mecab_model_transition_cost(mecab_model_t* model, ushort rcAttr, ushort lcAttr); 374 375 /** 376 * C wrapper of MeCab::Model::lookup() 377 */ 378 mecab_node_t* mecab_model_lookup(mecab_model_t* model, const(char)* begin, const(char)* end, 379 mecab_lattice_t* lattice); 380 381 /* static functions */ 382 int mecab_do(int argc, char** argv); 383 int mecab_dict_index(int argc, char** argv); 384 int mecab_dict_gen(int argc, char** argv); 385 int mecab_cost_train(int argc, char** argv); 386 int mecab_system_eval(int argc, char** argv); 387 int mecab_test_gen(int argc, char** argv);