notice

This is documentation for Rasa Documentation v2.x, which is no longer actively maintained.
For up-to-date documentation, see the latest version (3.x).

Version: 2.x

rasa.shared.core.training_data.story_reader.yaml_story_reader

YAMLStoryReader Objects

class YAMLStoryReader(StoryReader)

Class that reads Core training data and rule data in YAML format.

from_reader

| @classmethod
| from_reader(cls, reader: "YAMLStoryReader") -> "YAMLStoryReader"

Create a reader from another reader.

Arguments:

  • reader - Another reader.

Returns:

A new reader instance.

read_from_file

| read_from_file(filename: Union[Text, Path], skip_validation: bool = False) -> List[StoryStep]

Read stories or rules from file.

Arguments:

  • filename - Path to the story/rule file.
  • skip_validation - True if the file was already validated e.g. when it was stored in the database.

Returns:

StorySteps read from filename.

read_from_string

| read_from_string(string: Text, skip_validation: bool = False) -> List[StoryStep]

Read stories or rules from a string.

Arguments:

  • string - Unprocessed YAML file content.
  • skip_validation - True if the string was already validated e.g. when it was stored in the database.

Returns:

StorySteps read from string.

read_from_parsed_yaml

| read_from_parsed_yaml(parsed_content: Dict[Text, Union[Dict, List]]) -> List[StoryStep]

Read stories from parsed YAML.

Arguments:

  • parsed_content - The parsed YAML as a dictionary.

Returns:

The parsed stories or rules.

is_stories_file

| @classmethod
| is_stories_file(cls, file_path: Union[Text, Path]) -> bool

Check if file contains Core training data or rule data in YAML format.

Arguments:

  • file_path - Path of the file to check.

Returns:

True in case the file is a Core YAML training data or rule data file, False otherwise.

Raises:

  • YamlException - if the file seems to be a YAML file (extension) but can not be read / parsed.

is_test_stories_file

| @classmethod
| is_test_stories_file(cls, file_path: Union[Text, Path]) -> bool

Checks if a file is a test conversations file.

Arguments:

  • file_path - Path of the file which should be checked.

Returns:

True if it's a conversation test file, otherwise False.

StoryParser Objects

class StoryParser(YAMLStoryReader)

Encapsulate story-specific parser behavior.

RuleParser Objects

class RuleParser(YAMLStoryReader)

Encapsulate rule-specific parser behavior.