Skip to content

Commit

Permalink
fixed split_by_punctuation()
Browse files Browse the repository at this point in the history
-fixed `.result.WhisperResult.split_by_punctuation()` not working if `min_words`/`min_chars`/`min_dur` are unspecified after df4a199 (#261)
  • Loading branch information
jianfch committed Dec 8, 2023
1 parent df4a199 commit d51edb6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stable_whisper/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.13.6"
__version__ = "2.13.7"
4 changes: 2 additions & 2 deletions stable_whisper/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,10 +1191,10 @@ def _over_max(x: Segment):
(min_dur and x.duration >= min_dur)
)

indices = set(s.id for s in self.segments if _over_max(s))
indices = set(s.id for s in self.segments if _over_max(s)) if any((min_words, min_chars, min_dur)) else None

def _get_indices(x: Segment):
return x.get_punctuation_indices(punctuation) if x.id in indices else []
return x.get_punctuation_indices(punctuation) if indices is None or x.id in indices else []

self._split_segments(_get_indices, lock=lock, newline=newline)
if self._regroup_history:
Expand Down

0 comments on commit d51edb6

Please sign in to comment.