notice

This is unreleased documentation for Rasa Open Source Documentation Master/Unreleased version.
For the latest released documentation, see the latest version (2.x).

Version: Master/Unreleased

rasa.shared.data

yaml_file_extension

def yaml_file_extension() -> Text

Return YAML file extension.

is_likely_yaml_file

def is_likely_yaml_file(file_path: Union[Text, Path]) -> 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

def 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.

get_core_directory

def 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

def 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_data_files

def 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

def 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

def 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_config_file

def 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.