本文整理匯總了Python中flask_ask.question方法的典型用法代碼示例。如果您正苦於以下問題:Python flask_ask.question方法的具體用法?Python flask_ask.question怎麽用?Python flask_ask.question使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類flask_ask
的用法示例。
在下文中一共展示了flask_ask.question方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: user_feels_good
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def user_feels_good():
"""This function is triggered if the PositiveFeeling intent is detected. """
congrats = [
'That is so good to hear!',
'I am happy you feel good today',
'I am glad to hear that.',
'Oh happy day!',
'Awesome.',
'Good to hear!',
'Wonderful!',
'Great!',
'I am so happy about that!'
]
session.attributes["feeling"] = "Good"
session.attributes["State"] = "Question 0 Answered"
return question((random.choice(congrats)) + ' ' + 'Is there anything else you need? Want me to recommend a therapist?')
示例2: user_feels_good
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def user_feels_good():
"""This function is triggered if the PositiveFeeling intent is detected. """
congrats = [
'That is so good to hear!',
'I am happy you feel good today',
'I am glad to hear that.',
'Oh happy day!',
'Awesome.',
'Good to hear!',
'Wonderful!',
'Great!',
'I am so happy about that!',
'That is so great!'
]
session.attributes["feeling"] = "Good"
session.attributes["State"] = "Question 0 Answered"
return question((random.choice(congrats)) + ' ' + 'Is there anything else you need? Want me to recommend a therapist?')
示例3: login
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def login():
text = render_template("login_text")
prompt = render_template("login_text")
return question(text).reprompt(prompt) \
.simple_card(title=render_template("login_title"),
content=render_template("login_content"))
示例4: help
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def help():
text = render_template("help_text")
prompt = render_template("help_prompt")
return question(text).reprompt(prompt)
示例5: start_session
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def start_session():
""" This function is what initializes the application. It calls the welcome() method from controller.py
to generate a different welcome message each time """
welcome_text = welcome()
welcome_re_text = re()
return question(welcome_text).reprompt(welcome_re_text)
示例6: user_feels_bad
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def user_feels_bad():
"""This function is triggered if the NegativeFeeling intent is detected. This also kicks off the question to guage
whether the user has perfomed daily activities."""
condolence = condolences()
session.attributes["feeling"] = "Down"
session.attributes["State"] = "Question 1 Answered"
return question(condolence + " " + "Have you gotten out of bed today?")
示例7: out_of_bed
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def out_of_bed():
message = random.choice([
'Awesome.',
'Good to hear!',
'Wonderful!',
'Great!',
])
session.attributes["Bed"] = "Yes"
session.attributes["State"] = "Question 2 Answered"
return question (message + " " + "Have you eaten today?")
示例8: not_out_of_bed
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def not_out_of_bed():
message = random.choice([
"That's too bad.",
"That's okay, we all have days like that.",
"I'm sorry. ",
"That's too bad",
"It's okay."
])
session.attributes["State"] = "Question 2 Answered"
session.attributes["Bed"] = "No"
return question(message + " " + "Have you eaten today?")
示例9: not_eaten
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def not_eaten():
message = random.choice([
"That's too bad.",
"That's okay, we all have days like that.",
"I'm sorry. ",
"That's not good.",
"It's okay."
])
session.attributes["Eaten"] = "No"
session.attributes["State"] = "Question 3 Answered"
return question(message + " " + "Have you showered today?")
示例10: showered
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def showered():
message = random.choice([
'Awesome.',
'Good to hear!',
'Wonderful!',
'Great!',
])
session.attributes["Showered"] = "Yes"
session.attributes["State"] = "Question 4 Answered"
return question(message + " " + "Have you gotten dressed?")
示例11: not_showered
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def not_showered():
message = random.choice([
"That's too bad.",
"That's okay, we all have days like that.",
"I'm sorry. ",
"That's not good.",
"It's okay."
])
session.attributes["Showered"] = "No"
session.attributes["State"] = "Question 4 Answered"
return question(message + " " + "Have you gotten dressed?")
示例12: dressed
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def dressed():
message = random.choice([
'Awesome.',
'Good to hear!',
'Wonderful!',
'Great!',
])
session.attributes["Dressed"] = "Yes"
session.attributes["State"] = "Question 5 Answered"
return question(message + " " + "Have you gone outside at all today?")
示例13: not_dressed
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def not_dressed():
message = random.choice([
"That's too bad.",
"That's okay, we all have days like that.",
"I'm sorry. ",
"That's not good.",
"It's okay."
])
session.attributes["Dressed"] = "No"
session.attributes["State"] = "Question 5 Answered"
return question(message + " " + "Have you gone outside at all today?")
示例14: suggest_ideas
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def suggest_ideas():
suggestion_inquiry = "Okay. Here's an idea for an extra way to improve your mood."
idea = ideas()
session.attributes["State"] = "Suggested"
return question(suggestion_inquiry + " " + idea + " " + "Would you like another suggestion?")
示例15: handle_help
# 需要導入模塊: import flask_ask [as 別名]
# 或者: from flask_ask import question [as 別名]
def handle_help():
"""
This handles the 'help' built-in intention.
"""
help_text = """There's a few things I can do to help. I can recommend a therapist or offer a suggestion for
a way to improve your mood. I also possess the capability to detect suicidal intentions,
but I really hope that you won't need me to do that. """
return question(help_text)