Posts

Showing posts from June, 2019

Repeat boring work with Vim

1. q + (abcdefghijklmnopqrstuvwxyz) Start to record a serious of operations 2. q Stop recording 3. @ + (abcdefghijklmnopqrstuvwxy) To repeat what you have recorded 4. @@ Repeat the last replayed recording ____ Reference: vim record Author: yingshaoxo

Speech Recognition with Python3

### main.py ``` # https://www.codesofinterest.com/2017/03/python-speech-recognition-pocketsphinx.html import speech_recognition as sr # obtain audio from the microphone r = sr.Recognizer() with sr.Microphone() as source:     print("Please wait. Calibrating microphone...")     r.adjust_for_ambient_noise(source, duration=5)     while 1:         print("\nSay something!")         audio = r.listen(source)         # recognize speech using Sphinx         try:             #print("Google thinks you said '" + r.recognize_google(audio, language="zh-CN") + "'")             print("Sphinx thinks you said '" + r.recognize_sphinx(audio, language="en-US") + "'")         except sr.UnknownValueError:             print("Sphinx could not understand audio")         except sr.RequestError as e:             print("Sphinx error; {0}".format(e)) ``` __________________