本文整理汇总了Python中dialogueModule.Dialogue.youSay方法的典型用法代码示例。如果您正苦于以下问题:Python Dialogue.youSay方法的具体用法?Python Dialogue.youSay怎么用?Python Dialogue.youSay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dialogueModule.Dialogue
的用法示例。
在下文中一共展示了Dialogue.youSay方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MyForm
# 需要导入模块: from dialogueModule import Dialogue [as 别名]
# 或者: from dialogueModule.Dialogue import youSay [as 别名]
#.........这里部分代码省略.........
self.y = []
currentData = self.ms.returnNewData()
for x in range(len(currentData[0])):
if input == 'abusive':
c = sin(0.02*x)
elif input == 'sad':
c = sin(0.02*x + 0.5*pi)
elif input == 'happy':
c = sin(0.2*x + 0.5*pi)
elif input == 'average':
c = 1
elif not ['abusive', 'sad', 'happy'].__contains__(input):
break
self.y.append(c)
c = 0
self.ui.statusbar.showMessage("Trying some LMA...")
if ['heavy', 'light', 'fast', 'slow', 'free', 'bound', 'direct', 'indirect'].__contains__(input):
for x in range(len(currentData[0])):
c = 1
self.y.append(c)
c = 0
for i in range(len(self.y)):
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):
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))
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"])
#threading.Thread(target=self.jello(getUserInput)).start()
self.dialogueInit = False
self.ui.lineEditUserDialogue.clear()
# 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():
示例2: MyForm
# 需要导入模块: from dialogueModule import Dialogue [as 别名]
# 或者: from dialogueModule.Dialogue import youSay [as 别名]
#.........这里部分代码省略.........
def setActionsChannelsCheckBox(self):
print "setting actions for channel checkboxes...",
for k,v in self.ui.channels.items():
QtCore.QObject.connect(v, QtCore.SIGNAL("stateChanged(int)"), self.toggleChannelVisible)
print "done!"
def setActionsInterpolation(self):
QtCore.QObject.connect(self.ui.interpTensionSpinBox, QtCore.SIGNAL("valueChanged(int)"), self.updateInterpParams)
QtCore.QObject.connect(self.ui.interpBiasSpinBox, QtCore.SIGNAL("valueChanged(int)"), self.updateInterpParams)
QtCore.QObject.connect(self.ui.interpContinuitySpinBox, QtCore.SIGNAL("valueChanged(int)"), self.updateInterpParams)
QtCore.QObject.connect(self.ui.interpButton, QtCore.SIGNAL("clicked()"), self.interpMotion)
#------
def toggleChatContextVisible(self, value):
if value:
self.ui.chatContextGroupin.setVisible(True)
self.writeToStatusBar("Displaying chat context")
else:
self.ui.chatContextGroupin.setVisible(False)
self.writeToStatusBar("Hiding chat context")
def toggleStateVisible(self, value):
if value:
self.ui.stateGroup.setVisible(True)
self.writeToStatusBar("Displaying robot state")
else:
self.ui.stateGroup.setVisible(False)
self.writeToStatusBar("Hiding robot state")
#print value, self.affectProcessing
# ---
def talkToRobot(self):
if self.dialogue.getName():
response = self.dialogue.youSay('my name is '+self.dialogue.getName())
self.ui.chatArea.append("<b><font color=blue>%s</font></b>" % (response))
getUserInput = self.ui.chatInput.text()
#print "Input: ", getUserInput, "type: ", type(str(getUserInput))
getUserInput = str(getUserInput)
if getUserInput in self.chatoptions.keys():
response = self.dialogue.youSay(self.chatoptions[getUserInput])
self.ui.chatArea.append("> %s" % (self.chatoptions[getUserInput]))
self.scriptindex +=1
else:
response = self.dialogue.youSay(getUserInput)
self.ui.chatArea.append("> %s" % (getUserInput))
if getUserInput in [re for k,re in self.chatoptions.iteritems()]:
self.scriptindex +=1
self.ui.chatArea.append("<b><font color=blue>>> %s</font></b>" % (response))
self.ui.chatArea.append("<b><font color=green>Select your response:</font></b>")
if self.scriptindex >= len(self.SCRIPT):
self.scriptindex = 0
scriptline = self.SCRIPT[self.scriptindex]
for i in range(len(scriptline)):
if scriptline[i] != '':
self.ui.chatArea.append("<b><font color=green>%d. %s</font></b>" % (i, scriptline[i]))
self.chatoptions[str(i)] = scriptline[i]
self.ui.chatArea.append("<b><font color=green>Or type anything ...</font></b><br>")
# LOCOCONTEXT PART
print "before lcontext...%s, %s" % (response, getUserInput)
示例3: MyForm
# 需要导入模块: from dialogueModule import Dialogue [as 别名]
# 或者: from dialogueModule.Dialogue import youSay [as 别名]
#.........这里部分代码省略.........
#self.newData = tmp
self.ms.DATA = tmp
except:
self.ui.statusbar.showMessage("Uh oh, something is wrong...")
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"])
示例4: MyForm
# 需要导入模块: from dialogueModule import Dialogue [as 别名]
# 或者: from dialogueModule.Dialogue import youSay [as 别名]
#.........这里部分代码省略.........
for x in range(len(currentData[0])):
if input == 'abusive':
c = sin(0.02*x)
elif input == 'sad':
c = sin(0.02*x + 0.5*pi)
elif input == 'happy':
c = sin(0.2*x + 0.5*pi)
elif input == 'average':
c = 1
elif not ['abusive', 'sad', 'happy'].__contains__(input):
break
self.y.append(c)
c = 0
self.ui.statusbar.showMessage("Trying some LMA...")
if ['heavy', 'light', 'fast', 'slow', 'free', 'bound', 'direct', 'indirect'].__contains__(input):
for x in range(len(currentData[0])):
c = 1
self.y.append(c)
c = 0
for i in range(len(self.y)):
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):
示例5: MyForm
# 需要导入模块: from dialogueModule import Dialogue [as 别名]
# 或者: from dialogueModule.Dialogue import youSay [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('')
示例6: MyForm
# 需要导入模块: from dialogueModule import Dialogue [as 别名]
# 或者: from dialogueModule.Dialogue import youSay [as 别名]
#.........这里部分代码省略.........
def setActionsChannelsCheckBox(self):
print "setting actions for channel checkboxes...",
for k,v in self.ui.channels.items():
QtCore.QObject.connect(v, QtCore.SIGNAL("stateChanged(int)"), self.toggleChannelVisible)
print "done!"
def setActionsInterpolation(self):
QtCore.QObject.connect(self.ui.interpTensionSpinBox, QtCore.SIGNAL("valueChanged(int)"), self.updateInterpParams)
QtCore.QObject.connect(self.ui.interpBiasSpinBox, QtCore.SIGNAL("valueChanged(int)"), self.updateInterpParams)
QtCore.QObject.connect(self.ui.interpContinuitySpinBox, QtCore.SIGNAL("valueChanged(int)"), self.updateInterpParams)
QtCore.QObject.connect(self.ui.interpButton, QtCore.SIGNAL("clicked()"), self.interpMotion)
#------
def toggleChatContextVisible(self, value):
if value:
self.ui.chatContextGroupin.setVisible(True)
self.writeToStatusBar("Displaying chat context")
else:
self.ui.chatContextGroupin.setVisible(False)
self.writeToStatusBar("Hiding chat context")
def toggleStateVisible(self, value):
if value:
self.ui.stateGroup.setVisible(True)
self.writeToStatusBar("Displaying robot state")
else:
self.ui.stateGroup.setVisible(False)
self.writeToStatusBar("Hiding robot state")
#print value, self.affectProcessing
# ---
def talkToRobot(self):
if self.dialogue.getName():
response = self.dialogue.youSay('my name is '+self.dialogue.getName())
self.ui.chatArea.append("<b><font color=blue>%s</font></b>" % (response))
getUserInput = self.ui.chatInput.text()
#print "Input: ", getUserInput, "type: ", type(str(getUserInput))
getUserInput = str(getUserInput)
if getUserInput in self.chatoptions.keys():
response = self.dialogue.youSay(self.chatoptions[getUserInput])
self.ui.chatArea.append("> %s" % (self.chatoptions[getUserInput]))
self.scriptindex +=1
else:
response = self.dialogue.youSay(getUserInput)
self.ui.chatArea.append("> %s" % (str(getUserInput)))
self.ui.chatArea.append("<b><font color=blue>>> %s</font></b>" % (response))
self.ui.chatArea.append("<b><font color=green>Select your response:</font></b>")
if self.scriptindex >= len(self.SCRIPT):
self.scriptindex = 0
scriptline = self.SCRIPT[self.scriptindex]
for i in range(len(scriptline)):
if scriptline[i] != '':
self.ui.chatArea.append("<b><font color=green>%d. %s</font></b>" % (i, scriptline[i]))
self.chatoptions[str(i)] = scriptline[i]
self.ui.chatArea.append("<b><font color=green>Or type anything ...</font></b><br>")
self.dialogueInit = False
self.ui.chatInput.clear()
示例7: MyForm
# 需要导入模块: from dialogueModule import Dialogue [as 别名]
# 或者: from dialogueModule.Dialogue import youSay [as 别名]
#.........这里部分代码省略.........
... another data already exist within MotionSynthesizer object: self.ms
... the internal self.ms data can be accessed as: self.ms.DATA
All operations on data should be done on the internal (self.ms.DATA)
This local data (self.allData) may be used to reset the internal data
"""
tmp = self.ms.mrfDoItAll(self.allData)
#tmp = self.ms.interpolate(self.allData)
# === Apply interpolation
self.newData = self.ms.interpolate(tmp)
#self.newData = self.ms.mrfDoItAll(tmp)
#self.newData = self.ms.interpolate(self.allData)
# === global variable # of channels
self.channels = len(self.newData)
for i in range(self.ms.countGains()):
for channel in range(self.channels):
self.ms.adjustGain(channel, i, 1)
# === copy the data
self.newData = self.ms.returnNewData()
self.tmpData = self.newData
# === Add curves to plot
for i in self.newData:
#for i in self.ms.DATA:
self.ui.qwtPlot.addCurve(i)
#self.ui.qwtPlot.addCurve(self.newData[0])
# === Get the bandpass filter bands
self.freqBands = self.ms.multiresFiltering(self.newData)
# === Create sliders for each bands
self.applyGainSignalSlot(len(self.freqBands[0]))
print self.freqBands[0]
self.ui.addBodySpinBoxes(self.newData)
print len(self.newData)
print len(self.newData[0])
#self.ms.DATA = self.newData
def evaluateExp(self):
try:
text = unicode(self.ui.expEdit.text())
#x = 2
self.ui.statusbar.showMessage("Waveshaping function(x) = %s" % (text))
c = 0
self.y = []
currentData = self.ms.returnNewData()
for x in range(len(currentData[0])):
c = eval(text)
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))
response = self.dialogue.youSay(getUserInput)
self.ui.textBrowserRobotResponse.append(response)