Skip to content

Commit

Permalink
revert unnecessary changes after 856
Browse files Browse the repository at this point in the history
  • Loading branch information
MahmoudAshraf97 committed Nov 20, 2024
1 parent a55d365 commit 751d1bc
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions faster_whisper/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1885,12 +1885,9 @@ def merge_punctuations(alignment: List[dict], prepended: str, appended: str) ->
following = alignment[j]
if previous["word"].startswith(" ") and previous["word"].strip() in prepended:
# prepend it to the following word
following["word"] = previous["word"] + following["word"]
if "tokens" in alignment[0].keys():
following["tokens"] = previous["tokens"] + following["tokens"]
previous["tokens"] = []
following["tokens"] = previous["tokens"] + following["tokens"]
previous["word"] = ""

previous["tokens"] = []
else:
j = i
i -= 1
Expand All @@ -1904,11 +1901,9 @@ def merge_punctuations(alignment: List[dict], prepended: str, appended: str) ->
if not previous["word"].endswith(" ") and following["word"] in appended:
# append it to the previous word
previous["word"] = previous["word"] + following["word"]
if "tokens" in alignment[0].keys():
previous["tokens"] = previous["tokens"] + following["tokens"]
following["tokens"] = []
previous["tokens"] = previous["tokens"] + following["tokens"]
following["word"] = ""

following["tokens"] = []
else:
i = j
j += 1

0 comments on commit 751d1bc

Please sign in to comment.