0

I have successfully installed pocketsphinx-0.8 in Ubuntu 12.04 as I was able to recognise voice with pocketsphinx_continuous.

How to import pocketsphinx in python after setting up pocketsphinx-0.8 as for now I am getting ImportError: No module named pocketsphinx

1

2 Answers 2

1

I'll bet it's case sensitive, like PocketSphinx or something.

I'd search for it using python interactive shell's help() func..

matthew@speedy:~/openstack/nova$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> help()

Welcome to Python 2.7!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/2.7/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help> modules phinx

Here is a list of matching modules.  Enter any module name to get more help.

matplotlib.sphinxext 
matplotlib.sphinxext.ipython_console_highlighting - reST directive for syntax-highlighting ipython interactive sessions.
matplotlib.sphinxext.mathmpl 
matplotlib.sphinxext.only_directives 
matplotlib.sphinxext.plot_directive - A directive for including a matplotlib plot in a Sphinx document.

So it's just a simple import for me:

matthew@speedy:~/Downloads/pocketsphinx-0.8$ sudo apt-get install python-pocketsphinx
...
>>> import pocketsphinx
>>> dir(pocketsphinx)
['Decoder', 'LatLink', 'LatLinkIterator', 'LatNode', 'LatNodeIterator', 'Lattice', '__builtins__', '__doc__', '__file__', '__name__', '__package__']

It was hard to install from source (I gave up), but easy to install the ubuntu lib.


This site looks like it could be useful for installing it from source: http://www.cs.columbia.edu/~ecooper/CS4706/ps-mac.html

Sign up to request clarification or add additional context in comments.

Comments

0

If you have correctly installed pocketsphinx, then this command should work.

import pocketsphinx 

If you are still having the problem, then put it in try/except block:

try:
    import pocketsphinx
except:
    pass

import pocketsphinx

To install pocketsphinx in Ubuntu, you can use this command:

sudo apt-get install python-pocketsphinx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.