def export_stories(self, e2e=False) -> Text: """Dump the tracker as a story in the Rasa Core story format. Returns the dumped tracker as a string.""" from rasa_core.training.structures import Story story = Story.from_events(self.applied_events(), self.sender_id) return story.as_story_string(flat=True, e2e=e2e)
def export_stories(self): # type: () -> Text """Dump the tracker as a story in the Rasa Core story format. Returns the dumped tracker as a string.""" from rasa_core.training.structures import Story story = Story.from_events(self.applied_events()) return story.as_story_string(flat=True)
def _write_stories_to_file(export_story_path, evts): # type: (Text, List[Dict[Text, Any]]) -> None """Write the conversation of the sender_id to the file paths.""" sub_conversations = _split_conversation_at_restarts(evts) with io.open(export_story_path, 'a', encoding="utf-8") as f: for conversation in sub_conversations: parsed_events = events.deserialise_events(conversation) s = Story.from_events(parsed_events) f.write(s.as_story_string(flat=True) + "\n")
def _write_stories_to_file(export_file_path, sender_id, endpoint): # type: (Text, Text, EndpointConfig) -> None """Write the conversation of the sender_id to the file path.""" tracker = retrieve_tracker(endpoint, sender_id) evts = tracker.get("events", []) sub_conversations = _split_conversation_at_restarts(evts) with io.open(export_file_path, 'a') as f: for conversation in sub_conversations: parsed_events = events.deserialise_events(conversation) s = Story.from_events(parsed_events) f.write(s.as_story_string(flat=True) + "\n")
def _export_stories(tracker): # export current stories and quit file_prompt = ("File to export to (if file exists, this " "will append the stories) " "[{}]: ").format(DEFAULT_FILE_EXPORT_PATH) export_file_path = utils.request_input(prompt=file_prompt) if not export_file_path: export_file_path = DEFAULT_FILE_EXPORT_PATH parsed_events = events.deserialise_events(tracker.get("events", [])) s = Story.from_events(parsed_events) with io.open(export_file_path, 'a') as f: f.write(s.as_story_string(flat=True) + "\n")