Example #1
0
def extract_story_graph(
        resource_name,  # type: Text
        domain,  # type: Domain
        interpreter=RegexInterpreter()  # type: NaturalLanguageInterpreter
):
    # type: (...) -> StoryGraph

    story_steps = StoryFileReader.read_from_folder(resource_name,
                                                   domain, interpreter)
    return StoryGraph(story_steps)
Example #2
0
def extract_story_graph(
    resource_name,  # type: Text
    domain,  # type: Domain
    interpreter=None  # type: Optional[NaturalLanguageInterpreter]
):
    # type: (...) -> StoryGraph
    from rasa_core.interpreter import RegexInterpreter
    from rasa_core.training.dsl import StoryFileReader
    from rasa_core.training.structures import StoryGraph

    if not interpreter:
        interpreter = RegexInterpreter()
    story_steps = StoryFileReader.read_from_folder(resource_name, domain,
                                                   interpreter)
    return StoryGraph(story_steps)
Example #3
0
def extract_story_graph(
        resource_name,  # type: Text
        domain,  # type: Domain
        interpreter=None  # type: Optional[NaturalLanguageInterpreter]
):
    # type: (...) -> StoryGraph
    from rasa_core.interpreter import RegexInterpreter
    from rasa_core.training.dsl import StoryFileReader
    from rasa_core.training.structures import StoryGraph

    if not interpreter:
        interpreter = RegexInterpreter()
    story_steps = StoryFileReader.read_from_folder(resource_name,
                                                   domain, interpreter)
    return StoryGraph(story_steps)
Example #4
0
    def visualize(self,
                  resource_name,  # type: Text
                  output_file,  # type: Text
                  max_history,  # type: int
                  nlu_training_data=None,  # type: Optional[Text]
                  should_merge_nodes=True,  # type: bool
                  fontsize=12  # type: int
                  ):
        # type: (...) -> None
        from rasa_core.training.visualization import visualize_stories
        from rasa_core.training.dsl import StoryFileReader
        """Visualize the loaded training data from the resource."""

        story_steps = StoryFileReader.read_from_folder(resource_name,
                                                       self.domain)
        visualize_stories(story_steps, self.domain, output_file, max_history,
                          self.interpreter, nlu_training_data,
                          should_merge_nodes, fontsize)
Example #5
0
    def visualize(self,
                  resource_name,  # type: Text
                  output_file,  # type: Text
                  max_history,  # type: int
                  nlu_training_data=None,  # type: Optional[Text]
                  should_merge_nodes=True,  # type: bool
                  fontsize=12  # type: int
                  ):
        # type: (...) -> None
        from rasa_core.training.visualization import visualize_stories
        from rasa_core.training.dsl import StoryFileReader
        """Visualize the loaded training data from the resource."""

        story_steps = StoryFileReader.read_from_folder(resource_name,
                                                       self.domain)
        visualize_stories(story_steps, self.domain, output_file, max_history,
                          self.interpreter, nlu_training_data,
                          should_merge_nodes, fontsize)
Example #6
0
def extract_story_graph(
    resource_name: Text,
    domain: 'Domain',
    interpreter: Optional['NaturalLanguageInterpreter'] = None,
    use_e2e: bool = False,
    exclusion_percentage: int = None
) -> 'StoryGraph':
    from rasa_core.interpreter import RegexInterpreter
    from rasa_core.training.dsl import StoryFileReader
    from rasa_core.training.structures import StoryGraph

    if not interpreter:
        interpreter = RegexInterpreter()
    story_steps = StoryFileReader.read_from_folder(
        resource_name,
        domain, interpreter,
        use_e2e=use_e2e,
        exclusion_percentage=exclusion_percentage)
    return StoryGraph(story_steps)
Example #7
0
    def visualize(self,
                  resource_name: Text,
                  output_file: Text,
                  max_history: Optional[int] = None,
                  nlu_training_data: Optional[Text] = None,
                  should_merge_nodes: bool = True,
                  fontsize: int = 12) -> None:
        from rasa_core.training.visualization import visualize_stories
        from rasa_core.training.dsl import StoryFileReader
        """Visualize the loaded training data from the resource."""

        # if the user doesn't provide a max history, we will use the
        # largest value from any policy
        max_history = max_history or self._max_history()

        story_steps = StoryFileReader.read_from_folder(resource_name,
                                                       self.domain)
        visualize_stories(story_steps, self.domain, output_file, max_history,
                          self.interpreter, nlu_training_data,
                          should_merge_nodes, fontsize)
Example #8
0
def extract_story_graph(
        resource_name,  # type: Text
        domain,  # type: Domain
        interpreter=None,  # type: Optional[NaturalLanguageInterpreter]
        use_e2e=False,  # type: bool
        exclusion_percentage=None  # type: int
):
    # type: (...) -> StoryGraph
    from rasa_core.interpreter import RegexInterpreter
    from rasa_core.training.dsl import StoryFileReader
    from rasa_core.training.structures import StoryGraph

    if not interpreter:
        interpreter = RegexInterpreter()
    story_steps = StoryFileReader.read_from_folder(
        resource_name,
        domain,
        interpreter,
        use_e2e=use_e2e,
        exclusion_percentage=exclusion_percentage)
    return StoryGraph(story_steps)
Example #9
0
def get_no_of_stories(stories, domain):
    """Get number of stories in a file."""

    no_stories = len(
        StoryFileReader.read_from_folder(stories, TemplateDomain.load(domain)))
    return no_stories