rasa/core/trackers.py
def generate_all_prior_trackers(self):
        # type: () -> Generator[DialogueStateTracker, None, None]
        """Returns a generator of the previous trackers of this tracker.

        The resulting array is representing
        the trackers before each action."""

        tracker = self.init_copy()

        ignored_trackers = []
        latest_message = tracker.latest_message

        for i, event in enumerate(self.applied_events()):
            if isinstance(event, UserUttered):
                if tracker.active_form.get('name') is None:
                    # store latest user message before the form
                    latest_message = event

            elif isinstance(event, Form):
                # form got either activated or deactivated, so override
                # tracker's latest message
                tracker.latest_message = latest_message

            elif isinstance(event, ActionExecuted):
                # yields the intermediate state
                if tracker.active_form.get('name') is None:
                    yield tracker

                elif tracker.active_form.get('rejected'):
                    for tr in ignored_trackers:
                        yield tr
                    ignored_trackers = []

                    if (not tracker.active_form.get('validate') or
                            event.action_name !=
                            tracker.active_form.get('name')):
                        # persist latest user message
                        # that was rejected by the form
                        latest_message = tracker.latest_message
                    else:
                        # form was called with validation, so
                        # override tracker's latest message
                        tracker.latest_message = latest_message

                    yield tracker

                elif event.action_name != tracker.active_form.get('name'):
                    # it is not known whether the form will be
                    # successfully executed, so store this tracker for later
                    tr = tracker.copy()
                    # form was called with validation, so
                    # override tracker's latest message
                    tr.latest_message = latest_message
                    ignored_trackers.append(tr)

                if event.action_name == tracker.active_form.get('name'):
                    # the form was successfully executed, so
                    # remove all stored trackers
                    ignored_trackers = []

            tracker.update(event)

        # yields the final state
        if tracker.active_form.get('name') is None:
            yield tracker
        elif tracker.active_form.get('rejected'):
            for tr in ignored_trackers:
                yield tr
            yield tracker
Returns a generator of the previous trackers of this tracker.

        The resulting array is representing
        the trackers before each action.
Returns a generator of the previous trackers of this tracker.
The resulting array is representing
the trackers before each action.
Returns a generator of the previous trackers of this tracker . The resulting array is representing the trackers before each action .
def generate_all_prior_trackers(self):
        tracker = self.init_copy()
        ignored_trackers = []
        latest_message = tracker.latest_message
        for i, event in enumerate(self.applied_events()):
            if isinstance(event, UserUttered):
                if tracker.active_form.get('name') is None:
                    latest_message = event
            elif isinstance(event, Form):
                tracker.latest_message = latest_message
            elif isinstance(event, ActionExecuted):
                if tracker.active_form.get('name') is None:
                    yield tracker
                elif tracker.active_form.get('rejected'):
                    for tr in ignored_trackers:
                        yield tr
                    ignored_trackers = []
                    if (not tracker.active_form.get('validate') or
                            event.action_name !=
                            tracker.active_form.get('name')):
                        latest_message = tracker.latest_message
                    else:
                        tracker.latest_message = latest_message
                    yield tracker
                elif event.action_name != tracker.active_form.get('name'):
                    tr = tracker.copy()
                    tr.latest_message = latest_message
                    ignored_trackers.append(tr)
                if event.action_name == tracker.active_form.get('name'):
                    ignored_trackers = []
            tracker.update(event)
        if tracker.active_form.get('name') is None:
            yield tracker
        elif tracker.active_form.get('rejected'):
            for tr in ignored_trackers:
                yield tr
            yield tracker
def generate_all_prior_trackers ( self ) : tracker = self . init_copy ( ) ignored_trackers = [ ] latest_message = tracker . latest_message for i , event in enumerate ( self . applied_events ( ) ) : if isinstance ( event , UserUttered ) : if tracker . active_form . get ( 'name' ) is None : latest_message = event elif isinstance ( event , Form ) : tracker . latest_message = latest_message elif isinstance ( event , ActionExecuted ) : if tracker . active_form . get ( 'name' ) is None : yield tracker elif tracker . active_form . get ( 'rejected' ) : for tr in ignored_trackers : yield tr ignored_trackers = [ ] if ( not tracker . active_form . get ( 'validate' ) or event . action_name != tracker . active_form . get ( 'name' ) ) : latest_message = tracker . latest_message else : tracker . latest_message = latest_message yield tracker elif event . action_name != tracker . active_form . get ( 'name' ) : tr = tracker . copy ( ) tr . latest_message = latest_message ignored_trackers . append ( tr ) if event . action_name == tracker . active_form . get ( 'name' ) : ignored_trackers = [ ] tracker . update ( event ) if tracker . active_form . get ( 'name' ) is None : yield tracker elif tracker . active_form . get ( 'rejected' ) : for tr in ignored_trackers : yield tr yield tracker
Returns a generator of the previous trackers of this tracker.
Returns a generator of the previous trackers of this tracker .
# type: () -> Generator[DialogueStateTracker, None, None] """Returns a generator of the previous trackers of this tracker.

        The resulting array is representing
        the trackers before each action.""" # store latest user message before the form # form got either activated or deactivated, so override # tracker's latest message # yields the intermediate state # persist latest user message # that was rejected by the form # form was called with validation, so # override tracker's latest message # it is not known whether the form will be # successfully executed, so store this tracker for later # form was called with validation, so # override tracker's latest message # the form was successfully executed, so # remove all stored trackers # yields the final state
self