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.nlu.classifiers.fallback_classifier

FallbackClassifierGraphComponent Objects

class FallbackClassifierGraphComponent(GraphComponent, IntentClassifier2)

Handles incoming messages with low NLU confidence.

required_components

@classmethod
def required_components(cls) -> List[Type]

Components that should be included in the pipeline before this component.

get_default_config

@staticmethod
def get_default_config() -> Dict[Text, Any]

The component's default config (see parent class for full docstring).

__init__

def __init__(config: Dict[Text, Any]) -> None

Constructs a new fallback classifier.

create

@classmethod
def create(cls, config: Dict[Text, Any], model_storage: ModelStorage, resource: Resource, execution_context: ExecutionContext) -> FallbackClassifierGraphComponent

Creates a new component (see parent class for full docstring).

process

def process(messages: List[Message]) -> List[Message]

Process a list of incoming messages.

This is the component's chance to process incoming messages. The component can rely on any context attribute to be present, that gets created by a call to :meth:rasa.nlu.components.Component.create of ANY component and on any context attributes created by a call to :meth:rasa.nlu.components.Component.process of components previous to this one.

Arguments:

  • messages - List containing :class: rasa.shared.nlu.training_data.message.Message to process.

is_fallback_classifier_prediction

def is_fallback_classifier_prediction(prediction: Dict[Text, Any]) -> bool

Checks if the intent was predicted by the FallbackClassifier.

Arguments:

  • prediction - The prediction of the NLU model.

Returns:

True if the top classified intent was the fallback intent.

undo_fallback_prediction

def undo_fallback_prediction(prediction: Dict[Text, Any]) -> Dict[Text, Any]

Undo the prediction of the fallback intent.

Arguments:

  • prediction - The prediction of the NLU model.

Returns:

The prediction as if the FallbackClassifier wasn't present in the pipeline. If the fallback intent is the only intent, return the prediction as it was provided.