Skip to content

Commit

Permalink
fix: segment iterator state by return only in the last line of the cl…
Browse files Browse the repository at this point in the history
…osure (#15)

* fix: segment iterator state by return only in the last line of the closure

* v0.2.9
  • Loading branch information
thewh1teagle authored Nov 29, 2024
1 parent 230af1b commit abcdc3a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ Look for the flags `/MD` (Meaning it links it dynamically) and `/MT` or `-MT` (M
## Release new version

```console
gh release create v0.2.8 --title "v0.2.8" --generate-notes
gh release create v0.2.9 --title "v0.2.9" --generate-notes
git pull # Fetch new tags
```
6 changes: 3 additions & 3 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["crates/knf-rs", "crates/knf-rs/sys"]

[package]
name = "pyannote-rs"
version = "0.2.8"
version = "0.2.9"
edition = "2021"
license = "MIT"
description = "Speaker diarization using pyannote in Rust"
Expand All @@ -13,7 +13,7 @@ eyre = "0.6.12"
hound = "3.5.1"
ndarray = "0.16"
ort = "2.0.0-rc.9"
knf-rs = { path = "crates/knf-rs", version = "0.2.8", features = [] }
knf-rs = { path = "crates/knf-rs", version = "0.2.9", features = [] }

[features]
default = []
Expand Down
4 changes: 2 additions & 2 deletions crates/knf-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "knf-rs"
version = "0.2.8"
version = "0.2.9"
edition = "2021"
license = "MIT"
description = "fbank features extractor without external dependencies"

[dependencies]
knf-rs-sys = { path = "sys", version = "0.2.8", features = [] }
knf-rs-sys = { path = "sys", version = "0.2.9", features = [] }
eyre = "0.6.12"
ndarray = "0.16"

Expand Down
2 changes: 1 addition & 1 deletion crates/knf-rs/sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "knf-rs-sys"
version = "0.2.8"
version = "0.2.9"
edition = "2021"
license = "MIT"
description = "fbank features extractor without external dependencies"
Expand Down
7 changes: 4 additions & 3 deletions src/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub fn get_segments<P: AsRef<Path>>(
let mut start_iter = (0..padded_samples.len()).step_by(window_size);

Ok(std::iter::from_fn(move || {
let mut segment: Option<Segment> = None;
if let Some(start) = start_iter.next() {
let end = (start + window_size).min(padded_samples.len());
let window = &padded_samples[start..end];
Expand Down Expand Up @@ -109,16 +110,16 @@ pub fn get_segments<P: AsRef<Path>>(

is_speeching = false;

return Some(Ok(Segment {
segment = Some(Segment {
start,
end,
samples: segment_samples.to_vec(),
}));
});
}
offset += frame_size;
}
}
}
None
segment.map(Ok)
}))
}

0 comments on commit abcdc3a

Please sign in to comment.