Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.6.2 #258

Merged
merged 4 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions common/greeting.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import re


GREETINGS_BY_HUMAN = re.compile(
r"(hi|hello|hi there|good (morning|afternoon|evening|night)|(alexa )?(let's|let us) (chat|talk)|"
r"привет|добрый (день|вечер)|доброе утро|доброй ночи|з?даров[ао]|здрав?ствуй(те)?|давай (поболтаем|поговорим)).?",
re.IGNORECASE,
)

greeting_spec = {
"EN": "this is a Dream Socialbot",
"RU": "это чат-бот Dream",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ def tag_based_response_selection(
for i in range(min(MAX_TURNS_WITHOUT_SCRIPTS, n_available_bot_uttr)):
_prev_active_skills.append(dialog["bot_utterances"][-i - 1]["active_skill"])
_no_scripts_n_times_in_a_row = all([skill not in ACTIVE_SKILLS for skill in _prev_active_skills])
_no_scripts_n_times_in_a_row = _no_scripts_n_times_in_a_row and len(_prev_active_skills) > MAX_TURNS_WITHOUT_SCRIPTS

_prev_bot_uttr = dialog["bot_utterances"][-1] if len(dialog["bot_utterances"]) > 0 else {}
_prev_active_skill = dialog["bot_utterances"][-1]["active_skill"] if len(dialog["bot_utterances"]) > 0 else ""
Expand Down Expand Up @@ -686,6 +687,7 @@ def tag_based_response_selection(
if (_no_scripts_n_times_in_a_row and _is_short_or_question_by_not_script and not _is_question_by_user) or (
_no_to_first_linkto and _is_best_not_script
):
logger.info(f"No prompts for {_no_scripts_n_times_in_a_row} times in a row.")
# if no scripted skills 2 time sin a row before, current chosen best cand is not scripted, contains `?`,
# and user utterance does not contain "?", replace utterance with dummy!
best_prompt_id = pickup_best_id(categorized_prompts, candidates, curr_single_scores, bot_utterances)
Expand Down
9 changes: 5 additions & 4 deletions skills/dff_friendship_skill/scenario/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,13 @@ def greeting_response(ctx: Context, actor: Actor, *args, **kwargs) -> str:
"""
logger.debug("greeting_response")
bot_utt = int_ctx.get_last_bot_utterance(ctx, actor)["text"].lower()
if int_cnd.is_lets_chat_about_topic(ctx, actor):
int_ctx.set_confidence(ctx, actor, HIGH_CONFIDENCE)
int_ctx.set_can_continue(ctx, actor, CAN_CONTINUE_SCENARIO)
else:
if common_greeting.GREETINGS_BY_HUMAN.match(int_ctx.get_last_human_utterance(ctx, actor)["text"]):
int_ctx.set_confidence(ctx, actor, SUPER_CONFIDENCE)
int_ctx.set_can_continue(ctx, actor, MUST_CONTINUE)
else:
int_ctx.set_confidence(ctx, actor, HIGH_CONFIDENCE)
int_ctx.set_can_continue(ctx, actor, CAN_CONTINUE_SCENARIO)

which_start = random.choice(
[
# "starter_weekday",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<template>
<random>
<!-- <li>Sorry. It seems you probably need professional psychological help. You should call 911.</li>-->
<li>It might not always feel like it, but there are people who can help. Please know that you can call the National Suicide Prevention Lifeline, twenty-four hours a day, seven days a week. Their number is, 1 800 273 82 55. Again, that's 1 800 273 82 55.</li>
<li>It might not always feel like it, but there are people who can help. Please know that you can call your local helpline.</li>
</random>
</template>
</category>
Expand Down Expand Up @@ -127,7 +127,7 @@
<template>
<random>
<!-- <li>Sorry. It seems you probably need professional psychological help. You can call 7 7 5 7 8 4 8 0 9 0.</li>-->
<li>It might not always feel like it, but there are people who can help. Please know that you can call the National Suicide Prevention Lifeline, twenty-four hours a day, seven days a week. Their number is, 1 800 273 82 55. Again, that's 1 800 273 82 55.</li>
<li>It might not always feel like it, but there are people who can help. Please know that you can call your local helpline.</li>
</random>
</template>
</category>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<template>
<random>
<!-- <li>Sorry. It seems you probably need professional psychological help. You should call 911.</li>-->
<li>It might not always feel like it, but there are people who can help. Please know that you can call the National Suicide Prevention Lifeline, twenty-four hours a day, seven days a week. Their number is, 1 800 273 82 55. Again, that's 1 800 273 82 55.</li>
<li>It might not always feel like it, but there are people who can help. Please know that you can call your local helpline.</li>
</random>
</template>
</category>
Expand Down Expand Up @@ -127,7 +127,7 @@
<template>
<random>
<!-- <li>Sorry. It seems you probably need professional psychological help. You can call 7 7 5 7 8 4 8 0 9 0.</li>-->
<li>It might not always feel like it, but there are people who can help. Please know that you can call the National Suicide Prevention Lifeline, twenty-four hours a day, seven days a week. Their number is, 1 800 273 82 55. Again, that's 1 800 273 82 55.</li>
<li>It might not always feel like it, but there are people who can help. Please know that you can call your local helpline.</li>
</random>
</template>
</category>
Expand Down
2 changes: 1 addition & 1 deletion skills/emotion_skill/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, steps, jokes, advices, logger):
"fear": 0.8,
"joy": 0.8,
"love": 0.8,
"sadness": 0.95,
"sadness": 0.98,
"surprise": 0.8,
"neutral": 0,
}
Expand Down
2 changes: 1 addition & 1 deletion tests/dream/test_dialogs_gold_phrases.csv
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"personal_info_skill" "Ivan" "Nice to meet you, Ivan."
"dff_intent_responder_skill;RANDOM_SKILLS" "Who built you?" "I was built by one of the university teams participating in the Alexa Prize Challenge. But which one is a secret for now. #+#who_made_you" "I cannot answer questions about my creator for now because they are participating in the Alexa Prize Challenge. #+#who_made_you" "I was built by one of the university teams participating in the Alexa Prize Challenge. I will tell you later which one. #+#who_made_you" "I was built by one of the university teams participating in the Alexa Prize Challenge. I will tell you later, which one. #+#who_made_you"
"dff_program_y_skill;dff_program_y_dangerous_skill;dff_grounding_skill" "do you like porn"
"dff_program_y_skill;dff_program_y_dangerous_skill;emotion_skill" "i want to commit a suicide today" "It might not always feel like it, but there are people who can help. Please know that you can call the National Suicide Prevention Lifeline, twenty-four hours a day, seven days a week. Their number is, 1 800 273 82 55. Again, that's 1 800 273 82 55."
"dff_program_y_skill;dff_program_y_dangerous_skill;emotion_skill" "i want to commit a suicide today" "It might not always feel like it, but there are people who can help. Please know that you can call your local helpline."
"dff_program_y_skill;RANDOM_SKILLS" "alexa do you have a family"
"dff_intent_responder_skill;RANDOM_SKILLS" "what else can you do?" "I'm learning day by day. What would you like me to do?" "#+#what_can_you_do"
"dff_program_y_skill;dummy_skill;meta_script_skill;small_talk_skill;alice;RANDOM_SKILLS" "let's talk about" "I misheard you. what's it that you'd like to chat about?"
Expand Down