Open Source Text Processing Project: PyJulius

Deep Learning Specialization on Coursera

PyJulius: Python interface to Julius speech recognition engine

Project Website:
Github Link:


pyjulius provides a simple interface to connect to julius module server

First you will need to run julius with the -module option (documentation here or man julius). Julius will wait for a client to connect, this is what Client does in a threaded way.

Let’s just write a simple program that will print whatever the julius server sends until you press CTRL+C:

#!/usr/bin/env python
import sys
import pyjulius
import Queue

# Initialize and try to connect
client = pyjulius.Client(‘localhost’, 10500)
except pyjulius.ConnectionError:
print ‘Start julius as module first!’

# Start listening to the server
while 1:
result = client.results.get(False)
except Queue.Empty:
print repr(result)
except KeyboardInterrupt:
print ‘Exiting…’
client.stop() # send the stop signal
client.join() # wait for the thread to die
client.disconnect() # disconnect from julius
If you are only interested in recognitions, wait for an instance of Sentence objects in the queue:

if isinstance(result, pyjulius.Sentence):
print ‘Sentence “%s” recognized with score %.2f’ % (result, result.score)
If you do not want Client to interpret the raw xml Element, you can set modelize attribute to False

If you encounter any encoding issues, have a look at the -charconv option of julius and set the Client.encoding to the right value

Leave a Reply

Your email address will not be published. Required fields are marked *