Skip to content

Commit

Permalink
more alignment bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jemoka committed Apr 20, 2024
1 parent 24fcc88 commit 179555b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions batchalign/pipelines/fa/whisper_fa.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def process(self, doc:Document, **kwargs):
continue

# pop the previous group onto the stack
if (i.alignment[-1] - seg_start) > 28*1000:
if (i.alignment[-1] - seg_start) > 20*1000:
groups.append(group)
group = []
seg_start = i.alignment[0]
Expand All @@ -78,6 +78,10 @@ def process(self, doc:Document, **kwargs):
# replace ANY punctuation
for i in MOR_PUNCT + ENDING_PUNCT:
detokenized = detokenized.replace(i, "").strip()
# to ensure that combined words are pased correctly
detokenized = detokenized.replace("_", " ")
# if "noone's" in detokenized:
# breakpoint()
res = self.__whisper(audio=f.chunk(grp[0][1][0], grp[-1][1][1]),
text=detokenized)
except IndexError:
Expand Down Expand Up @@ -134,9 +138,9 @@ def process(self, doc:Document, **kwargs):
if ut.content[tmp].time == None:
# seek forward one utterance to find their start time
next_ut = doc_ut + 1
while next_ut < len(doc.content)-1 and doc.content[next_ut].alignment == None:
while next_ut < len(doc.content)-1 and (not isinstance(doc.content, Utterance) or doc.content[next_ut].alignment == None):
next_ut += 1
if next_ut < len(doc.content) and doc.content[next_ut].alignment:
if next_ut < len(doc.content) and isinstance(doc.content, Utterance) and doc.content[next_ut].alignment:
w.time = (w.time[0], doc.content[next_ut].alignment[0])
else:
w.time = (w.time[0], w.time[0]+500) # give half a second because we don't know
Expand Down
4 changes: 2 additions & 2 deletions batchalign/version
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
0.7.1-beta.3
Apr 16th, 2024
0.7.1-beta.4
Apr 20th, 2024
more alignment bug patches

0 comments on commit 179555b

Please sign in to comment.