notice

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

Version: Master/Unreleased

rasa.nlu.utils

relative_normpath

relative_normpath(f: Optional[Text], path: Text) -> Optional[Path]

Return the path of file relative to path.

module_path_from_object

module_path_from_object(o: Any) -> Text

Returns the fully qualified class path of the instantiated object.

write_json_to_file

write_json_to_file(filename: Text, obj: Any, **kwargs: Any) -> None

Write an object as a json string to a file.

write_to_file

write_to_file(filename: Text, text: Any) -> None

Write a text to a file.

is_model_dir

is_model_dir(model_dir: Text) -> bool

Checks if the given directory contains a model and can be safely removed.

specifically checks if the directory has no subdirectories and if all files have an appropriate ending.

is_url

is_url(resource_name: Text) -> bool

Check whether the url specified is a well formed one.

Arguments:

  • resource_name - Remote URL to validate

Returns:

True if valid, otherwise False.

remove_model

remove_model(model_dir: Text) -> bool

Removes a model directory and all its content.