Skip to content

Commit

Permalink
fix: not so confident emotion, coronavirus (#146)
Browse files Browse the repository at this point in the history
* fix: not so confident emotion skill

* fix: not so confident coronavirus skill

* fix: tests

* fix: test conf
  • Loading branch information
dilyararimovna authored Apr 29, 2022
1 parent 943a2e4 commit 75b1010
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
16 changes: 7 additions & 9 deletions skills/dff_coronavirus_skill/scenario/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
BIT_LOWER_CONFIDENCE = 0.90
ZERO_CONFIDENCE = 0.0

# Intention to know something about covid but not in specific subject
CLARIFY_INTENTION_ABOUT_COVID_CONFIDENCE = 1
# Intention to know covid incidence statistics in specific city/county/state/country
CLARIFY_INTENTION_ABOUT_SUBJECT_CONFIDENCE = 0.99
# Detected "fear" or "anger" emotion
Expand Down Expand Up @@ -152,7 +150,7 @@
"bluish lips or face. If you develop any of these signs, "
"get a medical attention.",
PROCESSING: {
"set_confidence": int_prs.set_confidence(SUPER_CONFIDENCE),
"set_confidence": int_prs.set_confidence(HIGH_CONFIDENCE),
"offer_more": loc_prs.offer_more,
},
TRANSITIONS: loc_cnd.replied_to_offer,
Expand All @@ -173,7 +171,7 @@
"give any recommendations about coronavirus. You can check the CDC "
"website for more info.",
PROCESSING: {
"set_confidence": int_prs.set_confidence(SUPER_CONFIDENCE),
"set_confidence": int_prs.set_confidence(HIGH_CONFIDENCE),
"offer_more": loc_prs.offer_more,
},
TRANSITIONS: loc_cnd.replied_to_offer,
Expand All @@ -182,7 +180,7 @@
RESPONSE: "Unfortunately, I am not allowed to give any recommendations "
"about coronavirus. You can check the CDC website for more info.",
PROCESSING: {
"set_confidence": int_prs.set_confidence(SUPER_CONFIDENCE),
"set_confidence": int_prs.set_confidence(HIGH_CONFIDENCE),
"offer_more": loc_prs.offer_more,
},
TRANSITIONS: loc_cnd.replied_to_offer,
Expand Down Expand Up @@ -211,7 +209,7 @@
# for more details about linking issue
RESPONSE: loc_rsp.tell_age_risks,
PROCESSING: {
"set_confidence": int_prs.set_confidence(SUPER_CONFIDENCE),
"set_confidence": int_prs.set_confidence(HIGH_CONFIDENCE),
"detect_age": loc_prs.detect_age,
"execute_response": loc_prs.execute_response,
"set_flag": loc_prs.set_flag("asked_about_age", True),
Expand Down Expand Up @@ -250,7 +248,7 @@
RESPONSE: "According to the recent data, there are {0} confirmed cases of coronavirus. "
"Shall I tell you more?",
PROCESSING: {
"set_confidence": int_prs.set_confidence(SUPER_CONFIDENCE),
"set_confidence": int_prs.set_confidence(HIGH_CONFIDENCE),
"insert_global_confirmed": loc_prs.insert_global_confirmed,
"set_flag": loc_prs.set_flag("core_fact_1", True),
},
Expand All @@ -263,7 +261,7 @@
"core_fact_2": {
RESPONSE: "According to the recent data, there are {0} confirmed deaths from coronavirus.",
PROCESSING: {
"set_confidence": int_prs.set_confidence(SUPER_CONFIDENCE),
"set_confidence": int_prs.set_confidence(HIGH_CONFIDENCE),
"insert_global_deaths": loc_prs.insert_global_deaths,
"offer_more": loc_prs.offer_more,
"set_flag": loc_prs.set_flag("core_fact_2", True),
Expand Down Expand Up @@ -294,7 +292,7 @@
"subject_undetected": {
"clarify_intention": {
RESPONSE: "I suppose you are asking about coronavirus. Is it right?",
PROCESSING: {"set_confidence": int_prs.set_confidence(CLARIFY_INTENTION_ABOUT_COVID_CONFIDENCE)},
PROCESSING: {"set_confidence": int_prs.set_confidence(HIGH_CONFIDENCE)},
TRANSITIONS: {
("covid_fact", "core_fact_1"): cnd.all(
[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
[
"Unfortunately, I am not allowed to give any recommendations about coronavirus. You can check the CDC website for more info. Would you want to learn more?",
1.0,
0.98,
{
"dff_coronavirus_skill_state": {
"shared_memory": {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
[
"I suppose you are asking about coronavirus. Is it right?",
1,
0.98,
{
"dff_coronavirus_skill_state": {
"shared_memory": {},
Expand Down
2 changes: 1 addition & 1 deletion skills/dff_coronavirus_skill/tests/covid_advice_out.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
[
"According to the CDC website, The main warning signs of coronavirus are: difficulty breathing or shortness of breath, persistent pain or pressure in the chest, new confusion or inability to arouse, bluish lips or face. If you develop any of these signs, get a medical attention. Would you want to learn more?",
1.0,
0.98,
{
"dff_coronavirus_skill_state": {
"shared_memory": {},
Expand Down
2 changes: 1 addition & 1 deletion skills/dff_coronavirus_skill/tests/covid_origin_out.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
[
"According to the CDC website, The main warning signs of coronavirus are: difficulty breathing or shortness of breath, persistent pain or pressure in the chest, new confusion or inability to arouse, bluish lips or face. If you develop any of these signs, get a medical attention. Would you want to learn more?",
1.0,
0.98,
{
"dff_coronavirus_skill_state": {
"shared_memory": {},
Expand Down
2 changes: 1 addition & 1 deletion skills/dff_coronavirus_skill/tests/covid_symptoms_out.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
[
"According to the statistical data, 9999 persons from 10000 in your age recover after contacting coronavirus if they are non-vaccinated and 99999 from 100000 if they are vaccinated. However, it is better to stay at home as much as you can to make older people safer. While staying at home, you may use a lot of different online cinema. ",
1.0,
0.98,
{
"dff_coronavirus_skill_state": {
"shared_memory": {},
Expand Down
4 changes: 2 additions & 2 deletions skills/emotion_skill/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ def __call__(self, dialogs):
was_active = False
was_scripted = False
if (was_trigger or was_active or self.regexp_sad) and not was_scripted:
attr["can_continue"] = MUST_CONTINUE
confidence = 1
attr["can_continue"] = CAN_CONTINUE_SCENARIO
confidence = 0.99
elif not very_very_confident and not was_active:
confidence = min(confidence, 0.99)
attr["can_continue"] = CAN_CONTINUE_SCENARIO
Expand Down

0 comments on commit 75b1010

Please sign in to comment.