pub struct ConnectionMatrix { /* private fields */ }Expand description
Connection matrix storing transition costs
Implementations§
Source§impl ConnectionMatrix
impl ConnectionMatrix
Sourcepub fn cost(&self, right_id: u16, left_id: u16) -> i16
pub fn cost(&self, right_id: u16, left_id: u16) -> i16
Get the connection cost between right and left context IDs
This matches MeCab’s Connector::transition_cost function:
return matrix_[rcAttr + lsize_ * lcAttr];
§Arguments
right_id- Right context attribute of the LEFT nodeleft_id- Left context attribute of the RIGHT node
Sourcepub unsafe fn cost_unchecked(&self, right_id: u16, left_id: u16) -> i16
pub unsafe fn cost_unchecked(&self, right_id: u16, left_id: u16) -> i16
Get connection cost without bounds checking (hot path optimization)
§Safety
The caller must ensure that right_id < rsize and left_id < lsize. Context IDs from validated dictionary entries are always in bounds.
Sourcepub fn right_size(&self) -> usize
pub fn right_size(&self) -> usize
Get the number of right context IDs
Trait Implementations§
Source§impl Debug for ConnectionMatrix
impl Debug for ConnectionMatrix
impl Send for ConnectionMatrix
impl Sync for ConnectionMatrix
Auto Trait Implementations§
impl Freeze for ConnectionMatrix
impl RefUnwindSafe for ConnectionMatrix
impl Unpin for ConnectionMatrix
impl UnwindSafe for ConnectionMatrix
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