I am facing the KeyError: 'confidence' while trying to export the redacted content to Word docx using python tscribe module.
File "transcribe_script.py", line 124, in export_files
tscribe.write(json_file_path, format="docx", save_as= save_as_path)
File "C:\Users\Shufyan\Anaconda3\envs\upwork\lib\site-packages\tscribe\__init__.py", line 597, in write
df = decode_transcript(data)
File "C:\Users\Shufyan\Anaconda3\envs\upwork\lib\site-packages\tscribe\__init__.py", line 167, in decode_transcript
result = sorted(
File "C:\Users\Shufyan\Anaconda3\envs\upwork\lib\site-packages\tscribe\__init__.py", line 168, in <lambda>
word_result[-1]["alternatives"], key=lambda x: x["confidence"]
KeyError: 'confidence'
Here's the code:
if json_content['results']['transcripts'][0]['transcript'] != "" :
json_file_path = os.path.join(self.output_path, obj.key)
save_as_path = os.path.join(self.output_path, obj_name +'.docx')
tscribe.write(json_file_path, format="docx", save_as= save_as_path)