pub struct ViterbiSearcher {
pub space_penalty: SpacePenalty,
}Expand description
Viterbi 탐색기
Lattice에서 최적 경로를 찾는 Viterbi 알고리즘을 구현합니다.
Fields§
§space_penalty: SpacePenalty띄어쓰기 패널티 설정
Implementations§
Source§impl ViterbiSearcher
impl ViterbiSearcher
Sourcepub fn with_space_penalty(self, penalty: SpacePenalty) -> Self
pub fn with_space_penalty(self, penalty: SpacePenalty) -> Self
띄어쓰기 패널티 설정
Sourcepub fn search<C: ConnectionCost>(
&self,
lattice: &mut Lattice,
conn_cost: &C,
) -> Vec<NodeId> ⓘ
pub fn search<C: ConnectionCost>( &self, lattice: &mut Lattice, conn_cost: &C, ) -> Vec<NodeId> ⓘ
최적 경로 탐색 (Forward-Backward)
§Arguments
lattice- 노드가 추가된 Latticeconn_cost- 연접 비용 조회 인터페이스
§Returns
최적 경로의 노드 ID 목록 (BOS, EOS 제외)
§Example
let path = searcher.search(&mut lattice, &conn_cost);
for node_id in path {
let node = lattice.node(node_id).unwrap();
println!("{}: {}", node.surface, node.word_cost);
}Sourcepub fn get_best_cost(&self, lattice: &Lattice) -> i32
pub fn get_best_cost(&self, lattice: &Lattice) -> i32
최적 경로의 총 비용 조회
Sourcepub fn has_valid_path(&self, lattice: &Lattice) -> bool
pub fn has_valid_path(&self, lattice: &Lattice) -> bool
경로가 유효한지 확인
EOS까지의 경로가 존재하는지 확인합니다.
Trait Implementations§
Source§impl Clone for ViterbiSearcher
impl Clone for ViterbiSearcher
Source§fn clone(&self) -> ViterbiSearcher
fn clone(&self) -> ViterbiSearcher
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ViterbiSearcher
impl Debug for ViterbiSearcher
Auto Trait Implementations§
impl Freeze for ViterbiSearcher
impl RefUnwindSafe for ViterbiSearcher
impl Send for ViterbiSearcher
impl Sync for ViterbiSearcher
impl Unpin for ViterbiSearcher
impl UnsafeUnpin for ViterbiSearcher
impl UnwindSafe for ViterbiSearcher
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more