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).
rasa.nlu.model
InvalidModelError Objects
Raised when a model failed to load.
Attributes:
message
- explanation of why the model is invalid
__init__
Initialize message attribute.
UnsupportedModelError Objects
Raised when a model is too old to be loaded.
Attributes:
message
- explanation of why the model is invalid
__init__
Initialize message attribute.
Metadata Objects
Captures all information about a model to load and prepare it.
load
Loads the metadata from a models directory.
Arguments:
model_dir
- the directory where the model is saved.
Returns:
Metadata
- A metadata object describing the model
__init__
Set metadata
attribute.
get
Proxy function to get property on metadata
attribute.
component_classes
Returns a list of component class names.
number_of_components
Returns count of components.
for_component
Returns the configuration of the component based on index.
language
Language of the underlying model
persist
Persists the metadata of a model to a given directory.
Trainer Objects
Trainer will load the data and train all components.
Requires a pipeline specification and configuration to use for the training.
train
Trains the underlying pipeline using the provided training data.
persist
Persist all components of the pipeline to the passed path.
Returns the directory of the persisted model.
Interpreter Objects
Use a trained pipeline of components to parse text messages.
load
Create an interpreter based on a persisted model.
Arguments:
skip_validation
- If set toTrue
, does not check that all required packages for the components are installed before loading them.model_dir
- The path of the model to loadcomponent_builder
- The :class:rasa.nlu.components.ComponentBuilder
to use.new_config
- Optional new config to use for the new epochs.finetuning_epoch_fraction
- Value to multiply all epochs by.
Returns:
An interpreter that uses the loaded model.
create
Create model and components defined by the provided metadata.
Arguments:
model_dir
- The directory containing the model.model_metadata
- The metadata describing each component.component_builder
- The :class:rasa.nlu.components.ComponentBuilder
to use.skip_validation
- If set toTrue
, does not check that all required packages for the components are installed before loading them.should_finetune
- Indicates if the model components will be fine-tuned.
Returns:
An interpreter that uses the created model.
parse
Parse the input text, classify it and return pipeline result.
The pipeline result usually contains intent and entities.
featurize_message
Tokenize and featurize the input message
Arguments:
message
- message storing text to process;
Returns:
message
- it contains the tokens and features which are the output of the NLU pipeline;
warn_of_overlapping_entities
Issues a warning when there are overlapping entity annotations.
This warning is only issued once per Interpreter life time.
Arguments:
message
- user message with all processing metadata such as entities