(Dec-04-2017, 11:04 PM)snippsat Wrote: You can look at Linux Python 3 environment.
Is pip a reflection of python dependancies ? I ran the following
pip list
Quote:DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the "list" section) to disable this warning.
netifaces (0.10.4)
pip (9.0.1)
PyAudio (0.2.11)
pygobject (3.20.0)
setuptools (20.7.0)
SpeechRecognition (3.7.1)
vboxapi (1.0)
wheel (0.29.0)
youtube-dl (2017.11.15)
pip3 list
Quote:DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the "list" section) to disable this warning.
apt-xapian-index (0.47)
apturl (0.5.2)
chardet (2.3.0)
command-not-found (0.3)
defer (1.0.6)
language-selector (0.1)
pexpect (4.0.1)
Pillow (3.1.2)
pip (9.0.1)
pocketsphinx (0.1.3)
ptyprocess (0.5)
PyAudio (0.2.8)
pycups (1.9.73)
pycurl (7.43.0)
pygobject (3.20.0)
python-apt (1.1.0b1)
python-debian (0.1.27)
python-systemd (231)
reportlab (3.3.0)
requests (2.9.1)
setuptools (20.7.0)
six (1.10.0)
SpeechRecognition (3.7.1)
ssh-import-id (5.5)
ubuntu-drivers-common (0.0.0)
ufw (0.35)
unattended-upgrades (0.1)
urllib3 (1.13.1)
wheel (0.29.0)
xkit (0.0.0)
pip and pip3 are both showing as version 9.0.1
The small script that I'm using is based on the example script from https://github.com/Uberi/speech_recognit...nscribe.py
#!/usr/bin/env python3 import speech_recognition as sr # obtain path to "english.wav" in the same folder as this script from os import path AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "english.wav") # AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "french.aiff") # AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "chinese.flac") # use the audio file as the audio source r = sr.Recognizer() with sr.AudioFile(AUDIO_FILE) as source: audio = r.record(source) # read the entire audio file # recognize speech using Sphinx try: print("Sphinx thinks you said " + r.recognize_sphinx(audio)) except sr.UnknownValueError: print("Sphinx could not understand audio") except sr.RequestError as e: print("Sphinx error; {0}".format(e))and most of it is inaccurate, some words are okay though. I was advised to try and break things up into sentences. This can be done by repeatedly calling
r.listen
instead of r.record
. So, 'r.record' in the above code reads the entire file and then does the sphinx processing. I need to change the script to do the r.listen
.Have done a bit of searching and realise it is dome within a 'while' loop, but just can't find the exact code. Psuedo code would be something like ..
Quote:Set the audio file path
use the audio file as the source
Read a part of the file
if EOF end
else
Call 'r.listen'
Call sphinx functions
End