Ejemplo n.º 1
0
    def create_tracker(
            self,
            sender_id: Text,
            append_action_listen: bool = True) -> DialogueStateTracker:
        """Creates a new tracker for `sender_id`.

        The tracker begins with a `SessionStarted` event and is initially listening.

        Args:
            sender_id: Conversation ID associated with the tracker.
            append_action_listen: Whether or not to append an initial `action_listen`.

        Returns:
            The newly created tracker for `sender_id`.

        """

        tracker = self.init_tracker(sender_id)

        if tracker:
            if append_action_listen:
                tracker.update(ActionExecuted(ACTION_LISTEN_NAME))

            self.save(tracker)

        return tracker
Ejemplo n.º 2
0
 def create_tracker(
     self, sender_id: Text, append_action_listen: bool = True
 ) -> DialogueStateTracker:
     """Creates a new tracker for the sender_id. The tracker is initially listening."""
     tracker = self.init_tracker(sender_id)
     if tracker:
         if append_action_listen:
             tracker.update(ActionExecuted(ACTION_LISTEN_NAME))
         self.save(tracker)
     return tracker
Ejemplo n.º 3
0
    def create_tracker(self, sender_id, append_action_listen=True):
        """Creates a new tracker for the sender_id.

        The tracker is initially listening."""

        tracker = self.init_tracker(sender_id)  #
        if tracker:  # 直接写成 if tracker and append_action_listen:  不好吗
            if append_action_listen:
                tracker.update(
                    ActionExecuted(ACTION_LISTEN_NAME))  # 为新建的tracker添加listen
            self.save(tracker)  # 把新建的tracker保存到tracker_store中管理起来
        return tracker