I am currently using Microsoft Azure to get transcribed text from live speech recognition. With that transcribed text, I put that into a TextRank to extract keywords from that speech stream. However, when I run this I lose a lot of speech recognition while running the TextRank code. Is there a way to run speech recognition continuously while passing the transcribed results to the next process, at the same time processing the TextRank keyword extraction, so that I don't lose any speech and extract keywords?
def from_mic():
speech_config = speechsdk.SpeechConfig(subscription="", region="")
speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config)
# print("Speak into your microphone.")
result = speech_recognizer.recognize_once_async().get()
print(result.text)
return result.text
for i in range(1,10):
transcript = from_mic()
summa_keywords = summa_keyword_extractor.keywords(transcript, ratio=1.0)
print(summa_keywords)