Utility Methods

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

Module imports


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(2021, 6, 1, 10, 48, 26, 711542))[source]

Extract datetime objects from a string of text.