Closed buruzaemon closed 9 years ago
From example/example_lattice.c
in the MeCab source distribution, Model, Tagger and Lattice appear to all be intended as objects with long life.
Wrap these objects in Natto::MeCab
and set them as instance variables.
Make sure to destroy them together, in the correct order of Tagger, Lattice and finally Model.
Add new support for these Model-based functions in mecab.h
:
mecab_model_new2
mecab_model_new_tagger
mecab_model_new_lattice
mecab_model_destroy
Remove support for these old C-API calls, and use mecab_lattice_set_request_type
instead:
mecab_set_partial
mecab_set_all_morphs
Remove support for mecab_set_theta
, and use mecab_lattice_set_theta
instead.
Remove support for these old C-API calls for tostr
, and use mecab_lattice_set_request_type
with MECAB_NBEST
or MECAB_ONE_BEST
; use mecab_lattice_tostr
; and use mecab_lattice_next
for N-best parsing to string:
mecab_nbest_init
mecab_sparse_tostr
mecab_nbest_sparse_tostr
Remove support for these old C-API calls for tonode
, and use the existing logic as per boundary constraint parsing via Lattice:
mecab_nbest_init
mecab_sparse_tonode
mecab_nbest_sparse_tonode
For all calls to Lattice, use mecab_lattice_strerror
to obtain error messages.
OK, so if we want to also support feature constraint parsing, I think we will have to refactor the internals to use the Lattice-based APIs right now.
This will be done as part of 1.0.0 release.
Done.
Where possible, use the new Model interface and Lattice API calls.