pub struct Lattice<'a> { /* private fields */ }Expand description
A MeCab lattice representing a search space for morphological analysis.
It wraps C mecab_lattice_t.
The lifetime parameter is bound to Model.
Implementations§
Source§impl<'a> Lattice<'a>
impl<'a> Lattice<'a>
Sourcepub fn as_ptr(&self) -> *mut mecab_lattice_t
pub fn as_ptr(&self) -> *mut mecab_lattice_t
Returns the raw pointer to the underlying mecab_lattice_t.
The pointer is guaranteed to be NonNull.
Sourcepub fn set_sentence<'l, 's>(
&'l mut self,
s: &'s str,
) -> LatticeGuard<'a, 'l, 's>
pub fn set_sentence<'l, 's>( &'l mut self, s: &'s str, ) -> LatticeGuard<'a, 'l, 's>
Sets the sentence to be analyzed and returns a LatticeGuard.
It wraps mecab_lattice_set_sentence2(), the wrapper of MeCab::Lattice::set_sentence(sentence, len).
Since the analysis result is borrowed from the input s, the input should be captured in a
LatticeGuard during analysis.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the lattice.
It wraps mecab_lattice_clear(), the wrapper of MeCab::Lattice::clear().
Sourcepub fn is_available(&self) -> bool
pub fn is_available(&self) -> bool
Returns true if the lattice is available.
It wraps mecab_lattice_is_available(), the wrapper of MeCab::Lattice::is_available().
Sourcepub fn crf_norm_factor(&self) -> f64
pub fn crf_norm_factor(&self) -> f64
Returns the CRF normalization factor.
It wraps mecab_lattice_get_z(), the wrapper of MeCab::Lattice::Z().
Sourcepub fn set_crf_norm_factor(&mut self, z: f64)
pub fn set_crf_norm_factor(&mut self, z: f64)
Sets the CRF normalization factor.
It wraps mecab_lattice_set_z(), the wrapper of MeCab::Lattice::set_Z().
Sourcepub fn temparature(&self) -> f64
pub fn temparature(&self) -> f64
Returns the temperature parameter.
It wraps mecab_lattice_get_theta(), the wrapper of MeCab::Lattice::theta().
Sourcepub fn set_temparature(&mut self, theta: f64)
pub fn set_temparature(&mut self, theta: f64)
Sets the temperature parameter.
It wraps mecab_lattice_set_theta(), the wrapper of MeCab::Lattice::set_theta().
Sourcepub fn request_type(&self) -> RequestType
pub fn request_type(&self) -> RequestType
Returns the request type flags.
It wraps mecab_lattice_get_request_type(), the wrapper of MeCab::Lattice::request_type().
Sourcepub fn set_request_type(&mut self, request_type: RequestType)
pub fn set_request_type(&mut self, request_type: RequestType)
Sets the request type flags.
It wraps mecab_lattice_set_request_type(), the wrapper of MeCab::Lattice::set_request_type().
Sourcepub fn boundary_constraint(&self, pos: usize) -> BoundaryConstraintType
pub fn boundary_constraint(&self, pos: usize) -> BoundaryConstraintType
Returns the boundary constraint at the given position.
It wraps mecab_lattice_get_boundary_constraint(), the wrapper of MeCab::Lattice::boundary_constraint(pos).
Sourcepub fn set_boundary_constraint(
&mut self,
pos: usize,
constraint: BoundaryConstraintType,
)
pub fn set_boundary_constraint( &mut self, pos: usize, constraint: BoundaryConstraintType, )
Sets the boundary constraint at the given position.
It wraps mecab_lattice_set_boundary_constraint(), the wrapper of MeCab::Lattice::boundary_constraint(pos, type).