Chatterbot: Initializing chatbot with a different database name for JsonFileStorage

Created on 28 Mar 2017  路  5Comments  路  Source: gunthercox/ChatterBot

Hi,

I would like to initialize a chatbot with a different db name.. Is it possible to do it?

I can do it for the JsonFileStorageAdapter class by

j1 = JsonFileStorageAdapter(database = "sampledb.db")

However, I am not sure how to create a chatbot that references a db other than database.db

Most helpful comment

Did you tried like this

# -*- coding: utf-8 -*-

from chatterbot import ChatBot
# Create a new instance of a ChatBot
bot = ChatBot(
    'Exact Response Example Bot',
    storage_adapter='chatterbot.storage.JsonFileStorageAdapter',
    database='myJson.db',    
)

# Get a response given the specific input
response = bot.get_response('Help me!')
print(response)

All 5 comments

As of now I am doing the following.. please let me know if this is correct:

c1 = ChatBot("wisebot", storage_adapter = "chatterbot.storage.JsonFileAdapter")
c1.storage.__init__(database = "sampledb.db")

I can see a separate db called sampledb being created if this is being done...But im not sure if this is the apt way to do it :)

Did you tried like this

# -*- coding: utf-8 -*-

from chatterbot import ChatBot
# Create a new instance of a ChatBot
bot = ChatBot(
    'Exact Response Example Bot',
    storage_adapter='chatterbot.storage.JsonFileStorageAdapter',
    database='myJson.db',    
)

# Get a response given the specific input
response = bot.get_response('Help me!')
print(response)

Yes. It works... silly me.

Thanks.

Response while using the storage adapter is too slow
What can be done in order to get a swift response?

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hemangsk picture hemangsk  路  4Comments

atulanandnitt picture atulanandnitt  路  3Comments

juanpialbano picture juanpialbano  路  4Comments

AmusingThrone picture AmusingThrone  路  3Comments

AfrahAsif picture AfrahAsif  路  3Comments