@@ -47,15 +47,15 @@ Requirements
4747Install
4848~~~~~~~
4949
50- .. code :: bash
51- pip install pocketsphinx
50+ .. code :: bash
51+ pip install pocketsphinx
5252
5353 or
5454
55- .. code :: bash
56- git clone --recursive https://github.com/bambocher/pocketsphinx-python
57- cd pocketsphinx-python
58- python setup.py install
55+ .. code :: bash
56+ git clone --recursive https://github.com/bambocher/pocketsphinx-python
57+ cd pocketsphinx-python
58+ python setup.py install
5959
6060 Install on Ubuntu
6161-----------------
@@ -73,51 +73,51 @@ Requirements
7373Install
7474~~~~~~~
7575
76- .. code :: bash
77- sudo apt-get install -qq python python-dev python-pip build-essential swig
78- sudo pip install pocketsphinx
76+ .. code :: bash
77+ sudo apt-get install -qq python python-dev python-pip build-essential swig
78+ sudo pip install pocketsphinx
7979
8080 or
8181
82- .. code :: bash
83- sudo apt-get install -qq python python-dev python-pip build-essential swig git
84- git clone --recursive https://github.com/bambocher/pocketsphinx-python
85- cd pocketsphinx-python
86- sudo python setup.py install
82+ .. code :: bash
83+ sudo apt-get install -qq python python-dev python-pip build-essential swig git
84+ git clone --recursive https://github.com/bambocher/pocketsphinx-python
85+ cd pocketsphinx-python
86+ sudo python setup.py install
8787
8888 Basic usage
8989-----------
9090
91- .. code :: python
92- # !/usr/bin/env python
93- import os
94-
95- import sphinxbase as sb
96- import pocketsphinx as ps
97-
98- MODELDIR = ' deps/pocketsphinx/model'
99- DATADIR = ' deps/pocketsphinx/test/data'
100-
101- # Create a decoder with certain model
102- config = ps.Decoder.default_config()
103- config.set_string(' -hmm' , os.path.join(MODELDIR , ' en-us/en-us' ))
104- config.set_string(' -lm' , os.path.join(MODELDIR , ' en-us/en-us.lm.bin' ))
105- config.set_string(' -dict' , os.path.join(MODELDIR , ' en-us/cmudict-en-us.dict' ))
106- config.set_string(' -logfn' , ' /dev/null' )
107- decoder = ps.Decoder(config)
108-
109- # Decode streaming data.
110- decoder.start_utt()
111- stream = open (os.path.join(DATADIR , ' goforward.raw' ), ' rb' )
112- while True :
113- buf = stream.read(1024 )
114- if buf:
115- decoder.process_raw(buf, False , False )
116- else :
117- break
118- decoder.end_utt()
119- stream.close()
120- print (' Best hypothesis segments:' , [seg.word for seg in decoder.seg()])
91+ .. code :: python
92+ # !/usr/bin/env python
93+ import os
94+
95+ import sphinxbase as sb
96+ import pocketsphinx as ps
97+
98+ MODELDIR = ' deps/pocketsphinx/model'
99+ DATADIR = ' deps/pocketsphinx/test/data'
100+
101+ # Create a decoder with certain model
102+ config = ps.Decoder.default_config()
103+ config.set_string(' -hmm' , os.path.join(MODELDIR , ' en-us/en-us' ))
104+ config.set_string(' -lm' , os.path.join(MODELDIR , ' en-us/en-us.lm.bin' ))
105+ config.set_string(' -dict' , os.path.join(MODELDIR , ' en-us/cmudict-en-us.dict' ))
106+ config.set_string(' -logfn' , ' /dev/null' )
107+ decoder = ps.Decoder(config)
108+
109+ # Decode streaming data.
110+ decoder.start_utt()
111+ stream = open (os.path.join(DATADIR , ' goforward.raw' ), ' rb' )
112+ while True :
113+ buf = stream.read(1024 )
114+ if buf:
115+ decoder.process_raw(buf, False , False )
116+ else :
117+ break
118+ decoder.end_utt()
119+ stream.close()
120+ print (' Best hypothesis segments:' , [seg.word for seg in decoder.seg()])
121121
122122 License
123123-------
0 commit comments