Search code examples
pythonnlpchatbotchatterbot

what is the use of the bot's name in Python ChatterBot?


from chatterbot import ChatBot

# Create a new chat bot named Charlie
chatbot = ChatBot('Charlie')

what is the use of the bot's name "Charlie"? Can my chatbot know his name in a group chat, and only reply message about him?

-- "Hi, Charlie"
- bot: "Hi"
-- "Charlie, tell me the time"
- bot: "It's nine o'clock"
-- "how are you?"
- ...

I have read the doc but find nothing about it, say thanks advanced if you guys tell me how to approach it.


Solution

  • From what I have seen from their ChatBot.py, the constructor requires "name" as the only parameter.

    I am unable to find anything in the documentation that addresses it and I can neither test it as of now, but based on [1], it appears that upon generating an answer, it is used to define the "persona" parameter for the Statement constructor. Upon looking into the Stament [2] constructor, it seems that the "persona" parameter might be a string identifying who generated the statement.


    [1]https://github.com/gunthercox/ChatterBot/blob/4ff8af28567ed446ae796d37c246bb6a14032fe7/chatterbot/chatterbot.py#L203

    [2] https://github.com/gunthercox/ChatterBot/blob/4ff8af28567ed446ae796d37c246bb6a14032fe7/chatterbot/conversation.py#L64