batch_mode_tts/
legacy.rs

1crate::ix!();
2
3impl BatchModeTtsJob {
4
5    pub fn old_chunk_text(text: &str, max_len: usize) -> Vec<String> { 
6
7        let mut res = Vec::new(); 
8        let mut buf = String::new(); 
9
10        for line in text.lines() { 
11
12            if buf.len() + line.len() + 1 > max_len && !buf.is_empty() { 
13                res.push(buf.clone()); 
14                buf.clear(); 
15            } 
16
17            if !buf.is_empty() { 
18                buf.push('\n'); 
19            } 
20            buf.push_str(line); 
21        } 
22
23        if !buf.is_empty() { 
24            res.push(buf); 
25        } 
26        res 
27    }
28}