示例#1
0
    def callGroot(self):
        typed = str(self.upperLayout.inputEdit.text())
        reply = input_taking(typed)
        if reply[0] == 'news':
            speak_this("Showing news")
            self.upperLayout.outputEdit.setText("Showing news")

        self.upperLayout.outputEdit.setText(reply[1])
示例#2
0
 def listen_reply(self):
     spoken = listen()
     reply = input_taking(spoken)
     if reply[0] == 'news':
         speak_this("Showing news")
         print(reply[1])
         self.createNewsLayout(reply[1])
         self.upperLayout.outputEdit.setText("Showing news")
     else:
         self.upperLayout.outputEdit.setText(reply[1])
示例#3
0
文件: Gui.py 项目: ugroot/GROOT
    def listen_reply(self):
        spoken = listen()
        reply = input_taking(spoken)

        if reply[0] == 'news':
            self.upperLayout.outputEdit.setText("Showing news")
            speak_this("Showing news")
            self.createAdditionalLayout(reply[1], type="news")

        elif reply[0] == 'mail':
            self.upperLayout.outputEdit.setText("Mail Service")
            speak_this("Opening Mail Service")
            self.createAdditionalLayout(["No Need"], type="mail")

        elif reply[0] == 'notes':
            speak_this("Opening Notes")
            self.upperLayout.outputEdit.setText("Showing Note Widget")
            self.createAdditionalLayout(["No need"], type="notes")

        elif reply[0] == 'surprise':
            speak_this("I have a cure for Boredom")
            self.upperLayout.outputEdit.setText("Check Your Browser")
            self.bore()

        else:
            self.upperLayout.outputEdit.setText(reply[1])
示例#4
0
文件: groot.py 项目: ugroot/GROOT
def input_taking(input_text_msg):

    if re.findall("^news", input_text_msg):
        keywords = str(input_text_msg).split()
        return [keywords[0], keywords[1:]]

    if re.match("^(open mail|mail|groot mail|shoot mail|gmail|mail it)",
                input_text_msg):
        return ["mail", "Mail Tab"]

    if re.match(
            "^(notes|note|open docs|docs|groot docs|open notes|take note|take notes)",
            input_text_msg):
        return ["notes", "Note Tab"]

    if re.match("^(bored|surprise me|surprise)", input_text_msg):
        return ["surprise", "Link Exploration"]

    didyousay = ('hi groot', 'how are you', 'what is love', 'open facebook',
                 'how are you so smart')

    ansisthis = ("hello, What can i do for you",
                 "I'm still hot and sexy. Tell me something about you hotty",
                 "It's is something you should not do",
                 "oh, It is because my Creator is so smart.")

    whenidontknow = ("I am Groot", "what you are saying bro",
                     "What the f**k, say again", "ok, lets try again")

    if re.findall('[A-Z|a-z]{2,}[.][a-z]{2,}', input_text_msg):
        urls = re.findall('[A-Z|a-z]{2,}[.][a-z]{2,}', input_text_msg)
        url = urls[0]
        url_sk = re.findall('([a-z|A-Z]{2,})[.]', url)
        s = 'opening %s please wait' % str(url_sk[0])
        speak_this(s)
        returnvar = s
        openweb(url)

    elif re.findall('[o][n][ ][y][o][u][t][u][b][e]', input_text_msg):
        urls = re.findall('[p][l][a][y](.+)[o][n][ ][y][o][u][t]',
                          input_text_msg)
        url = str(urls)
        speak_this("Let's play" + url)
        returnvar = ("Let's play" + url)
        playthis(url)

    else:
        l = 0
        for i in range(0, 3):
            if didyousay[i] == input_text_msg.lower():
                speak_this(ansisthis[i])
                returnvar = ansisthis[i]
                l = 1

        if l == 0:
            i = randint(0, 3)
            speak_this(whenidontknow[i])
            returnvar = whenidontknow[i]

    return ["not news", returnvar]
示例#5
0
文件: groot.py 项目: saggu10417/GROOT
def input_taking(input_text_msg):
	didyousay=('hi groot',
			  'how are you',
			  'what is love',
			  'open facebook',
			  'how are you so smart'
			  )

	ansisthis=("hello, What can i do for you",
			   "I'm still hot and sexy. Tell me something about you hotty",
			   "It's is something you should not do",
			   "oh, It is because my Creator is so smart."
			   )

	whenidontknow=("I am Groot",
				   "what you are saying bro",
				   "What the f**k, say again",
				   "ok, lets try again")

	if re.findall('[A-Z|a-z]{2,}[.][a-z]{2,}', input_text_msg):
		urls=re.findall('[A-Z|a-z]{2,}[.][a-z]{2,}', input_text_msg)
		url=urls[0]
		url_sk=re.findall('([a-z|A-Z]{2,})[.]', url)
		s='opening %s please wait'%str(url_sk[0])
		speak_this(s)
		returnvar=s
		openweb(url)

	elif re.findall('[o][n][ ][y][o][u][t][u][b][e]', input_text_msg):
		 urls=re.findall('[p][l][a][y](.+)[o][n][ ][y][o][u][t]', input_text_msg)
		 url=str(urls)
		 speak_this("Let's play"+ url)
		 returnvar=("Let's play"+ url)
		 playthis(url)

	else:
		l=0
		for i in range(0,3):
			if didyousay[i]==input_text_msg.lower():
				speak_this(ansisthis[i])
				returnvar=ansisthis[i]
				l=1

		if l==0:
			i=randint(0, 3)
			speak_this(whenidontknow[i])
			returnvar=whenidontknow[i]
			
	return returnvar
示例#6
0
文件: Gui.py 项目: ugroot/GROOT
    def callGroot(self):
        typed = str(self.upperLayout.inputEdit.text())
        reply = input_taking(typed)
        if reply[0] == 'news':
            speak_this("Showing news")
            self.upperLayout.outputEdit.setText("Showing news")

        elif reply[0] == 'notes':
            speak_this("Opening Notes")
            self.upperLayout.outputEdit.setText("Showing Note Widget")
            self.createAdditionalLayout(reply[1], type="notes")

        elif reply[0] == 'mail':
            speak_this("Opening Mail Service")
            self.upperLayout.outputEdit.setText("Mail Service")
            self.createAdditionalLayout(reply[1], type="mail")

        elif reply[0] == 'surprise':
            speak_this("Let's not get bored")
            self.upperLayout.outputEdit.setText("Check your browser")
            self.bore()

        else:
            self.upperLayout.outputEdit.setText(reply[1])