Exemple #1
0
def speechRecog(result, listener):
    print("You Said: ", result)

    winspeech.say(result)
    if (result == "stop"):
        winspeech.stop_listening()
        sys.exit(0)
Exemple #2
0
    def __init__(self, q, threadDict, speechCommandsTuple=None):
        #print(    "args: ",  args,  "kargs: ",  kargs    )
        self.q = q
        self.tq = queue.Queue()

        print('working...')

        winspeech.initialize_recognizer(winspeech.INPROC_RECOGNIZER)
        with threadDict as td:
            if speechCommandsTuple == None:
                try:
                    ## this is here as experimental support
                    ## for custom winspeech version
                    listener = winspeech.listen_joecc(None, self.onListen)
                except:
                    listener = winspeech.listen_for_anything(self.onListen)
            else:
                listener = winspeech.listen_for(speechCommandsTuple,
                                                self.onListen)

        while listener.is_listening():

            with threadDict as d:
                doFuncQuit = d['doFuncQuit']
                active = d['active']
            if doFuncQuit == True:
                listener.stop_listening()
                winspeech.stop_listening()
                break

            time.sleep(0.03)
            while not self.tq.empty():
                qv = self.tq.get()
                q.put(qv)

        print('exiting worker...')
def SpeechRecognized(result, Listener):
    print('You said: %s' % (result))
    if result == "stop":
        print('Thank you')
        winspeech.stop_listening()
        sys.exit(0)
Exemple #4
0
#creating chat bot
bot = ChatBot('test')

#reading from file
conv = open('M.txt').readlines()

#bot training
bot.set_trainer(ListTrainer)

#trained for conversation
bot.train(conv)

#recognizing audio

while True:

    request = input('You: ')

    response = bot.get_response(request)
    winspeech.say(response)

    #response of the bot
    print('Bot: ', response)

if result == 'Bye':
    winspeech.stop_listening()
    sys.exit(0)

#conversaation ends
def speechRecognized(result, listener):
    print("You said: %s" % result)
    if result == 'stop':
        winspeech.stop_listening()
        sys.exit(0)
def speech_recognizer(result, listner):
    print("you said : %s" % result)
    if result == "stop":
        winspeech.stop_listening()
        sys.exit(0)
def SpeechRecognized(result,Listener):
	print('You said: %s'%(result))
	if result == "stop":
		print('Thank you')
		winspeech.stop_listening()
		sys.exit(0)