本文整理汇总了Python中client.conversation.Conversation.handleForever方法的典型用法代码示例。如果您正苦于以下问题:Python Conversation.handleForever方法的具体用法?Python Conversation.handleForever怎么用?Python Conversation.handleForever使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类client.conversation.Conversation
的用法示例。
在下文中一共展示了Conversation.handleForever方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
greet = ["How can I be of service master?", "I live again master", "hal 9000 now on line", "hello how are you master"]
salutation = random.choice(greet)
self.mic.say(salutation)
conversation = Conversation("JARVIS", self.mic, self.config)
conversation.handleForever()
示例2: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
if 'first_name' in self.config:
salutation = "How can I be of service, %s?" % self.config["first_name"]
else:
salutation = "How can I be of service?"
self.mic.say(salutation)
conversation = Conversation("JASPER", self.mic, self.config)
conversation.handleForever()
示例3: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
if 'first_name' in self.config:
salutation = ("How can I be of service, %s?"
% self.config["first_name"])
else:
salutation = "How can I be of service?"
self.mic.say(salutation)
conversation = Conversation("JASPER", self.mic, self.config) # It's looking like the python app doesn't do any voice processing?
conversation.handleForever()
示例4: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
if 'first_name' in self.config:
salutation = ("Was kann ich für dich tun?, %s?"
% self.config["first_name"])
else:
salutation = "Was kann ich für dich tun?"
self.mic.say(salutation)
conversation = Conversation("JASPER", self.mic, self.config)
conversation.handleForever()
示例5: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
if 'first_name' in self.config:
salutation = ("Hi, I am Bibli robot, my name is Lucky!") # %s?"
# % self.config["first_name"])
else:
salutation = "Hi, I am Bibli robot, my name is Lucky"
self.mic.say(salutation)
conversation = Conversation("LUCKY", self.mic, self.config)
conversation.handleForever()
示例6: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
if 'first_name' in self.config:
salutation = ("Hi 很高兴为你服务,我是小爱,聪明活泼的可可小爱,是你的语音小助手。我可以提供天气预报,时间查询,简单的数学计算,读唐诗,讲笑话,回答百科知识,根据和你的对话,还可以管理家中的网络设备。你可以通过,你好,可可小爱,来跟我打招呼。")
else:
salutation = "Hello 我是可可小爱,随时为你服务。"
# print " ".join(jieba.cut("hello可可小爱"))
self.mic.say(salutation)
conversation = Conversation(u"hello|可可|小爱|你好|您好|咳咳|小艾|哈喽|可爱", self.mic, self.config)
conversation.handleForever()
示例7: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
if 'first_name' in self.config:
salutation = ("How can I be of service, %s?"
% self.config["first_name"])
else:
salutation = "Powering up in LVL1. It's good to be back."
self.mic.say(salutation)
conversation = Conversation("WHOPPER", self.mic, self.config)
conversation.handleForever()
示例8: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
#if 'first_name' in self.config:
# salutation = ("How can I be of service, %s?"
# % self.config["first_name"])
#else:
# salutation = "How can I be of service?"
salutation = "Welcome to Biri! What would you like?"
self.mic.say(salutation)
conversation = Conversation("JASPER", self.mic, self.config)
conversation.handleForever()
示例9: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
first_name = client.jasperprofile.profile.get('first_name','')
if first_name:
salutation = (_("How can I be of service, %s?") % first_name)
else:
salutation = _("How can I be of service?")
self.mic.say(salutation)
conversation = Conversation("MACSEN", self.mic, client.jasperprofile.profile.get_yml())
conversation.handleForever()
示例10: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
if 'first_name' in self.config:
salutation = ("How can I be of service, %s?"
% self.config["first_name"])
else:
salutation = "How can I be of service?"
self.mic.say(salutation)
persona_name = self.config.get('persona_name', 'RALPH')
conversation = Conversation(persona_name, self.mic, self.config)
signal.signal(signal.SIGINT, self.get_sigint_handler(conversation))
conversation.handleForever()
示例11: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
if 'first_name' in self.config:
salutation = ("How can I be of service, %s?"
% self.config["first_name"])
else:
salutation = "How can I be of service?"
self.speaker.clean_and_say(salutation)
print("A moment of silence, please...")
self.mic.adjust_for_ambient_noise()
conversation = Conversation(self.requester, self.brain)
conversation.handleForever()
示例12: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
if 'first_name' in self.config:
salutation = ("Bonjour %s, que puis-je faire pour vous ?"
% self.config["first_name"])
else:
salutation = "Bonjour, que puis-je faire pour vous ?"
self.mic.say(salutation)
if 'name' in self.config:
name = self.config['name'].upper()
else:
name = "LOLA"
conversation = Conversation(name, self.mic, self.config)
conversation.handleForever()
示例13: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
# Random welcome message
welcomes = ["What do you need",
"How can I help"]
salutation = random.choice(welcomes)
if 'first_name' in self.config:
salutation = ("%s, %s?"
% (salutation, self.config["first_name"]))
else:
salutation = ("%s?" % salutation)
self.mic.say(salutation)
conversation = Conversation("SAGE", self.mic, self.config)
conversation.handleForever()
示例14: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
hour = int(time.strftime("%H"))
if hour > 6 and hour < 11:
salutation = "Good morning"
elif hour >= 11 and hour < 16:
salutation = "Good afternoon"
elif hour >= 16 and hour < 23:
salutation = "Good evening"
else:
salutation = "Hi there"
self.mic.say(salutation)
conversation = Conversation(self.config['persona'], self.mic, self.config)
conversation.handleForever()
示例15: run
# 需要导入模块: from client.conversation import Conversation [as 别名]
# 或者: from client.conversation.Conversation import handleForever [as 别名]
def run(self):
salutation = (u"%s,我能为您做什么?" % config.get("first_name", u'主人'))
persona = config.get("robot_name", 'DINGDANG')
conversation = Conversation(persona, self.mic)
# create wechat robot
if config.get('wechat', False):
self.wxBot = WechatBot.WechatBot(conversation.brain)
self.wxBot.DEBUG = True
self.wxBot.conf['qr'] = 'tty'
conversation.wxbot = self.wxBot
t = threading.Thread(target=self.start_wxbot)
t.start()
self.mic.say(salutation, cache=True)
conversation.handleForever()