Final result sometimes has no content (if segments are missing after silence?)

trunk
HeNine 3 years ago
parent 6f90149d41
commit 50c4d8a096

@ -94,6 +94,7 @@ def finish_off_recognizer(recognizer: BuscribeRecognizer, db_cursor):
"""Flush the recognizer, commit the final line to the database and reset it.""" """Flush the recognizer, commit the final line to the database and reset it."""
final_result_json = json.loads(recognizer.final_result()) # Flush the tubes final_result_json = json.loads(recognizer.final_result()) # Flush the tubes
if "result" in final_result_json:
line_start_time = recognizer.segments_start_time + timedelta(seconds=final_result_json["result"][0]["start"]) line_start_time = recognizer.segments_start_time + timedelta(seconds=final_result_json["result"][0]["start"])
line_end_time = recognizer.segments_start_time + timedelta(seconds=final_result_json["result"][-1]["end"]) line_end_time = recognizer.segments_start_time + timedelta(seconds=final_result_json["result"][-1]["end"])

Loading…
Cancel
Save