From 709dd1dba3e4cffe124f3bdc701e8cd0ba40d46f Mon Sep 17 00:00:00 2001 From: bel Date: Tue, 2 Jan 2024 21:12:33 -0700 Subject: [PATCH] tod --- rust-whisper-baked/src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rust-whisper-baked/src/main.rs b/rust-whisper-baked/src/main.rs index 45efcf7..dd96f1d 100644 --- a/rust-whisper-baked/src/main.rs +++ b/rust-whisper-baked/src/main.rs @@ -132,11 +132,15 @@ impl Words { } fn last_n_comparable_to_string(&self, n: usize) -> (String, usize) { - TODO + let v = self.to_comparable_words(); + v = v[(v.len() - n).clamp(0, v.len())..].to_vec(); + v.iter().map(|x| x.s).collect().join(" "), v[v.len()-1].idx } fn first_n_comparable_to_string(&self, n: usize) -> (String, usize){ - TODO + let v = self.to_comparable_words(); + v = v[0..n.clamp(0, v.len())].to_vec(); + v.iter().map(|x| x.s).collect().join(" "), v[0].idx } fn comparable_len(&self) -> usize {