scriptrs 0.5.0__tar.gz → 0.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {scriptrs-0.5.0 → scriptrs-0.5.1}/CHANGELOG.md +14 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/Cargo.lock +1 -1
- {scriptrs-0.5.0 → scriptrs-0.5.1}/Cargo.toml +1 -1
- {scriptrs-0.5.0 → scriptrs-0.5.1}/PKG-INFO +1 -1
- {scriptrs-0.5.0 → scriptrs-0.5.1}/README.md +0 -44
- {scriptrs-0.5.0 → scriptrs-0.5.1}/crates/scriptrs-python/Cargo.lock +2 -2
- {scriptrs-0.5.0 → scriptrs-0.5.1}/crates/scriptrs-python/Cargo.toml +1 -1
- scriptrs-0.5.1/src/long_form/merge.rs +341 -0
- scriptrs-0.5.0/src/long_form/merge.rs +0 -228
- {scriptrs-0.5.0 → scriptrs-0.5.1}/.gitattributes +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/.github/workflows/ci.yml +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/.github/workflows/package.yml +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/.gitignore +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/LICENSE +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/assets/icon.svg +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/crates/scriptrs-python/LICENSE +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/crates/scriptrs-python/README.md +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/crates/scriptrs-python/src/audio.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/crates/scriptrs-python/src/lib.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/crates/scriptrs-python/src/pipeline.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/crates/scriptrs-python/src/results.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/crates/scriptrs-python/src/samples.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/crates/scriptrs-python/tests/conftest.py +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/crates/scriptrs-python/tests/data/librispeech-1089-134686-0007.wav +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/crates/scriptrs-python/tests/test_scriptrs.py +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/deny.toml +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/examples/cuda_bench.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/examples/inspect_coreml_compute/macos.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/examples/inspect_coreml_compute/main.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/examples/quantize_native.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/examples/scheduler_bench.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/examples/stream_bench.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/examples/transcribe_wav.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/greptile.json +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/justfile +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/pyproject.toml +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/python/scriptrs/__init__.py +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/python/scriptrs/_cuda.py +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/python/scriptrs/_errors.py +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/python/scriptrs/_native.pyi +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/python/scriptrs/cli.py +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/python/scriptrs/py.typed +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/backend/host_loop.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/backend/policy.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/backend.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/config.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/constants.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/coreml/array.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/coreml/runtime.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/coreml.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/batcher.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/decoder/tests/filter.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/decoder/tests.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/decoder.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/encoder/attention.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/encoder/quantized.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/encoder/stream.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/encoder.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/fp16.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/kernels/attention.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/kernels/decode.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/kernels/stream.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/kernels.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/lt.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/model.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/ptx/attention.sm80.ptx +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/ptx/decode.sm75.ptx +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/ptx/encoder.sm75.ptx +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/ptx/quant.sm75.ptx +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/quant.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/stored.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/streaming/prompt.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/streaming.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda/test_support.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/cuda.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/decode.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/deployment.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/error.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/frontend/stream.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/frontend.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/language.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/lib.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/long_form/execute.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/long_form/planner.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/long_form/vad.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/long_form.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/model.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/model_io.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/models/hub.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/models.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/native/silero.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/native/spec.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/native/weights.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/native.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/pipeline.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/preprocessing.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/scheduler.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/streaming.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/test_support.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/types.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/src/vocab.rs +0 -0
- {scriptrs-0.5.0 → scriptrs-0.5.1}/tests/scheduled.rs +0 -0
|
@@ -5,6 +5,19 @@ follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions f
|
|
|
5
5
|
[Semantic Versioning](https://semver.org/). The Rust crate and the Python package share
|
|
6
6
|
one version.
|
|
7
7
|
|
|
8
|
+
## [0.5.1] - 2026-11-23
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Long-form token timestamps no longer run backward where two overlapping windows
|
|
13
|
+
meet. When one window heard a short restart that the other missed, such as "solve a
|
|
14
|
+
this a similar" against "solve a similar", the merge gave a few tokens the earlier
|
|
15
|
+
window's timestamps, which belong to a later word. A token could then start before
|
|
16
|
+
the one ahead of it, and a word built from its tokens could end before it started.
|
|
17
|
+
Those tokens now take the later window's timestamps, and the text stays the same.
|
|
18
|
+
In the rare case where the two windows' timings can't be joined in order, a later
|
|
19
|
+
window's token that would start too early starts with the token before it instead.
|
|
20
|
+
|
|
8
21
|
## [0.5.0] - 2026-11-07
|
|
9
22
|
|
|
10
23
|
The first release on PyPI. It has breaking changes to the Rust API; the README's
|
|
@@ -77,5 +90,6 @@ The first release on PyPI. It has breaking changes to the Rust API; the README's
|
|
|
77
90
|
- VAD regions are padded by 0.2 s so soft first words are kept.
|
|
78
91
|
- The relative-position attention runs as one fused kernel on CUDA.
|
|
79
92
|
|
|
93
|
+
[0.5.1]: https://github.com/avencera/scriptrs/compare/v0.5.0...v0.5.1
|
|
80
94
|
[0.5.0]: https://github.com/avencera/scriptrs/compare/v0.4.0...v0.5.0
|
|
81
95
|
[0.4.0]: https://github.com/avencera/scriptrs/releases/tag/v0.4.0
|
|
@@ -71,50 +71,6 @@ For VAD-backed long-form transcription:
|
|
|
71
71
|
scriptrs = { version = "0.5", features = ["vad"] }
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
## Breaking changes in 0.5.0
|
|
75
|
-
|
|
76
|
-
- `TranscriptionConfig` has only a `language` field. The frontend settings and
|
|
77
|
-
the single-chunk limit belong to the model's deployment, so read them from
|
|
78
|
-
`pipeline.deployment().frontend()` and `pipeline.deployment().hard_sample_max()`
|
|
79
|
-
instead of `pipeline.config()`. Write `TranscriptionConfig { language }` or
|
|
80
|
-
`TranscriptionConfig::default()` in place of
|
|
81
|
-
`TranscriptionConfig::from_deployment(..)`; `validate_for` is gone.
|
|
82
|
-
- With `long-form`, `TranscriptionError::Cancelled`, `DeadlineExpired` and
|
|
83
|
-
`WindowLimitExceeded` are now wrapped in `TranscriptionError::Control`, with
|
|
84
|
-
the same messages. Match
|
|
85
|
-
`TranscriptionError::Control(TranscriptionControlError::Cancelled)` instead of
|
|
86
|
-
`TranscriptionError::Cancelled`, and likewise for the other two.
|
|
87
|
-
- `VadConfig` is gone. The speech threshold is now
|
|
88
|
-
`VadSegmentationConfig::threshold`: set `config.segmentation.threshold`
|
|
89
|
-
instead of `config.vad.default_threshold`.
|
|
90
|
-
- VAD mode defaults to Silero fusion (`VadModel::SileroFusion`): it scores each
|
|
91
|
-
window with both Silero VAD v5 and v6 and keeps the higher probability, at a 0.6 threshold, in place of v5 alone at 0.5. Set
|
|
92
|
-
`config.segmentation = VadSegmentationConfig::for_model(VadModel::SileroV5)`
|
|
93
|
-
to keep v5-only planning. `VadSegmentationConfig` has a new `model` field, so
|
|
94
|
-
struct literals that list every field need it. VAD bundles need both models
|
|
95
|
-
(see [Local model layout](#local-model-layout)), and
|
|
96
|
-
`ModelBundle::validate_long_form` checks for both.
|
|
97
|
-
- `Vocabulary` loads only through a deployment, with
|
|
98
|
-
`Vocabulary::load(path, &deployment)` or
|
|
99
|
-
`Vocabulary::from_bytes(bytes, &deployment)`. `load` takes the deployment in
|
|
100
|
-
place of a `VocabKind`, and the two replace `load_for_deployment`,
|
|
101
|
-
`from_bytes_for_deployment` and the other `from_file`, `from_json` and
|
|
102
|
-
SentencePiece constructors. `VocabKind`,
|
|
103
|
-
`ModelLayout::vocab_kind` and `ParakeetDeployment::vocab_kind` are gone; the
|
|
104
|
-
deployment's version picks the tokenizer format.
|
|
105
|
-
- Long-form transcription runs audio as one window only up to
|
|
106
|
-
`config.overlap.max_model_samples` (`LongFormConfig::single_window_samples`),
|
|
107
|
-
not up to the model's input limit. On native CUDA bundles, clips from 30 to
|
|
108
|
-
40 s are now split into windows, and in VAD mode scanned for speech. The
|
|
109
|
-
Python `max_chunk_seconds` is 30 on CUDA.
|
|
110
|
-
- `LongFormConfig::validate_for` rejects `config.overlap.context_samples` that
|
|
111
|
-
is not a whole number of encoder frames (1280 samples), or that leaves no room
|
|
112
|
-
for one frame of audio in `config.overlap.max_model_samples`. Round the
|
|
113
|
-
context to a multiple of 1280 below that limit.
|
|
114
|
-
- `select_language_from_logits` returns `TranscriptionError::InvalidModelOutput`
|
|
115
|
-
when `languages` and `logits` differ in length, instead of reading only the
|
|
116
|
-
shorter prefix. Pass one logit per language.
|
|
117
|
-
|
|
118
74
|
## Python
|
|
119
75
|
|
|
120
76
|
```sh
|
|
@@ -755,7 +755,7 @@ dependencies = [
|
|
|
755
755
|
|
|
756
756
|
[[package]]
|
|
757
757
|
name = "scriptrs"
|
|
758
|
-
version = "0.5.
|
|
758
|
+
version = "0.5.1"
|
|
759
759
|
dependencies = [
|
|
760
760
|
"block2",
|
|
761
761
|
"cudakit",
|
|
@@ -774,7 +774,7 @@ dependencies = [
|
|
|
774
774
|
|
|
775
775
|
[[package]]
|
|
776
776
|
name = "scriptrs-python"
|
|
777
|
-
version = "0.5.
|
|
777
|
+
version = "0.5.1"
|
|
778
778
|
dependencies = [
|
|
779
779
|
"pyo3",
|
|
780
780
|
"rubato",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name = "scriptrs-python"
|
|
3
3
|
# keep equal to the scriptrs version; the release workflow checks the wheel names
|
|
4
4
|
# against the tag
|
|
5
|
-
version = "0.5.
|
|
5
|
+
version = "0.5.1"
|
|
6
6
|
edition = "2024"
|
|
7
7
|
license = "Apache-2.0"
|
|
8
8
|
repository = "https://github.com/avencera/scriptrs"
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
use crate::decode::{RawToken, RawTranscription};
|
|
2
|
+
|
|
3
|
+
/// Most encoder frames apart two tokens can be and still count as the same token
|
|
4
|
+
const MAX_MATCH_FRAMES: usize = 25;
|
|
5
|
+
|
|
6
|
+
/// Merges consecutive overlapping windows into one transcription whose token
|
|
7
|
+
/// frames never decrease
|
|
8
|
+
pub(crate) fn merge_overlapping_windows(windows: Vec<RawTranscription>) -> RawTranscription {
|
|
9
|
+
let mut iter = windows.into_iter();
|
|
10
|
+
let Some(mut merged) = iter.next() else {
|
|
11
|
+
return RawTranscription::empty();
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
for window in iter {
|
|
15
|
+
merged = merge_pair(merged, window);
|
|
16
|
+
}
|
|
17
|
+
merged
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
fn merge_pair(left: RawTranscription, right: RawTranscription) -> RawTranscription {
|
|
21
|
+
if left.is_empty() {
|
|
22
|
+
return right;
|
|
23
|
+
}
|
|
24
|
+
if right.is_empty() {
|
|
25
|
+
return left;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// `left` is everything merged so far; only its tail can reach `right`, so the
|
|
29
|
+
// search starts there rather than rescanning the whole transcript per window
|
|
30
|
+
let left_start = first_reachable(&left, &right);
|
|
31
|
+
let seam = match longest_agreement(&left, left_start, &right) {
|
|
32
|
+
Some(run) => run.seam(&left, &right),
|
|
33
|
+
None => Seam::at_midpoint(&left, &right),
|
|
34
|
+
};
|
|
35
|
+
seam.join(left, right)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/// Index of the first `left` token within match distance of any `right` frame; no
|
|
39
|
+
/// earlier token can match, so skipping them changes no match
|
|
40
|
+
fn first_reachable(left: &RawTranscription, right: &RawTranscription) -> usize {
|
|
41
|
+
let Some(right_first) = right.tokens.iter().map(|token| token.frame).min() else {
|
|
42
|
+
return left.tokens.len();
|
|
43
|
+
};
|
|
44
|
+
left.tokens
|
|
45
|
+
.iter()
|
|
46
|
+
.position(|token| token.frame + MAX_MATCH_FRAMES >= right_first)
|
|
47
|
+
.unwrap_or(left.tokens.len())
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/// A run of consecutive tokens both windows transcribed the same, token for token
|
|
51
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
52
|
+
struct AgreedRun {
|
|
53
|
+
left: usize,
|
|
54
|
+
right: usize,
|
|
55
|
+
len: usize,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
impl AgreedRun {
|
|
59
|
+
/// Where to hand over from `left` to `right` inside this run
|
|
60
|
+
///
|
|
61
|
+
/// Both windows hold the same token ids along the run, so any handover point
|
|
62
|
+
/// gives the same text and only decides whose timestamps the run's tokens keep.
|
|
63
|
+
/// The handover point is the run's latest one whose join keeps frames in order.
|
|
64
|
+
/// The run's end is not always such a point: tokens up to `MAX_MATCH_FRAMES`
|
|
65
|
+
/// apart still match, so when one window drops a short restart the other kept,
|
|
66
|
+
/// such as "solve a similar" against "solve a this a similar", the run's tail
|
|
67
|
+
/// pairs left's word with right's earlier copy of it, and right's next token
|
|
68
|
+
/// then starts before left's last
|
|
69
|
+
fn seam(self, left: &RawTranscription, right: &RawTranscription) -> Seam {
|
|
70
|
+
(0..=self.len)
|
|
71
|
+
.rev()
|
|
72
|
+
.map(|offset| Seam {
|
|
73
|
+
left_end: self.left + offset,
|
|
74
|
+
right_start: self.right + offset,
|
|
75
|
+
})
|
|
76
|
+
.find(|seam| seam.is_ordered(left, right))
|
|
77
|
+
// no handover point keeps frames in order, as when right's timing runs
|
|
78
|
+
// well ahead of left's along the whole run; the run's end keeps the
|
|
79
|
+
// most of `left`, and `join` retimes the right tokens that run back
|
|
80
|
+
.unwrap_or(Seam {
|
|
81
|
+
left_end: self.left + self.len,
|
|
82
|
+
right_start: self.right + self.len,
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/// The longest run of matching consecutive tokens, the earliest one on a tie
|
|
88
|
+
fn longest_agreement(
|
|
89
|
+
left: &RawTranscription,
|
|
90
|
+
left_start: usize,
|
|
91
|
+
right: &RawTranscription,
|
|
92
|
+
) -> Option<AgreedRun> {
|
|
93
|
+
let mut best: Option<AgreedRun> = None;
|
|
94
|
+
for left_idx in left_start..left.tokens.len() {
|
|
95
|
+
for right_idx in 0..right.tokens.len() {
|
|
96
|
+
let len = (0..)
|
|
97
|
+
.take_while(|offset| {
|
|
98
|
+
left_idx + offset < left.tokens.len()
|
|
99
|
+
&& right_idx + offset < right.tokens.len()
|
|
100
|
+
&& tokens_match(left, left_idx + offset, right, right_idx + offset)
|
|
101
|
+
})
|
|
102
|
+
.count();
|
|
103
|
+
if len > best.map_or(0, |run| run.len) {
|
|
104
|
+
best = Some(AgreedRun {
|
|
105
|
+
left: left_idx,
|
|
106
|
+
right: right_idx,
|
|
107
|
+
len,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
best
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
fn tokens_match(
|
|
116
|
+
left: &RawTranscription,
|
|
117
|
+
left_idx: usize,
|
|
118
|
+
right: &RawTranscription,
|
|
119
|
+
right_idx: usize,
|
|
120
|
+
) -> bool {
|
|
121
|
+
let (left, right) = (left.tokens[left_idx], right.tokens[right_idx]);
|
|
122
|
+
left.id == right.id && left.frame.abs_diff(right.frame) <= MAX_MATCH_FRAMES
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/// Where a merge hands over: `left` up to `left_end`, then `right` from
|
|
126
|
+
/// `right_start`
|
|
127
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
128
|
+
struct Seam {
|
|
129
|
+
left_end: usize,
|
|
130
|
+
right_start: usize,
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
impl Seam {
|
|
134
|
+
/// With no token in common, each window keeps the tokens on its side of the
|
|
135
|
+
/// midpoint between left's last frame and right's first
|
|
136
|
+
fn at_midpoint(left: &RawTranscription, right: &RawTranscription) -> Self {
|
|
137
|
+
let left_cutoff = left.tokens.last().map_or(0, |token| token.frame);
|
|
138
|
+
let right_first = right
|
|
139
|
+
.tokens
|
|
140
|
+
.first()
|
|
141
|
+
.map_or(left_cutoff, |token| token.frame);
|
|
142
|
+
let midpoint = (left_cutoff + right_first) / 2;
|
|
143
|
+
|
|
144
|
+
Self {
|
|
145
|
+
left_end: left.tokens.partition_point(|token| token.frame < midpoint),
|
|
146
|
+
right_start: right.tokens.partition_point(|token| token.frame < midpoint),
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/// Whether right's first kept token starts no earlier than left's last
|
|
151
|
+
fn is_ordered(self, left: &RawTranscription, right: &RawTranscription) -> bool {
|
|
152
|
+
let Some(last_left) = self.left_end.checked_sub(1) else {
|
|
153
|
+
return true;
|
|
154
|
+
};
|
|
155
|
+
right
|
|
156
|
+
.tokens
|
|
157
|
+
.get(self.right_start)
|
|
158
|
+
.is_none_or(|first_right| first_right.frame >= left.tokens[last_left].frame)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/// Joins the two sides, moving any `right` token that would start before the
|
|
162
|
+
/// token kept ahead of it to that token's frame
|
|
163
|
+
///
|
|
164
|
+
/// Each window's frames already rise, so with an ordered seam this moves
|
|
165
|
+
/// nothing. It holds the merged order whatever the seam: the `right` tokens
|
|
166
|
+
/// kept are the text after everything kept from `left`, never a second copy of
|
|
167
|
+
/// it, so a token that runs back is retimed rather than dropped
|
|
168
|
+
fn join(self, left: RawTranscription, right: RawTranscription) -> RawTranscription {
|
|
169
|
+
let mut tokens = left.tokens;
|
|
170
|
+
tokens.truncate(self.left_end);
|
|
171
|
+
let mut last_frame = tokens.last().map_or(0, |token| token.frame);
|
|
172
|
+
let rest = right.tokens.into_iter().skip(self.right_start);
|
|
173
|
+
tokens.extend(rest.map(|token| {
|
|
174
|
+
last_frame = last_frame.max(token.frame);
|
|
175
|
+
RawToken {
|
|
176
|
+
frame: last_frame,
|
|
177
|
+
..token
|
|
178
|
+
}
|
|
179
|
+
}));
|
|
180
|
+
RawTranscription { tokens }
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
#[cfg(test)]
|
|
185
|
+
mod tests {
|
|
186
|
+
use super::merge_overlapping_windows;
|
|
187
|
+
use crate::decode::RawTranscription;
|
|
188
|
+
use crate::decode::test_support::raw_from_columns;
|
|
189
|
+
|
|
190
|
+
fn window(tokens: &[(u32, usize)]) -> RawTranscription {
|
|
191
|
+
let ids: Vec<u32> = tokens.iter().map(|(id, _)| *id).collect();
|
|
192
|
+
let frames: Vec<usize> = tokens.iter().map(|(_, frame)| *frame).collect();
|
|
193
|
+
raw_from_columns(&ids, &frames, &vec![1; ids.len()], &vec![0.9; ids.len()])
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
fn assert_frames_rise(merged: &RawTranscription) {
|
|
197
|
+
let frames = merged.frames();
|
|
198
|
+
assert!(
|
|
199
|
+
frames.windows(2).all(|pair| pair[0] <= pair[1]),
|
|
200
|
+
"frames run backward: {frames:?}"
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
#[test]
|
|
205
|
+
fn contiguous_tokens_are_deduplicated() {
|
|
206
|
+
let left = raw_from_columns(&[1, 2, 3], &[0, 10, 20], &[1, 1, 1], &[0.9; 3]);
|
|
207
|
+
let right = raw_from_columns(&[2, 3, 4], &[10, 20, 30], &[1, 1, 1], &[0.9; 3]);
|
|
208
|
+
let merged = merge_overlapping_windows(vec![left, right]);
|
|
209
|
+
assert_eq!(merged.ids(), vec![1, 2, 3, 4]);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
#[test]
|
|
213
|
+
fn midpoint_fallback_keeps_monotonic_frames() {
|
|
214
|
+
let left = raw_from_columns(&[1, 2], &[0, 10], &[1, 1], &[0.9; 2]);
|
|
215
|
+
let right = raw_from_columns(&[9, 10], &[8, 18], &[1, 1], &[0.9; 2]);
|
|
216
|
+
let merged = merge_overlapping_windows(vec![left, right]);
|
|
217
|
+
assert_frames_rise(&merged);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/// Two windows of "To solve a this a similar": the earlier window heard only
|
|
221
|
+
/// "To solve a similar", so the matched run ends on its "a" at frame 615,
|
|
222
|
+
/// paired with the later window's first "a" at 607
|
|
223
|
+
///
|
|
224
|
+
/// Frames are from a Parakeet v3 run on a podcast episode, where the run's end
|
|
225
|
+
/// put "this" at 611 after "a" at 615
|
|
226
|
+
#[test]
|
|
227
|
+
fn dropped_restart_keeps_frames_in_order() {
|
|
228
|
+
const TO: u32 = 1;
|
|
229
|
+
const SOL: u32 = 2;
|
|
230
|
+
const VE: u32 = 3;
|
|
231
|
+
const A: u32 = 4;
|
|
232
|
+
const THIS: u32 = 5;
|
|
233
|
+
const SIM: u32 = 6;
|
|
234
|
+
const NEED: u32 = 7;
|
|
235
|
+
let left = window(&[(TO, 598), (SOL, 602), (VE, 605), (A, 615), (SIM, 616)]);
|
|
236
|
+
let right = window(&[
|
|
237
|
+
(TO, 598),
|
|
238
|
+
(SOL, 602),
|
|
239
|
+
(VE, 605),
|
|
240
|
+
(A, 607),
|
|
241
|
+
(THIS, 611),
|
|
242
|
+
(A, 615),
|
|
243
|
+
(SIM, 616),
|
|
244
|
+
(NEED, 620),
|
|
245
|
+
]);
|
|
246
|
+
|
|
247
|
+
let merged = merge_overlapping_windows(vec![left, right]);
|
|
248
|
+
|
|
249
|
+
assert_eq!(merged.ids(), vec![TO, SOL, VE, A, THIS, A, SIM, NEED]);
|
|
250
|
+
assert_eq!(
|
|
251
|
+
merged.frames(),
|
|
252
|
+
vec![598, 602, 605, 607, 611, 615, 616, 620]
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/// "But I say" in the earlier window against "But I think but I say" in the
|
|
257
|
+
/// later one, which matches "But I" 13 frames early
|
|
258
|
+
#[test]
|
|
259
|
+
fn restart_heard_late_in_the_run_takes_the_later_windows_frames() {
|
|
260
|
+
const BIG: u32 = 1;
|
|
261
|
+
const STOP: u32 = 2;
|
|
262
|
+
const BUT_UPPER: u32 = 3;
|
|
263
|
+
const I: u32 = 4;
|
|
264
|
+
const THINK: u32 = 5;
|
|
265
|
+
const BUT: u32 = 6;
|
|
266
|
+
const SAY: u32 = 7;
|
|
267
|
+
let left = window(&[
|
|
268
|
+
(BIG, 48931),
|
|
269
|
+
(STOP, 48934),
|
|
270
|
+
(BUT_UPPER, 48949),
|
|
271
|
+
(I, 48950),
|
|
272
|
+
(SAY, 48951),
|
|
273
|
+
]);
|
|
274
|
+
let right = window(&[
|
|
275
|
+
(BIG, 48931),
|
|
276
|
+
(STOP, 48932),
|
|
277
|
+
(BUT_UPPER, 48936),
|
|
278
|
+
(I, 48937),
|
|
279
|
+
(THINK, 48938),
|
|
280
|
+
(BUT, 48949),
|
|
281
|
+
(I, 48951),
|
|
282
|
+
(SAY, 48952),
|
|
283
|
+
]);
|
|
284
|
+
|
|
285
|
+
let merged = merge_overlapping_windows(vec![left, right]);
|
|
286
|
+
|
|
287
|
+
assert_eq!(
|
|
288
|
+
merged.ids(),
|
|
289
|
+
vec![BIG, STOP, BUT_UPPER, I, THINK, BUT, I, SAY]
|
|
290
|
+
);
|
|
291
|
+
assert_eq!(
|
|
292
|
+
merged.frames(),
|
|
293
|
+
vec![48931, 48934, 48936, 48937, 48938, 48949, 48951, 48952]
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/// A run whose every handover point runs back still merges in order and keeps
|
|
298
|
+
/// every token, by moving the later window's tokens that start before the
|
|
299
|
+
/// kept ones up to them
|
|
300
|
+
#[test]
|
|
301
|
+
fn unordered_run_retimes_tokens_that_run_back() {
|
|
302
|
+
let left = window(&[(9, 98), (1, 100), (2, 120)]);
|
|
303
|
+
let right = window(&[(1, 90), (2, 95), (3, 110), (4, 130)]);
|
|
304
|
+
|
|
305
|
+
let merged = merge_overlapping_windows(vec![left, right]);
|
|
306
|
+
|
|
307
|
+
assert_eq!(merged.ids(), vec![9, 1, 2, 3, 4]);
|
|
308
|
+
assert_eq!(merged.frames(), vec![98, 100, 120, 120, 130]);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/// Merges many windows of a small vocabulary, where repeats and near-miss
|
|
312
|
+
/// timings are common, and checks that frames never run backward
|
|
313
|
+
#[test]
|
|
314
|
+
fn merged_frames_never_run_backward() {
|
|
315
|
+
let mut state: u64 = 0x9e37_79b9_7f4a_7c15;
|
|
316
|
+
let mut next = |bound: u64| {
|
|
317
|
+
state ^= state << 13;
|
|
318
|
+
state ^= state >> 7;
|
|
319
|
+
state ^= state << 17;
|
|
320
|
+
state % bound
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
for _ in 0..2_000 {
|
|
324
|
+
let mut windows = Vec::new();
|
|
325
|
+
let mut start = 0usize;
|
|
326
|
+
for _ in 0..4 {
|
|
327
|
+
let mut frame = start;
|
|
328
|
+
let tokens: Vec<(u32, usize)> = (0..30)
|
|
329
|
+
.map(|_| {
|
|
330
|
+
frame += next(4) as usize;
|
|
331
|
+
(next(4) as u32, frame)
|
|
332
|
+
})
|
|
333
|
+
.collect();
|
|
334
|
+
windows.push(window(&tokens));
|
|
335
|
+
start += 20 + next(30) as usize;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
assert_frames_rise(&merge_overlapping_windows(windows));
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
use std::ops::Range;
|
|
2
|
-
|
|
3
|
-
use crate::decode::RawTranscription;
|
|
4
|
-
|
|
5
|
-
/// Most encoder frames apart two tokens can be and still count as the same token
|
|
6
|
-
const MAX_MATCH_FRAMES: usize = 25;
|
|
7
|
-
|
|
8
|
-
pub(crate) fn merge_overlapping_windows(windows: Vec<RawTranscription>) -> RawTranscription {
|
|
9
|
-
let mut iter = windows.into_iter();
|
|
10
|
-
let Some(mut merged) = iter.next() else {
|
|
11
|
-
return RawTranscription::empty();
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
for window in iter {
|
|
15
|
-
merged = merge_pair(merged, window);
|
|
16
|
-
}
|
|
17
|
-
merged
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
fn merge_pair(left: RawTranscription, right: RawTranscription) -> RawTranscription {
|
|
21
|
-
if left.is_empty() {
|
|
22
|
-
return right;
|
|
23
|
-
}
|
|
24
|
-
if right.is_empty() {
|
|
25
|
-
return left;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// `left` is everything merged so far; only its tail can reach `right`, so the
|
|
29
|
-
// searches start there rather than rescanning the whole transcript per window
|
|
30
|
-
let left_start = first_reachable(&left, &right);
|
|
31
|
-
let matches = contiguous_matches(&left, left_start, &right);
|
|
32
|
-
if !matches.is_empty() {
|
|
33
|
-
return merge_using_matches(left, right, &matches);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
let matches = lcs_matches(&left, left_start, &right);
|
|
37
|
-
if !matches.is_empty() {
|
|
38
|
-
return merge_using_matches(left, right, &matches);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
merge_by_midpoint(left, right)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/// Index of the first `left` token within match distance of any `right` frame; no
|
|
45
|
-
/// earlier token can match, so skipping them changes no match
|
|
46
|
-
fn first_reachable(left: &RawTranscription, right: &RawTranscription) -> usize {
|
|
47
|
-
let Some(right_first) = right.tokens.iter().map(|token| token.frame).min() else {
|
|
48
|
-
return left.tokens.len();
|
|
49
|
-
};
|
|
50
|
-
left.tokens
|
|
51
|
-
.iter()
|
|
52
|
-
.position(|token| token.frame + MAX_MATCH_FRAMES >= right_first)
|
|
53
|
-
.unwrap_or(left.tokens.len())
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
fn contiguous_matches(
|
|
57
|
-
left: &RawTranscription,
|
|
58
|
-
left_start: usize,
|
|
59
|
-
right: &RawTranscription,
|
|
60
|
-
) -> Vec<(usize, usize)> {
|
|
61
|
-
let mut best = Vec::new();
|
|
62
|
-
for left_idx in left_start..left.tokens.len() {
|
|
63
|
-
for right_idx in 0..right.tokens.len() {
|
|
64
|
-
if !tokens_match(left, left_idx, right, right_idx) {
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
let mut current = Vec::new();
|
|
68
|
-
let mut lhs = left_idx;
|
|
69
|
-
let mut rhs = right_idx;
|
|
70
|
-
while lhs < left.tokens.len() && rhs < right.tokens.len() {
|
|
71
|
-
if !tokens_match(left, lhs, right, rhs) {
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
current.push((lhs, rhs));
|
|
75
|
-
lhs += 1;
|
|
76
|
-
rhs += 1;
|
|
77
|
-
}
|
|
78
|
-
if current.len() > best.len() {
|
|
79
|
-
best = current;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
best
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/// Longest common subsequence of `left[left_start..]` and `right`; rows before
|
|
87
|
-
/// `left_start` would all be zero, so the table and its traceback start there
|
|
88
|
-
fn lcs_matches(
|
|
89
|
-
left: &RawTranscription,
|
|
90
|
-
left_start: usize,
|
|
91
|
-
right: &RawTranscription,
|
|
92
|
-
) -> Vec<(usize, usize)> {
|
|
93
|
-
let left_len = left.tokens.len() - left_start;
|
|
94
|
-
let matches_at = |row: usize, col: usize| tokens_match(left, left_start + row, right, col);
|
|
95
|
-
let mut dp = vec![vec![0usize; right.tokens.len() + 1]; left_len + 1];
|
|
96
|
-
for left_idx in 1..=left_len {
|
|
97
|
-
for right_idx in 1..=right.tokens.len() {
|
|
98
|
-
if matches_at(left_idx - 1, right_idx - 1) {
|
|
99
|
-
dp[left_idx][right_idx] = dp[left_idx - 1][right_idx - 1] + 1;
|
|
100
|
-
} else {
|
|
101
|
-
dp[left_idx][right_idx] =
|
|
102
|
-
dp[left_idx - 1][right_idx].max(dp[left_idx][right_idx - 1]);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
let mut matches = Vec::new();
|
|
108
|
-
let mut left_idx = left_len;
|
|
109
|
-
let mut right_idx = right.tokens.len();
|
|
110
|
-
while left_idx > 0 && right_idx > 0 {
|
|
111
|
-
if matches_at(left_idx - 1, right_idx - 1) {
|
|
112
|
-
matches.push((left_start + left_idx - 1, right_idx - 1));
|
|
113
|
-
left_idx -= 1;
|
|
114
|
-
right_idx -= 1;
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
if dp[left_idx - 1][right_idx] > dp[left_idx][right_idx - 1] {
|
|
118
|
-
left_idx -= 1;
|
|
119
|
-
} else {
|
|
120
|
-
right_idx -= 1;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
matches.reverse();
|
|
124
|
-
matches
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
fn tokens_match(
|
|
128
|
-
left: &RawTranscription,
|
|
129
|
-
left_idx: usize,
|
|
130
|
-
right: &RawTranscription,
|
|
131
|
-
right_idx: usize,
|
|
132
|
-
) -> bool {
|
|
133
|
-
let (left, right) = (left.tokens[left_idx], right.tokens[right_idx]);
|
|
134
|
-
left.id == right.id && left.frame.abs_diff(right.frame) <= MAX_MATCH_FRAMES
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
fn merge_using_matches(
|
|
138
|
-
left: RawTranscription,
|
|
139
|
-
right: RawTranscription,
|
|
140
|
-
matches: &[(usize, usize)],
|
|
141
|
-
) -> RawTranscription {
|
|
142
|
-
let left_indices: Vec<usize> = matches.iter().map(|(left_idx, _)| *left_idx).collect();
|
|
143
|
-
let right_indices: Vec<usize> = matches.iter().map(|(_, right_idx)| *right_idx).collect();
|
|
144
|
-
|
|
145
|
-
let mut merged = RawTranscription::empty();
|
|
146
|
-
|
|
147
|
-
if let Some(first_left) = left_indices.first().copied() {
|
|
148
|
-
copy_tokens(&mut merged, &left, 0..first_left);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
for (match_idx, (left_idx, right_idx)) in matches.iter().copied().enumerate() {
|
|
152
|
-
copy_tokens(&mut merged, &left, left_idx..left_idx + 1);
|
|
153
|
-
if match_idx == matches.len() - 1 {
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
let next_left = left_indices[match_idx + 1];
|
|
157
|
-
let next_right = right_indices[match_idx + 1];
|
|
158
|
-
let left_gap = next_left.saturating_sub(left_idx + 1);
|
|
159
|
-
let right_gap = next_right.saturating_sub(right_idx + 1);
|
|
160
|
-
if right_gap > left_gap {
|
|
161
|
-
copy_tokens(&mut merged, &right, right_idx + 1..next_right);
|
|
162
|
-
} else {
|
|
163
|
-
copy_tokens(&mut merged, &left, left_idx + 1..next_left);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if let Some(last_right) = right_indices.last().copied() {
|
|
168
|
-
copy_tokens(&mut merged, &right, last_right + 1..right.tokens.len());
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
merged
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
fn merge_by_midpoint(left: RawTranscription, right: RawTranscription) -> RawTranscription {
|
|
175
|
-
let left_cutoff = left.tokens.last().map_or(0, |token| token.frame);
|
|
176
|
-
let right_start = right
|
|
177
|
-
.tokens
|
|
178
|
-
.first()
|
|
179
|
-
.map_or(left_cutoff, |token| token.frame);
|
|
180
|
-
let midpoint = (left_cutoff + right_start) / 2;
|
|
181
|
-
|
|
182
|
-
let mut merged = RawTranscription::empty();
|
|
183
|
-
for token in &left.tokens {
|
|
184
|
-
if token.frame < midpoint {
|
|
185
|
-
merged.tokens.push(*token);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
for token in &right.tokens {
|
|
189
|
-
if token.frame >= midpoint {
|
|
190
|
-
merged.tokens.push(*token);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
merged
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/// Appends `source`'s tokens at `range`, which may be empty or reversed
|
|
197
|
-
fn copy_tokens(merged: &mut RawTranscription, source: &RawTranscription, range: Range<usize>) {
|
|
198
|
-
merged
|
|
199
|
-
.tokens
|
|
200
|
-
.extend(range.map(|index| source.tokens[index]));
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
#[cfg(test)]
|
|
204
|
-
mod tests {
|
|
205
|
-
use super::merge_overlapping_windows;
|
|
206
|
-
use crate::decode::test_support::raw_from_columns;
|
|
207
|
-
|
|
208
|
-
#[test]
|
|
209
|
-
fn contiguous_tokens_are_deduplicated() {
|
|
210
|
-
let left = raw_from_columns(&[1, 2, 3], &[0, 10, 20], &[1, 1, 1], &[0.9; 3]);
|
|
211
|
-
let right = raw_from_columns(&[2, 3, 4], &[10, 20, 30], &[1, 1, 1], &[0.9; 3]);
|
|
212
|
-
let merged = merge_overlapping_windows(vec![left, right]);
|
|
213
|
-
assert_eq!(merged.ids(), vec![1, 2, 3, 4]);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
#[test]
|
|
217
|
-
fn midpoint_fallback_keeps_monotonic_frames() {
|
|
218
|
-
let left = raw_from_columns(&[1, 2], &[0, 10], &[1, 1], &[0.9; 2]);
|
|
219
|
-
let right = raw_from_columns(&[9, 10], &[8, 18], &[1, 1], &[0.9; 2]);
|
|
220
|
-
let merged = merge_overlapping_windows(vec![left, right]);
|
|
221
|
-
assert!(
|
|
222
|
-
merged
|
|
223
|
-
.frames()
|
|
224
|
-
.windows(2)
|
|
225
|
-
.all(|window| window[0] <= window[1])
|
|
226
|
-
);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scriptrs-0.5.0 → scriptrs-0.5.1}/crates/scriptrs-python/tests/data/librispeech-1089-134686-0007.wav
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|