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

pull/414/head
HeNine 3 years ago
parent 6f90149d41
commit 50c4d8a096

@ -94,9 +94,10 @@ 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
line_start_time = recognizer.segments_start_time + timedelta(seconds=final_result_json["result"][0]["start"]) if "result" in final_result_json:
line_end_time = recognizer.segments_start_time + timedelta(seconds=final_result_json["result"][-1]["end"]) 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"])
write_line(final_result_json, line_start_time, line_end_time, db_cursor) write_line(final_result_json, line_start_time, line_end_time, db_cursor)
recognizer.reset() recognizer.reset()

Loading…
Cancel
Save