def __init__(self): # Initialize and try to connect self.client = pyjulius.Client('localhost', 10500) #ROS rospy.init_node("ros_julius", disable_signals=True) self.publisher = rospy.Publisher("speech_recognizing", String, queue_size=1)
def __init__(self, host="localhost", module_port=10500, adin_port=5530): self.host = host self.adin_port = adin_port # Initialize and try to connect self.client = pyjulius.Client(host, module_port, modelize=False) # Connect adin self.adintool_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def run(self): # Initialize and try to connect self.client = pyjulius.Client('localhost', 10500) self.client.modelize = True try: self.client.connect() except pyjulius.ConnectionError: print 'Start julius as module first!' sys.exit(1) # Start listening to the server self.client.start() self.result = "" self.think = Think() while (True): self.RequestMsg()
def __init__(self, host, port, encoding, min_score): super(Julius, self).__init__() self.client = pyjulius.Client(host, port, encoding) self.min_score = min_score
# server.py import sys import pyjulius import Queue # Initialize and try to connect client = pyjulius.Client('localhost', 10500) try: client.connect() except pyjulius.ConnectionError: print 'Start julius as module first!' sys.exit(1) # Start listening to the server client.start() try: while 1: try: result = client.results.get(False) except Queue.Empty: continue 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