示例#1
0
def get_response():
	wit.init()
	wit.voice_query_start('I5FO3XJWG7M5NYLBTDIN44VUQ6YEOBGI') # start recording
	time.sleep(2) # let's speak for 2 seconds
	a = json.loads(wit.voice_query_stop())
	wit.close()
	print(a)
示例#2
0
文件: voice.py 项目: kszlim/genre
def listen(intents):
	while True:
		wit.voice_query_start(wit_access_token)
		time.sleep(6)
		response = json.loads(wit.voice_query_stop())
		print response
		if len(response['outcomes']) > 0 and response['outcomes'][0]['intent'] == 'start_listen':
			break

	shutdown = False
	while not shutdown:
		print '\nActive Mode\n'
		wit.voice_query_start(wit_access_token)
		time.sleep(5)
		response = json.loads(wit.voice_query_stop())
		print response, 'respsssssssss'
		print('Response: {}'.format(response))
		for outcome in response['outcomes']:
			if outcome['intent'] in intents:
				if outcome['intent'] == 'youtube':
					print 'sending request'
					intents[outcome['intent']](outcome['entities']['search_query'][0]['value'])
				elif intents[outcome['intent']]() == True:
					return listen(intents)
				break
示例#3
0
def main():            
    # initialize WIT.AI
    wit.init()

    wit.voice_query_start(WIT_AI_KEY)

    time.sleep(3)

    response = wit.voice_query_stop()
    wit.close()

    # case for the keyword voice command
    checkStartup(getIntent(response))
示例#4
0
def witVoice():
    wit.voice_query_start("RB3ED7T4K2AU7KMI6JWL7VSXKRVU4YAC")
    time.sleep(4)
    response = wit.voice_query_stop()
    #print("Response: {}".format(response))
    return response
import wit
import time

wit.init()
while(True):
	wit.voice_query_start("GQ5ETCLIQOZNLVEQWLCRMZK7IGGGYP23")
	time.sleep(5)
	response = wit.voice_query_stop()
	print("Response: {}".format(response))
wit.close()

示例#6
0
def witVoice():
    wit.voice_query_start(key)
    time.sleep(czasMowy)
    response = wit.voice_query_stop()

    return response
示例#7
0
def witVoice():
    wit.voice_query_start(key)
    time.sleep(czasMowy)
    response = wit.voice_query_stop()

    return response
示例#8
0
文件: io.py 项目: iostreamer-X/Dyna
import search
import go_to_link
import music_control

context = 'null'
if __name__ == '__main__':
	def handle_response(response):
    		decoded = json.loads(response)
		body = decoded['_text']
		if body is not None:
			confidence = decoded['outcomes'][0]['confidence']
			intent = decoded['outcomes'][0]['intent']
			if confidence >= 0.67:
				exec(intent+'.handle(response)')


	wit.init()

	while True:
		os.system("pkill notify-osd && notify-send Listening")
		wit.voice_query_start('O66U5BV3JAAAZ7YENBNJVHTWN2DXGZ3Z')
		time.sleep(5)
		os.system("pkill notify-osd && notify-send Processing")
		response = wit.voice_query_stop()
		try:
			thread.start_new_thread(handle_response,(response,))
		except:
			print "Dafaq"

	wit.close()
示例#9
0
def witVoice():
    wit.voice_query_start("RB3ED7T4K2AU7KMI6JWL7VSXKRVU4YAC")
    time.sleep(czasMowy) 
    response = wit.voice_query_stop()

    return response
示例#10
0
import wit
import time

def callback(response):
	print("Response: {}".format(response))

if __name__ == "__main__":
	wit.init()
	wit.voice_query_start("ACCESS_TOKEN")
	time.sleep(2)
	wit.voice_query_stop_async(callback)
	time.sleep(5)
	wit.close()