pub struct Model { /* private fields */ }Expand description
A thread-safe, shared MeCab model. It wraps C mecab_model_t.
Implementations§
Source§impl Model
impl Model
Sourcepub fn as_ptr(&self) -> *mut mecab_model_t
pub fn as_ptr(&self) -> *mut mecab_model_t
Returns the raw pointer to the underlying mecab_model_t.
The pointer is guaranteed to be NonNull.
Sourcepub fn from_cli_arg(arg: &CStr) -> Result<Self, Error>
pub fn from_cli_arg(arg: &CStr) -> Result<Self, Error>
Creates a new Model from a CLI argument string.
It wraps mecab_model_new2(), the wrapper of MeCab::Model::create(arg).
use mecab_sys::Model;
let model = Model::from_cli_arg(c"-d /path/to/your/dict -r /path/to/dictrc").unwrap();Sourcepub fn new_tagger(&self) -> Result<Tagger<'_>, Error>
pub fn new_tagger(&self) -> Result<Tagger<'_>, Error>
Creates a new Tagger from this model. It is the alias of Tagger::new().
Sourcepub fn new_lattice(&self) -> Result<Lattice<'_>, Error>
pub fn new_lattice(&self) -> Result<Lattice<'_>, Error>
Creates a new Lattice from this model. It is the alias of Lattice::new().
Sourcepub fn transition_cost(&self, rc_attr: RcAttr, lc_attr: LcAttr) -> i32
pub fn transition_cost(&self, rc_attr: RcAttr, lc_attr: LcAttr) -> i32
Returns the transition cost between two attribute IDs.
It wraps mecab_model_transition_cost(), the wrapper of MeCab::Model::transition_cost().
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Model
impl RefUnwindSafe for Model
impl Unpin for Model
impl UnsafeUnpin for Model
impl UnwindSafe for Model
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more