fixed bug on which the last speaker diarization where cut of

This commit is contained in:
Jaikinator
2023-09-04 12:59:51 +02:00
parent 9bc43b9b18
commit 2643d7999b
+6 -3
View File
@@ -105,15 +105,16 @@ class Diariser:
# Sometimes two consecutive speakers are the same
# This loop removes these duplicates
###
if len(dia_list) == 1:
normalized_output.append([0, 0, dia_list[0][2]])
else:
for i, (_, _, speaker) in enumerate(dia_list):
if i == 0:
current_speaker = speaker
if speaker != current_speaker:
index_end_speaker = i - 1
@@ -125,9 +126,11 @@ class Diariser:
index_start_speaker = i
current_speaker = speaker
if i == len(diarization_output["speakers"]) - 1:
if i == len(dia_list) - 1:
index_end_speaker = i
normalized_output.append([index_start_speaker,
index_end_speaker,
current_speaker])