Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:return: dict: key/val pairs contain 'segment'-level information
"""
output_dict = {}
output_dict["speakerInfo"] = seg.speaker
output_dict["startTimeSec"] = float(seg.start)
output_dict["endTimeSec"] = float(seg.stop)
output_dict["genderInfo"] = {
"gender": seg.label.split(",")[-1].replace(">", "")
}
output_dict["transcript"] = seg.text
output_dict["confidence"] = seg.confidence
if len(seg.formatted_text) > 0:
output_dict["formatted_transcript"] = seg.formatted_text
return json.dumps(output_dict, ensure_ascii=True)