Skip to main content

kiri_engine/lattice/
node.rs

1/// A node in the lattice DAG.
2#[derive(Debug, Clone)]
3pub struct LatticeNode {
4    pub begin: usize,
5    pub end: usize,
6    pub left_id: i16,
7    pub right_id: i16,
8    pub cost: i16,
9    pub word_id: i32,
10    pub total_cost: i32,
11    pub best_previous_node_index: i32,
12    pub is_connected_to_bos: bool,
13    pub is_oov: bool,
14    pub oov_pos_id: Option<i16>,
15}
16
17impl Default for LatticeNode {
18    fn default() -> Self {
19        Self {
20            begin: 0,
21            end: 0,
22            left_id: 0,
23            right_id: 0,
24            cost: 0,
25            word_id: -1,
26            total_cost: 0,
27            best_previous_node_index: -1,
28            is_connected_to_bos: false,
29            is_oov: false,
30            oov_pos_id: None,
31        }
32    }
33}