Skip to content

Commit

Permalink
fix: resolve edge case of segment
Browse files Browse the repository at this point in the history
  • Loading branch information
ckaznable committed May 25, 2023
1 parent 15d914f commit 9b9ab81
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/speech.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,16 @@ fn replace_effect_segment_to_space(input: &str) -> String {

fn merge_duplicate_segment(input: &str) -> String {
let mut result = input.to_string();
let mut prev_str = String::new();

let mut s = input.split(' ');
if let Some(first_sp) = s.next() {
if s.all(|sp| sp == first_sp) {
return first_sp.to_string();
}
}

let half_len = result.len() / 2;
let mut prev_str = String::new();

for (i, c) in input.chars().enumerate() {
if i > half_len {
Expand Down

0 comments on commit 9b9ab81

Please sign in to comment.