コード例 #1
0
ファイル: Wikipedia.py プロジェクト: devagul93/Jarvis-System
def handle(text, mic, profile):

    # SEARCH ON WIKIPEDIA
    #	ny = wikipedia.summary("New York",sentences=3);
    #	mic.say("%s"% ny)

    #mic.say("What you want to search about")
    #text = mic.activeListen()
    print "entering wiki term"
    text = client.grab_input()
    while text.upper() == "WIKIPEDIA":
        print "entering while"
        text = client.grab_input()
        print text

    answer = wikipedia.summary(text, sentences=3)
    answer += "\n"
    print answer
    client.send_out(answer)
コード例 #2
0
ファイル: Wikipedia.py プロジェクト: devagul93/Jarvis-System
def handle(text,mic,profile):
 

# SEARCH ON WIKIPEDIA	
#	ny = wikipedia.summary("New York",sentences=3);
#	mic.say("%s"% ny)
	
	#mic.say("What you want to search about")
	#text = mic.activeListen()
	print "entering wiki term"
        text = client.grab_input()
	while text.upper()=="WIKIPEDIA":
            print "entering while"
	    text = client.grab_input()
	    print text

	answer = wikipedia.summary(text,sentences=3)
	answer +="\n" 
	print answer
	client.send_out(answer)
コード例 #3
0
def handle(text,mic,profile):
 

# SEARCH ON WIKIPEDIA	
#	ny = wikipedia.summary("New York",sentences=3);
#	mic.say("%s"% ny)
	
	#mic.say("")
	#text = mic.activeListen()
	list = "8 AM   go to college "
	client.send_out("ADD or LISTEN")
        text = client.grab_input()
	while text.upper()=="SCHEDULER":
	    text = client.grab_input()
	if text.upper()=="ADD":
	    while text.upper()=="ADD":
                text = client.grab_input()
	    list += text + "              "
	    client.send_out("added to list, your schedule for today is " + list)
	    client.send_out(list)
	else:
	    client.send_out("Your schedule for today is ")
	    client.send_out(list)
コード例 #4
0
    def handleForever(self):
        """
        Delegates user input to the handling function when activated.
        """
        self._logger.info("Starting to handle conversation with keyword '%s'.",
                          self.persona)
        while True:
            # Print notifications until empty
            #notifications = self.notifier.getAllNotifications()
            #for notif in notifications:
            #    self._logger.info("Received notification: '%s'", str(notif))

            #self._logger.debug("Started listening for keyword '%s'",self.persona)
            #threshold, transcribed = self.mic.passiveListen(self.persona)
            #self._logger.debug("Stopped listening for keyword '%s'",
            # self.persona)

            #if not transcribed or not threshold:
            #self._logger.info("Nothing has been said or transcribed.")
            #continue
            #self._logger.info("Keyword '%s' has been said!", self.persona)

            #self._logger.debug("Started to listen actively with threshold: %r",
            # threshold)
            input = []
            print "entering input"
            input = client.grab_input().strip().split()
            #input = self.mic.activeListenToAllOptions(threshold)
            #self._logger.debug("Stopped to listen actively with threshold: %r",
            # threshold)
            print input

            if input:
                print "if entered"
                self.brain.query(input)
            else:
                self.mic.say("Pardon?")
                print "else entered"
コード例 #5
0
    def handleForever(self):
        """
        Delegates user input to the handling function when activated.
        """
        self._logger.info("Starting to handle conversation with keyword '%s'.",
                          self.persona)
        while True:
            # Print notifications until empty
            #notifications = self.notifier.getAllNotifications()
            #for notif in notifications:
            #    self._logger.info("Received notification: '%s'", str(notif))

            #self._logger.debug("Started listening for keyword '%s'",self.persona)
            #threshold, transcribed = self.mic.passiveListen(self.persona)
            #self._logger.debug("Stopped listening for keyword '%s'",
                              # self.persona)

            #if not transcribed or not threshold:
                #self._logger.info("Nothing has been said or transcribed.")
                #continue
            #self._logger.info("Keyword '%s' has been said!", self.persona)

            #self._logger.debug("Started to listen actively with threshold: %r",
                              # threshold)
	    input = []
	    print "entering input"
            input = client.grab_input().strip().split()
            #input = self.mic.activeListenToAllOptions(threshold)
            #self._logger.debug("Stopped to listen actively with threshold: %r",
                              # threshold)
	    print input

            if input:
		print "if entered"
                self.brain.query(input)
            else:
                self.mic.say("Pardon?")
		print "else entered"
コード例 #6
0
def is_new(old):
    new = client.grab_input().upper()
    while new==old:
	new = client.grab_input().upper()
    return new