![]() |
speech_to_text command doesn't seem to work - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: speech_to_text command doesn't seem to work (/thread-5069.html) Pages:
1
2
|
speech_to_text command doesn't seem to work - snakebyte - Sep-17-2017 Hi, I'm trying to use IBM Watson BlueMix Speech-To-Text to transcribe my spoken-word audio files. I've already signed up for a BlueMix account. I'm on Linux Mint 18.2 Cinnamon 64-bit. I'm looking for the easiest way to engage BlueMix, and found this: https://github.com/rmotr/speech-to-text So the first step is: sudo -H pip install speech-to-text Requirement already satisfied (use --upgrade to upgrade): speech-to-text in /usr/local/lib/python2.7/dist-packages Requirement already satisfied (use --upgrade to upgrade): click==6.7 in /usr/local/lib/python2.7/dist-packages (from speech-to-text) Requirement already satisfied (use --upgrade to upgrade): watson-developer-cloud==0.25.1 in /usr/local/lib/python2.7/dist-packages (from speech-to-text) Requirement already satisfied (use --upgrade to upgrade): progressbar in /usr/local/lib/python2.7/dist-packages (from speech-to-text) Requirement already satisfied (use --upgrade to upgrade): requests<3.0,>=2.0 in /usr/local/lib/python2.7/dist-packages (from watson-developer-cloud==0.25.1->speech-to-text) Requirement already satisfied (use --upgrade to upgrade): pysolr<4.0,>=3.3 in /usr/local/lib/python2.7/dist-packages (from watson-developer-cloud==0.25.1->speech-to-text) You are using pip version 8.1.1, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. Then this command: speech_to_text -u myUsernameGoesHere -p myPasswordGoesHere -f html -i Audio/for_ibm_watson/Speech02.ogg transcript.html Starting Upload. [=========================================================================] 100% Upload finished. Waiting for Transcript Traceback (most recent call last): File "/usr/local/bin/speech_to_text", line 11, in <module> sys.exit(speech_to_text()) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/speech_to_text/command.py", line 60, in speech_to_text formatted_output = FormatterClass().format(result) File "/usr/local/lib/python2.7/dist-packages/speech_to_text/formatters.py", line 36, in format for obj in self._parse(data)) File "/usr/local/lib/python2.7/dist-packages/speech_to_text/formatters.py", line 10, in _parse for obj in data['results']) KeyError: 'results' ----- Can anyone tell me what's wrong, and how I can get it to work? RE: speech_to_text command doesn't seem to work - Larz60+ - Sep-17-2017 Linux Mont 18.2 comes with Python 3.6 installed. It appears that you are trying to load a package for python 2.7 if you have installed python 2.7, this should not be a problem. I can't find this package in Pypi, which may indicate a work in progress, or a work never finished. It looks like formatter.py is looking for a variable named data, which is passed as an argument to class BaseFormatter._parse which is supplies to any of the available formatters (html, markdown, simple or original) You are passing this with -f, so don't know what's going on, and I'm not going to reverse engineer the entire package. This apparently cannot be resolved by the installer. I'd try the example, and make sure that works first, but You might want to look at other packages, see: https://pypi.python.org/pypi?%3Aaction=search&term=speech+to+text&submit=search RE: speech_to_text command doesn't seem to work - snakebyte - Sep-17-2017 Hi Larz60 I think I have 2.7 and 3.5 installed. It's in PyPi: https://pypi.python.org/pypi/speech-to-text/0.0.1 This info may help: python Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 __________________________________ dpkg -l python Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-==============-============-============-================================= ii python 2.7.11-1 amd64 interactive high-level object-ori ____________________________________ python3 Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux ____________________________________ dpkg -l python3 Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-==============-============-============-================================= ii python3 3.5.1-3 amd64 interactive high-level object-ori ------------ P.S. How do I edit my OP? RE: speech_to_text command doesn't seem to work - Larz60+ - Sep-17-2017 to change python3 as default, from command line type: alias python=/usr/bin/python3you could also set: alias python2=/usr/bin/python2.7then you can use either Again: You might want to look at other packages, see: https://pypi.python.org/pypi?%3Aaction=s...mit=search RE: speech_to_text command doesn't seem to work - snakebyte - Sep-18-2017 Hi Larz. Thanks again for your reply. Are you saying that making pythone3 my default will fix my problem? RE: speech_to_text command doesn't seem to work - Larz60+ - Sep-18-2017 Quote:Are you saying that making python3 my default will fix my problem?No, I'm not - Just pointing out that the load you're doing is for python 2.7, and showing how you can make python 3 the default RE: speech_to_text command doesn't seem to work - snakebyte - Sep-18-2017 I tried the same command with a different, smaller file. This file is a 90KB ogg file. The other one (which gave me the error message in my OP) was a much larger 26MB ogg file. Both files, according to "File Properties", are audio/x-vorbis+ogg. Wtih this smaller file, there was no error. speech_to_text -u myUsername -p myPassword -f html -i audio-file.ogg transcript.html Starting Upload. [===============================================================] 100% Upload finished. Waiting for Transcript Speech > Text finished.In the same folder as the ogg file was transcript.html, which had the transcript. :) So I guess the python command works some times. I'm still not sure if it just doesn't work on large files. The creator of this python command is investigating the matter. RE: speech_to_text command doesn't seem to work - Larz60+ - Sep-18-2017 I would guess that python is working all of the time, and suspect that the file is corrupt. RE: speech_to_text command doesn't seem to work - snakebyte - Sep-18-2017 (Sep-18-2017, 04:37 PM)Larz60+ Wrote: I would guess that python is working all of the time, and suspect that the file is corrupt. I just played the 26MB ogg file on my computer, and it plays just fine. If it plays just fine, that means it's not corrupt, right? RE: speech_to_text command doesn't seem to work - Larz60+ - Sep-18-2017 I would agree with that observation! |