Speech Recognition by Xunfei (online)

From RobotForAll
Jump to: navigation, search

To run the code in this tutorial, you need first download the package. https://github.com/hutslib/rchome_tutorial Put robocup_speech_tutorial package in your catkin_ws.

$ cd ~/catkin_ws
$ catkin_make

You need to register in Xunfei and get your APPID and APP KEY. You can follow the instruction in this link https://blog.csdn.net/Smile_coderrr/article/details/81636015

$ cd ~/catkin_ws/src/robocup_speech_tutorial

In this folder you can find a scripts named Xunfei_recognition_text.py You need to change the APPID and APP_KEY with your own ones. You need to change the record path with your own ones. Follow the example in the code.

$ python Xunfei_text_detect.py

You can see the result output on your screen.

If you want to use this function in your task, annotate the main function and import this function in your code. You can call this function just as the example in main now. This function will return the detect result as a string.