Utility Methods

ChatterBot has a utility module that contains a collection of miscellaneous but useful functions.

Module imports

chatterbot.utils.import_module(dotted_path)[source]

Imports the specified module based on the dot notated import path for the module.

Class initialization

chatterbot.utils.initialize_class(data, *args, **kwargs)[source]
Parameters:

data – A string or dictionary containing a import_path attribute.

ChatBot response time

chatterbot.utils.get_response_time(chatbot, statement='Hello')[source]

Returns the amount of time taken for a given chat bot to return a response.

Parameters:

chatbot (ChatBot) – A chat bot instance.

Returns:

The response time in seconds.

Return type:

float

Parsing datetime information

chatterbot.parsing.datetime_parsing(text, base_date=datetime.datetime(2025, 2, 19, 0, 11, 46, 533184))[source]

Extract datetime objects from a string of text.