nlu.rule_based_nlu

NLU (Natural Language Understander) is a main component of Dialogue Systems.

NLU understands the user requirements and intents for the system to generate an appropriate response.

Module Contents

Classes

RuleBasedNLU

Helper class that provides a standard way to create an ABC using

class nlu.rule_based_nlu.RuleBasedNLU(config: Dict[str, Any])

Bases: moviebot.nlu.nlu.NLU

Helper class that provides a standard way to create an ABC using inheritance.

generate_dacts(user_utterance: moviebot.core.utterance.utterance.UserUtterance, options: moviebot.core.core_types.DialogueOptions, dialogue_state: moviebot.dialogue_manager.dialogue_state.DialogueState) List[moviebot.dialogue_manager.dialogue_act.DialogueAct]

Processes the utterance according to dialogue state and generates a user dialogue act for Agent to understand.

Parameters:
  • user_utterance – UserUtterance class containing user input.

  • options – A list of options provided to the user to choose from.

  • dialogue_state – The current dialogue state, if available. Defaults to None.

Returns:

A list of dialogue acts.

get_selected_option(user_utterance: moviebot.core.utterance.utterance.UserUtterance, options: moviebot.core.core_types.DialogueOptions, item_in_focus: Dict[str, Any] | None) List[moviebot.dialogue_manager.dialogue_act.DialogueAct]

Checks if user selected any of the suggested options.

Parameters:
  • user_utterance – User utterance.

  • options – Options given to the user.

  • item_in_focus – Item recommended to user on previous turn.

Returns:

A list with at most one item (i.e., the selected option).