houndify.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:kalliope 作者: kalliope-project 项目源码 文件源码
def houndify_callback(self, recognizer, audio):
        """
        called from the background thread
        """
        try:
            captured_audio = recognizer.recognize_houndify(audio,
                                                           client_id=self.client_id,
                                                           client_key=self.key,
                                                           show_all=self.show_all)
            Utils.print_success("Houndify Speech Recognition thinks you said %s" % captured_audio)
            self._analyse_audio(captured_audio)

        except sr.UnknownValueError:
            Utils.print_warning("Houndify Speech Recognition could not understand audio")
            # callback anyway, we need to listen again for a new order
            self._analyse_audio(audio_to_text=None)
        except sr.RequestError as e:
            Utils.print_danger("Could not request results from Houndify Speech Recognition service; {0}".format(e))
            # callback anyway, we need to listen again for a new order
            self._analyse_audio(audio_to_text=None)

        # stop listening for an audio
        self.stop_listening()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号