Skip to content

Commit

Permalink
feat(sam): update general-sam to 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ChieloNewctle committed Oct 18, 2023
1 parent fe9dbc5 commit 17d186e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ name = "general_sam"
crate-type = ["cdylib"]

[dependencies]
general-sam = "0.2.0"
general-sam = "0.3.0"
pyo3 = { version = "0.20.0", features = [
"extension-module",
"abi3-py38",
Expand Down
3 changes: 2 additions & 1 deletion general_sam/vocab_prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def _gen_cnt_info_in_sam(self):
state_id = state.get_node_id()
self.cnt_info_in_sam[state_id] = replace(cnt_info, str_cnt=1)

for sam_state in reversed(self.sam_rev.get_topo_order()):
depth_sorted_order = self.sam_rev.get_topo_and_suf_len_sorted_states()
for sam_state in reversed(depth_sorted_order):
assert not sam_state.is_nil()
if sam_state.is_root():
continue
Expand Down
4 changes: 2 additions & 2 deletions src/sam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ impl GeneralSAM {
GeneralSAMState(self.0.clone(), node_id)
}

pub fn get_topo_order(&self) -> Vec<GeneralSAMState> {
pub fn get_topo_and_suf_len_sorted_states(&self) -> Vec<GeneralSAMState> {
for_both!(self.0.as_ref(), x => {
x.get_topo_sorted_node_ids()
x.get_topo_and_suf_len_sorted_node_ids()
.iter()
.map(|node_id| self.get_state(*node_id))
.collect()
Expand Down

0 comments on commit 17d186e

Please sign in to comment.