rasa/core/policies/form_policy.py
def predict_action_probabilities(self,
                                     tracker: DialogueStateTracker,
                                     domain: Domain) -> List[float]:
        """Predicts the corresponding form action if there is an active form"""
        result = [0.0] * domain.num_actions

        if tracker.active_form.get('name'):
            logger.debug("There is an active form '{}'"
                         "".format(tracker.active_form['name']))
            if tracker.latest_action_name == ACTION_LISTEN_NAME:
                # predict form action after user utterance

                if tracker.active_form.get('rejected'):
                    if self.state_is_unhappy(tracker, domain):
                        tracker.update(FormValidation(False))
                        return result

                idx = domain.index_for_action(tracker.active_form['name'])
                result[idx] = 1.0

            elif tracker.latest_action_name == tracker.active_form.get('name'):
                # predict action_listen after form action
                idx = domain.index_for_action(ACTION_LISTEN_NAME)
                result[idx] = 1.0
        else:
            logger.debug("There is no active form")

        return result
Predicts the corresponding form action if there is an active form
Predicts the corresponding form action if there is an active form
Predicts the corresponding form action if there is an active form
def predict_action_probabilities(self,
                                     tracker: DialogueStateTracker,
                                     domain: Domain) -> List[float]:
        result = [0.0] * domain.num_actions
        if tracker.active_form.get('name'):
            logger.debug("There is an active form '{}'"
                         "".format(tracker.active_form['name']))
            if tracker.latest_action_name == ACTION_LISTEN_NAME:
                if tracker.active_form.get('rejected'):
                    if self.state_is_unhappy(tracker, domain):
                        tracker.update(FormValidation(False))
                        return result
                idx = domain.index_for_action(tracker.active_form['name'])
                result[idx] = 1.0
            elif tracker.latest_action_name == tracker.active_form.get('name'):
                idx = domain.index_for_action(ACTION_LISTEN_NAME)
                result[idx] = 1.0
        else:
            logger.debug("There is no active form")
        return result
def predict_action_probabilities ( self , tracker : DialogueStateTracker , domain : Domain ) -> List [ float ] : result = [ 0.0 ] * domain . num_actions if tracker . active_form . get ( 'name' ) : logger . debug ( "There is an active form '{}'" "" . format ( tracker . active_form [ 'name' ] ) ) if tracker . latest_action_name == ACTION_LISTEN_NAME : if tracker . active_form . get ( 'rejected' ) : if self . state_is_unhappy ( tracker , domain ) : tracker . update ( FormValidation ( False ) ) return result idx = domain . index_for_action ( tracker . active_form [ 'name' ] ) result [ idx ] = 1.0 elif tracker . latest_action_name == tracker . active_form . get ( 'name' ) : idx = domain . index_for_action ( ACTION_LISTEN_NAME ) result [ idx ] = 1.0 else : logger . debug ( "There is no active form" ) return result
Predicts the corresponding form action if there is an active form
Predicts the corresponding form action if there is an active form
"""Predicts the corresponding form action if there is an active form""" # predict form action after user utterance # predict action_listen after form action
self
tracker
DialogueStateTracker
domain
Domain