Normalization#

Normalization module is used to normalize all python objects and functions to a format that is suitable for script and actor execution process. This module contains a basic set of functions for normalizing data in a dialog script.

normalize_label(label, default_flow_label='')[source]#

The function that is used for normalization of default_flow_label.

Parameters:
  • label (Union[Callable, Tuple[str, float], Tuple[str, str], Tuple[str, str, float], str]) – If label is Callable the function is wrapped into try/except and normalization is used on the result of the function call with the name label.

  • default_flow_label (Union[str, Keywords]) – flow_label is used if label does not contain flow_label.

Return type:

Union[Callable[[Context, Pipeline], Tuple[str, str, float]], Tuple[str, str, float]]

Returns:

Result of the label normalization, if Callable is returned, the normalized result is returned.

normalize_condition(condition)[source]#

The function that is used to normalize condition

Parameters:

condition (Callable) – Condition to normalize.

Return type:

Callable[[Context, Pipeline], bool]

Returns:

The function condition wrapped into the try/except.

normalize_response(response)[source]#

This function is used to normalize response. If the response is a Callable, it is returned, otherwise the response is wrapped in an asynchronous function and this function is returned.

Parameters:

response (Union[Message, Callable[[Context, Pipeline], Message], None]) – Response to normalize.

Return type:

Callable[[Context, Pipeline], Message]

Returns:

Function that returns callable response.