def _get_slots_sub_state( tracker: "DialogueStateTracker", ) -> Dict[Text, Union[Text, Tuple[float]]]: """Set all set slots with the featurization of the stored value Args: tracker: dialog state tracker containing the dialog so far Returns: a dictionary mapping slot names to their featurization """ # proceed with values only if the user of a bot have done something # at the previous step i.e., when the state is not empty. if tracker.latest_message == UserUttered.empty( ) or not tracker.latest_action: return {} slots = {} for slot_name, slot in tracker.slots.items(): if slot is not None and slot.as_feature(): if slot.value == rasa.shared.core.constants.SHOULD_NOT_BE_SET: slots[ slot_name] = rasa.shared.core.constants.SHOULD_NOT_BE_SET elif any(slot.as_feature()): # only add slot if some of the features are not zero slots[slot_name] = tuple(slot.as_feature()) return slots
def _reset(self) -> None: """Reset tracker to initial state - doesn't delete events though!.""" self._reset_slots() self._paused = False self.latest_action = {} self.latest_message = UserUttered.empty() self.latest_bot_utterance = BotUttered.empty() self.followup_action = ACTION_LISTEN_NAME self.active_loop = None