Is there an option to diarize the output when using the import speech_recognition in Python?
I would appreciate advice on this, or whether it is possible.
Furthermore, any advice on then outputting this information in a text file with lines between each new speaker would be greatly appreciated.
import speech_recognition as sr
from os import path
from pprint import pprint
audio_file = path.join(path.dirname(path.realpath(__file__)), "RobertP.wav")
r = sr.Recognizer()
with sr.AudioFile(audio_file) as source:
audio = r.record(source)
try:
txt = r.recognize_google(audio, show_all=True)
except:
print("Didn't work.")
text = str(txt)
f = open("tester.txt", "w+")
f.write(text)
f.close()
Note: apologies for my novice-ness.