Version: 2.0.x

rasa.shared.data

markdown_file_extension

markdown_file_extension() -> Text

Return Markdown file extension

yaml_file_extension

yaml_file_extension() -> Text

Return Markdown file extension

is_likely_yaml_file

is_likely_yaml_file(file_path: Text) -> bool

Check if a file likely contains yaml.

Arguments:

  • file_path - path to the file

Returns:

True if the file likely contains data in yaml format, False otherwise.

is_likely_json_file

is_likely_json_file(file_path: Text) -> bool

Check if a file likely contains json.

Arguments:

  • file_path - path to the file

Returns:

True if the file likely contains data in json format, False otherwise.

is_likely_markdown_file

is_likely_markdown_file(file_path: Text) -> bool

Check if a file likely contains markdown.

Arguments:

  • file_path - path to the file

Returns:

True if the file likely contains data in markdown format, False otherwise.

get_test_directory

get_test_directory(paths: Optional[Union[Text, List[Text]]]) -> Text

Recursively collects all Core training files from a list of paths.

Arguments:

  • paths - List of paths to training files or folders containing them.

Returns:

Path to temporary directory containing all found Core training files.

get_core_directory

get_core_directory(paths: Optional[Union[Text, List[Text]]]) -> Text

Recursively collects all Core training files from a list of paths.

Arguments:

  • paths - List of paths to training files or folders containing them.

Returns:

Path to temporary directory containing all found Core training files.

get_nlu_directory

get_nlu_directory(paths: Optional[Union[Text, List[Text]]]) -> Text

Recursively collects all NLU training files from a list of paths.

Arguments:

  • paths - List of paths to training files or folders containing them.

Returns:

Path to temporary directory containing all found NLU training files.

get_core_nlu_directories

get_core_nlu_directories(paths: Optional[Union[Text, List[Text]]]) -> Tuple[Text, Text]

Recursively collects all training files from a list of paths.

Arguments:

  • paths - List of paths to training files or folders containing them.

Returns:

Path to directory containing the Core files and path to directory containing the NLU training files.

get_data_files

get_data_files(paths: Optional[Union[Text, List[Text]]], filter_predicate: Callable[[Text], bool]) -> List[Text]

Recursively collects all training files from a list of paths.

Arguments:

  • paths - List of paths to training files or folders containing them.
  • filter_predicate - property to use when filtering the paths, e.g. is_nlu_file.

Returns:

Paths of training data files.

is_valid_filetype

is_valid_filetype(path: Union[Path, Text]) -> bool

Checks if given file has a supported extension.

Arguments:

  • path - Path to the source file.

Returns:

True is given file has supported extension, False otherwise.

is_nlu_file

is_nlu_file(file_path: Text) -> bool

Checks if a file is a Rasa compatible nlu file.

Arguments:

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

Returns:

True if it's a nlu file, otherwise False.

is_story_file

is_story_file(file_path: Text) -> bool

Checks if a file is a Rasa story file.

Arguments:

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

Returns:

True if it's a story file, otherwise False.

is_test_stories_file

is_test_stories_file(file_path: Text) -> bool

Checks if a file is a test stories file.

Arguments:

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

Returns:

True if it's a story file containing tests, otherwise False.

is_config_file

is_config_file(file_path: Text) -> bool

Checks whether the given file path is a Rasa config file.

Arguments:

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

Returns:

True if it's a Rasa config file, otherwise False.