Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in CTM line processing function for multi-speaker data simulations #8420

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions scripts/speaker_tasks/create_alignment_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ def get_seg_info_from_ctm_line(
"""
Get time stamp information and speaker labels from CTM lines.
This is following CTM format appeared in `Rich Transcription Meeting Eval Plan: RT09` document.
CTM Format:
<SOURCE>< <CHANNEL> <BEG-TIME> <DURATION> <TOKEN> <CONF> <TYPE> <SPEAKER>
Args:
ctm_list (list): List containing CTM items. e.g.: ['sw02001-A', '1', '0.000', '0.200', 'hello', '0.98', 'lex', 'speaker3']
output_precision (int): Precision for CTM outputs in integer.
Expand All @@ -47,6 +50,8 @@ def get_seg_info_from_ctm_line(
end = float(ctm_list[start_time_index]) + float(ctm_list[duration_index])
start = round(start, output_precision)
end = round(end, output_precision)
if type(speaker_id) == str:
speaker_id = speaker_id.strip()
return start, end, speaker_id


Expand Down Expand Up @@ -106,7 +111,7 @@ def create_new_ctm_entry(session_name, speaker_id, wordlist, alignments, output_
start_time=align1,
duration=align2,
token=word,
conf=0,
conf=None,
type_of_token='lex',
speaker=speaker_id,
output_precision=output_precision,
Expand Down Expand Up @@ -245,7 +250,7 @@ def create_manifest_with_alignments(
prev_end = 0
for i in range(len(lines)):
ctm = lines[i].split(' ')
speaker_id, start, end = get_seg_info_from_ctm_line(ctm_list=ctm, output_precision=output_precision)
start, end, speaker_id = get_seg_info_from_ctm_line(ctm_list=ctm, output_precision=output_precision)
interval = start - prev_end

if (i == 0 and interval > 0) or (i > 0 and interval > silence_dur_threshold):
Expand Down