Speech Service, how to get recognized text in Python? RRS feed

  • Question

  • Hi,

    I'm doing some experiments with Azure Speech Service, writing code in Python. I managed to perform both recognize once and continuous recognition.

    In this last case, I need to know how to get the recognized text, for instance in a string variable or list. I did it by using a lambda function with an append to an empty list as a callback of the 'recognized' event, but what is the cleanest way to do it? I mean, by using some method of the Python SDK.

    This is part of what I did:

    a = []
    speech_recognizer.recognized.connect((lambda evt: a.append(evt.result.text))) # LINE TO REPLACE!!!


    Calling a normal function with the connect method would be another way, but I want to avoid it if possible.


    Thursday, February 28, 2019 11:48 PM