当前位置: 首页>>代码示例>>Python>>正文


Python Dialogue.getValues方法代码示例

本文整理汇总了Python中dialogueModule.Dialogue.getValues方法的典型用法代码示例。如果您正苦于以下问题:Python Dialogue.getValues方法的具体用法?Python Dialogue.getValues怎么用?Python Dialogue.getValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dialogueModule.Dialogue的用法示例。


在下文中一共展示了Dialogue.getValues方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MyForm

# 需要导入模块: from dialogueModule import Dialogue [as 别名]
# 或者: from dialogueModule.Dialogue import getValues [as 别名]

#.........这里部分代码省略.........

		# LOCOCONTEXT PART
		self.lcontext.lcKeywords(response, getUserInput)
		#self.lcontext.lcKeywords(getUserInput,response)
		self.lcontext.updateContext()
		#-motion = self.lcontext.executeAllMotion()
		#-if motion: print "motion ready:", motion
		#-else: print "meh."
		self.lcontext.wrongname()
		if self.lcontext.wrongname():
			self.dialogue.recz()
		#print self.dialogue.getName()
		#if self.dialogue.getName():
		#	response = self.dialogue.youSay('my name is '+self.dialogue.getName())
		#	self.ui.textBrowserRobotResponse.append("<b><font color=blue>%s</font></b>" % (response))
		try:
			motion = self.lcontext.executeAllMotion()
			if motion: print "motion ready:"#, motion
			else: print "meh."
			self.updateDialogueContextAction(response)
			khr1Interface("/dev/ttyUSB0", motion).start()
			#print "final motion:", motion
			#print "WOOOHOOO!!!"
		except:
			print "Sorry, try again! Fix your LocoContext.executeAllMotion() function!"
		
		try:
			self.ui.statusbar.showMessage("I see "+self.dialogue.facedetect.faces+" face(s)")
		except:
			self.ui.statusbar.showMessage("I can't see anything...")
	
	##CB31 ---
	def updateDialogueContext(self, inputstring):
		self.ui.lineEditAction.setText(self.dialogue.getValues("GET ACTION"))
		self.dialogueContext["topic"] = self.dialogue.getValues("GET TOPIC")
		self.dialogueContext["username"] = self.dialogue.getValues("GET USERNAME")
		self.dialogueContext["usermood"] = self.dialogue.getValues("GET USERMOOD")
		self.dialogueContext["it"] = self.dialogue.getValues("GET IT")
		self.dialogueContext["personality"] = self.dialogue.getValues("GET PERSONALITY")
		self.dialogueContext["robotmood"] = self.dialogue.getValues("GET ROBOTMOOD")
		self.dialogue.getValues(inputstring)

	##CB32 --- 
	def updateDialogueContextFields(self):
		self.ui.lineEditTopic.setText(self.dialogueContext["topic"])
		self.ui.lineEditIt.setText(self.dialogueContext["it"])
		self.ui.lineEditUsername.setText(self.dialogueContext["username"])
		self.ui.lineEditUsermood.setText(self.dialogueContext["usermood"])
		self.ui.lineEditPersonality.setText(self.dialogueContext["personality"])
		self.ui.lineEditRobotmood.setText(self.dialogueContext["robotmood"])
		#self.ui.lineEditAction.setText(self.dialogueContext["action"])
		#if not self.dialogueContext["action"] == "":
		#	self.executeAction()

	##CB33 ---
	def updateDialogueContextAction(self, inputstring):
		print inputstring

		self.keywords = []
		self.motions = []
		self.pattern = re.compile('i\'ll (dance|greet).$', re.I)
		self.pattern2 = re.compile('^hello', re.I)
		self.pattern3 = re.compile('bye', re.I)
		match = self.pattern.match(inputstring)
		match2 = self.pattern2.match(inputstring)
		match3 = self.pattern3.match(inputstring)
开发者ID:msunardi,项目名称:soundmotion,代码行数:70,代码来源:pyLocoRobo_20b.py

示例2: MyForm

# 需要导入模块: from dialogueModule import Dialogue [as 别名]
# 或者: from dialogueModule.Dialogue import getValues [as 别名]

#.........这里部分代码省略.........
                self.y[i] = float(self.y[i])/max(self.y)

        except:
            self.ui.statusbar.showMessage("Uh oh...")
        self.plotExp(self.ui.expPlot, range(len(currentData[0])), self.y)

    ##CB30 ---
    def talkToRobot(self):
        getUserInput = self.ui.lineEditUserDialogue.text()
        #print "Input: ", getUserInput, "type: ", type(str(getUserInput))
        getUserInput = str(getUserInput)
        response = self.dialogue.youSay(getUserInput)
        self.ui.textBrowserRobotResponse.append("> %s" % (str(getUserInput)))
        self.ui.textBrowserRobotResponse.append("<b><font color=blue>%s</font></b>" % (response))
        if not self.dialogueInit:
            self.updateDialogueContext(str(getUserInput))
            self.updateDialogueContextFields()
            if self.ui.lineEditAction.text() != '':
                self.updateDialogueContextAction(response)
            if not self.dialogueContext["personality"] == '':
                self.evaluateBasedOnInput(self.dialogueContext["personality"])

        self.dialogueInit = False
       
        self.ui.lineEditUserDialogue.clear()
        try:
            self.ui.statusbar.showMessage("I see "+self.dialogue.facedetect.faces+" face(s)")
        except:
            self.ui.statusbar.showMessage("I can't see anything...")
    
    ##CB31 ---
    def updateDialogueContext(self, inputstring):
        #self.dialogueContext["action"] = self.dialogue.getValues("GET ACTION")
        self.ui.lineEditAction.setText(self.dialogue.getValues("GET ACTION"))
        self.dialogueContext["topic"] = self.dialogue.getValues("GET TOPIC")
        self.dialogueContext["username"] = self.dialogue.getValues("GET USERNAME")
        self.dialogueContext["usermood"] = self.dialogue.getValues("GET USERMOOD")
        self.dialogueContext["it"] = self.dialogue.getValues("GET IT")
        self.dialogueContext["personality"] = self.dialogue.getValues("GET PERSONALITY")
        self.dialogueContext["robotmood"] = self.dialogue.getValues("GET ROBOTMOOD")
        self.dialogue.getValues(inputstring)

    ##CB32 --- 
    def updateDialogueContextFields(self):
        self.ui.lineEditTopic.setText(self.dialogueContext["topic"])
        self.ui.lineEditIt.setText(self.dialogueContext["it"])
        self.ui.lineEditUsername.setText(self.dialogueContext["username"])
        self.ui.lineEditUsermood.setText(self.dialogueContext["usermood"])
        self.ui.lineEditPersonality.setText(self.dialogueContext["personality"])
        self.ui.lineEditRobotmood.setText(self.dialogueContext["robotmood"])
        #self.ui.lineEditAction.setText(self.dialogueContext["action"])
        #if not self.dialogueContext["action"] == "":
        #    self.executeAction()

    ##CB33 ---
    def updateDialogueContextAction(self, inputstring):
        print inputstring
        
        self.pattern = re.compile('i\'ll (dance|greet).$', re.I)
        self.pattern2 = re.compile('^hello', re.I)
        self.pattern3 = re.compile('bye', re.I)
        match = self.pattern.match(inputstring)
        match2 = self.pattern2.match(inputstring)
        match3 = self.pattern3.match(inputstring)
        inputstring = inputstring.lower()
        print "inputstring: ", inputstring	
开发者ID:msunardi,项目名称:soundmotion,代码行数:70,代码来源:new_ui4_test14.py

示例3: MyForm

# 需要导入模块: from dialogueModule import Dialogue [as 别名]
# 或者: from dialogueModule.Dialogue import getValues [as 别名]

#.........这里部分代码省略.........
    def applyWaveshape2(self):
        try:
            tmp = []
            data = self.ms.returnNewData()
            print "click"

            for i in range(len(data)):
                try:
                    tmpData = list(numpy.add(data[i], numpy.multiply(data[i], self.new_points)))
                    self.ui.statusbar.showMessage("Applying waveshape 2...")                    
                except:
                    #print "length data: ", len(data[i]), "points = ", len(self.new_points)
                    self.ui.statusbar.showMessage("Waveshape 2 failed.")
                tmp.append(tmpData)
                self.ui.qwtPlot.changeCurve(i, tmpData)

            #self.newData = tmp
            self.ms.DATA = tmp
                
        except:
            self.ui.statusbar.showMessage("Uh oh, something is wrong...")
  
   
    def talkToRobot(self):
        getUserInput = self.ui.lineEditUserDialogue.text()
        #print "Input: ", getUserInput, "type: ", type(str(getUserInput))
        getUserInput = str(getUserInput)
        response = self.dialogue.youSay(getUserInput)
        self.ui.textBrowserRobotResponse.append("> %s" % (str(getUserInput)))
        self.ui.textBrowserRobotResponse.append("<b><font color=blue>%s</font></b>" % (response))
        if not self.dialogueInit:
            self.updateDialogueContext(str(getUserInput))
            self.updateDialogueContextFields()
            if self.ui.lineEditAction.text() != '':
                self.updateDialogueContextAction(response)
            if not self.dialogueContext["personality"] == '':
                self.evaluateBasedOnInput(self.dialogueContext["personality"])

        self.dialogueInit = False
       
        self.ui.lineEditUserDialogue.clear()
        try:
            self.ui.statusbar.showMessage("I see "+self.dialogue.facedetect.faces+" face(s)")
        except:
            self.ui.statusbar.showMessage("I can't see anything...")
    
    def updateDialogueContext(self, inputstring):
        #self.dialogueContext["action"] = self.dialogue.getValues("GET ACTION")
        self.ui.lineEditAction.setText(self.dialogue.getValues("GET ACTION"))
        self.dialogueContext["topic"] = self.dialogue.getValues("GET TOPIC")
        self.dialogueContext["username"] = self.dialogue.getValues("GET USERNAME")
        self.dialogueContext["usermood"] = self.dialogue.getValues("GET USERMOOD")
        self.dialogueContext["it"] = self.dialogue.getValues("GET IT")
        self.dialogueContext["personality"] = self.dialogue.getValues("GET PERSONALITY")
        self.dialogueContext["robotmood"] = self.dialogue.getValues("GET ROBOTMOOD")
        self.dialogue.getValues(inputstring)

    def updateDialogueContextFields(self):
        self.ui.lineEditTopic.setText(self.dialogueContext["topic"])
        self.ui.lineEditIt.setText(self.dialogueContext["it"])
        self.ui.lineEditUsername.setText(self.dialogueContext["username"])
        self.ui.lineEditUsermood.setText(self.dialogueContext["usermood"])
        self.ui.lineEditPersonality.setText(self.dialogueContext["personality"])
        self.ui.lineEditRobotmood.setText(self.dialogueContext["robotmood"])
        #self.ui.lineEditAction.setText(self.dialogueContext["action"])
        #if not self.dialogueContext["action"] == "":
        #    self.executeAction()

    def updateDialogueContextAction(self, inputstring):
        print inputstring
        self.pattern = re.compile('i\'ll (dance|greet).$', re.I)
        self.pattern2 = re.compile('^hello', re.I)
        self.pattern3 = re.compile('bye', re.I)
        match = self.pattern.match(inputstring)
        match2 = self.pattern2.match(inputstring)
        match3 = self.pattern3.match(inputstring)
        inputstring.lower()
        if inputstring.__contains__('I\'ll dance'):
            #print type(match.group(1))
            self.dialogueContext["action"] = "dance"
            self.ui.lineEditAction.setText("dance")
            self.executeAction()
        elif inputstring.__contains__('hello') or inputstring.__contains__('bye'):
            self.dialogueContext["action"] = "greet"
            self.ui.lineEditAction.setText("greet")
            self.updateHeartbeat(10)
            self.executeAction()
        elif inputstring.__contains__('calm'):
            self.updateHeartbeat(self.heartrate)
        elif inputstring.__contains__('tired'):
            self.updateHeartbeat(self.heartrate-10)
            self.setSliderValue(-2, 2)
        else:
            self.dialogueContext["action"] = ""
            self.ui.lineEditAction.setText("")

    def updateHeartbeat(self, rate):
        print "heart"
        self.timer.stop()
        self.timer.start(rate, self.ui.ecg)
开发者ID:msunardi,项目名称:soundmotion,代码行数:104,代码来源:new_ui4_test13.py

示例4: MyForm

# 需要导入模块: from dialogueModule import Dialogue [as 别名]
# 或者: from dialogueModule.Dialogue import getValues [as 别名]

#.........这里部分代码省略.........
                self.y.append(c)                
                c = 0            

            #print "y: ", y

            # == Normalize
            for i in range(len(self.y)):
                self.y[i] = float(self.y[i])/max(self.y)

            #print "new y: ",y
            
        except:
            self.ui.statusbar.showMessage("%s is invalid!" % text)

        self.plotExp(self.ui.expPlot, range(len(currentData[0])), self.y)


    def plotExp(self, target, x, y):
        self.expCurve = Qwt.QwtPlotCurve("expCurve")
        self.expCurve.setPen(Qt.QPen(Qt.Qt.blue))
        self.expCurve.setData(x, y)
        self.ui.expPlot.clear()
        self.expCurve.attach(target)
        self.ui.expPlot.replot()

    def applyWaveshape(self):
        try:
            tmp = []
            data = self.ms.returnNewData()

            for i in range(len(data)):
                tmpData = list(numpy.add(data[i], numpy.multiply(data[i], numpy.multiply(self.y, self.ui.expSpinBox.value()))))
                tmp.append(tmpData)
                self.ui.qwtPlot.changeCurve(i, tmpData)

            #self.newData = tmp
            self.ms.DATA = tmp
                
        except:
            self.ui.statusbar.showMessage("Uh oh, something is wrong...")
  
   
    def talkToRobot(self):
        getUserInput = self.ui.lineEditUserDialogue.text()
        #print "Input: ", getUserInput, "type: ", type(str(getUserInput))
        getUserInput = str(getUserInput)
        response = self.dialogue.youSay(getUserInput)
        self.ui.textBrowserRobotResponse.append("> %s" % (str(getUserInput)))
        self.ui.textBrowserRobotResponse.append("<b><font color=blue>%s</font></b>" % (response))
        if not self.dialogueInit:
            self.updateDialogueContext(str(getUserInput))
            self.updateDialogueContextFields()
            if self.ui.lineEditAction.text() != '':
                self.updateDialogueContextAction(response)

        self.dialogueInit = False
       
        self.ui.lineEditUserDialogue.clear()
        self.ui.statusbar.showMessage("I see "+self.dialogue.facedetect.faces+" face(s)")
    
    def updateDialogueContext(self, inputstring):
        #self.dialogueContext["action"] = self.dialogue.getValues("GET ACTION")
        self.ui.lineEditAction.setText(self.dialogue.getValues("GET ACTION"))
        self.dialogueContext["topic"] = self.dialogue.getValues("GET TOPIC")
        self.dialogueContext["username"] = self.dialogue.getValues("GET USERNAME")
        self.dialogueContext["usermood"] = self.dialogue.getValues("GET USERMOOD")
        self.dialogueContext["it"] = self.dialogue.getValues("GET IT")
        self.dialogueContext["personality"] = self.dialogue.getValues("GET PERSONALITY")
        self.dialogue.getValues(inputstring)

    def updateDialogueContextFields(self):
        self.ui.lineEditTopic.setText(self.dialogueContext["topic"])
        self.ui.lineEditIt.setText(self.dialogueContext["it"])
        self.ui.lineEditUsername.setText(self.dialogueContext["username"])
        self.ui.lineEditUsermood.setText(self.dialogueContext["usermood"])
        self.ui.lineEditPersonality.setText(self.dialogueContext["personality"])
        #self.ui.lineEditAction.setText(self.dialogueContext["action"])
        #if not self.dialogueContext["action"] == "":
        #    self.executeAction()

    def updateDialogueContextAction(self, inputstring):
        print inputstring
        self.pattern = re.compile('i\'ll (dance|greet).$', re.I)
        self.pattern2 = re.compile('^hello', re.I)
        self.pattern3 = re.compile('bye', re.I)
        match = self.pattern.match(inputstring)
        match2 = self.pattern2.match(inputstring)
        match3 = self.pattern3.match(inputstring)
        if inputstring.__contains__('I\'ll dance'):
            #print type(match.group(1))
            self.dialogueContext["action"] = "dance"
            self.ui.lineEditAction.setText("dance")
            self.executeAction()
        elif inputstring.__contains__('hello') or inputstring.__contains__('bye'):
            self.dialogueContext["action"] = "greet"
            self.ui.lineEditAction.setText("greet")
            self.executeAction()
        else:
            self.dialogueContext["action"] = ""
            self.ui.lineEditAction.setText('')
开发者ID:msunardi,项目名称:soundmotion,代码行数:104,代码来源:new_ui4_test6.py


注:本文中的dialogueModule.Dialogue.getValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。