From 2ebb4fbf088cd15c5bad271aae1c0bc4fa52916b Mon Sep 17 00:00:00 2001 From: akelad Date: Tue, 10 Jul 2018 13:19:21 +0200 Subject: [PATCH] predict action listen after fallback --- rasa_core/policies/fallback.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rasa_core/policies/fallback.py b/rasa_core/policies/fallback.py index 60571fd8612..d1110c351e1 100644 --- a/rasa_core/policies/fallback.py +++ b/rasa_core/policies/fallback.py @@ -93,7 +93,12 @@ def predict_action_probabilities(self, tracker, domain): # to not override standard behaviour nlu_confidence = nlu_data["intent"].get("confidence", 1.0) - if self.should_fallback(nlu_confidence, tracker.latest_action_name): + # if the last action was fallback, we should always predict + # action listen after + if tracker.latest_action_name == self.fallback_action_name: + idx = domain.index_for_action('action_listen') + score = 1.1 + elif self.should_fallback(nlu_confidence, tracker.latest_action_name): logger.debug("NLU confidence {} is lower " "than NLU threshold {}. " "Predicting fallback action: {}"