cuepack: cues into passages that keep their timestamps

This commit is contained in:
funkpower
2026-09-19 12:32:41 -04:00
parent b6602ee1e9
commit 36afe3350b
37 changed files with 1553 additions and 1 deletions
+25 -1
View File
@@ -19,7 +19,7 @@ type Written = Result<Vec<String>, String>;
type Job = (&'static str, fn() -> Written);
fn main() -> ExitCode {
let jobs: [Job; 8] = [
let jobs: [Job; 9] = [
("tokens", tokens),
("unescape", unescape),
("chunkmd", chunkmd),
@@ -28,6 +28,7 @@ fn main() -> ExitCode {
("cuenorm", cuenorm),
("cueseg", cueseg),
("rrf", rrf),
("cuepack", cuepack),
];
for (name, job) in jobs {
@@ -71,6 +72,29 @@ fn unescape() -> Written {
Ok(vec![path.display().to_string()])
}
fn cuepack() -> Written {
let dir = parity::golden("cuepack");
std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?;
let budgets = [("default", 75.0, 512), ("small", 12.0, 24)];
let mut written = Vec::new();
for case in parity::cases_with_extension("cuepack", "ndjson") {
let name = parity::case_name(&case);
let cues = std::fs::read_to_string(&case).map_err(|e| e.to_string())?;
for (set, seconds, max_tokens) in budgets {
let packed = parity::run_oracle_with(
"cuepack.py",
&[seconds.to_string(), max_tokens.to_string()],
&cues,
)?;
let path = dir.join(format!("{name}.{set}.ndjson"));
std::fs::write(&path, packed).map_err(|e| e.to_string())?;
written.push(path.display().to_string());
}
}
Ok(written)
}
fn rrf() -> Written {
let dir = parity::golden("rrf");
std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?;