def test_ask_affirmation(): policy = TwoStageFallbackPolicy.load("{}/models/two_stage_fallback".format(prj_dir)) events = [ActionExecuted(ACTION_LISTEN_NAME), user_uttered("Hi", 0.2)] next_action = _get_next_action(policy, events, default_domain) assert next_action == ACTION_DEFAULT_ASK_AFFIRMATION_NAME
def test_ask_rephrase(): policy = TwoStageFallbackPolicy.load("{}/models/two_stage_fallback".format(prj_dir)) events = [ ActionExecuted(ACTION_LISTEN_NAME), user_uttered("greet", 0.2), ActionExecuted(ACTION_DEFAULT_ASK_AFFIRMATION_NAME), ActionExecuted(ACTION_LISTEN_NAME), user_uttered("deny", 1), ] next_action = _get_next_action(policy, events, default_domain) assert next_action == ACTION_DEFAULT_ASK_REPHRASE_NAME
def test_unknown_instead_affirmation(): trained_policy = TwoStageFallbackPolicy.load("{}/models/two_stage_fallback".format(prj_dir)) events = [ ActionExecuted(ACTION_LISTEN_NAME), user_uttered("greet", 0.2), ActionExecuted(ACTION_DEFAULT_ASK_AFFIRMATION_NAME), ActionExecuted(ACTION_LISTEN_NAME), user_uttered("greet", 0.2), ] next_action = _get_next_action(trained_policy, events, default_domain) assert next_action == ACTION_DEFAULT_FALLBACK_NAME
def test_listen_after_hand_off(): trained_policy = TwoStageFallbackPolicy.load("{}/models/two_stage_fallback".format(prj_dir)) events = [ActionExecuted(ACTION_DEFAULT_FALLBACK_NAME)] next_action = _get_next_action(trained_policy, events, default_domain) assert next_action == ACTION_LISTEN_NAME