Chatterbot: how to add Logic Adapter parameter (Django)

Created on 7 Jun 2017  路  5Comments  路  Source: gunthercox/ChatterBot

Hello,

I am trying to follow django integration tutorial with chatterbot.

How can I add SpecificResponseAdapter and lowconfiedance adapter parameters in django setting.py

CHATTERBOT = {
    'name': 'Django ChatterBot Example',
    'logic_adapters': [
        'chatterbot.logic.BestMatch',
        'chatterbot.logic.SpecificResponseAdapter', << how to add parameters
        'chatterbot.logic.LowConfidenceAdapter' << how to add parameters
    ],
question

Most helpful comment

@MYZ88 The solution suggested by @vkosuri is accurate. You just need to modify your Django settings to follow a the parameter pattern. For example, your Django settings might look like this:

CHATTERBOT = {
    'name': 'Django ChatterBot Example',
    'logic_adapters': [
        {
            'import_path': 'chatterbot.logic.BestMatch'
        },
        {
            'import_path': 'chatterbot.logic.LowConfidenceAdapter',
            'threshold': 0.90,
            'default_response': 'OhNo'
        }
    ],

All 5 comments

Hope this will help

chatterbot = ChatBot("chatterbot",
    'response_selection_method'': 'get_random_response',
    'storage_adapter': 'chatterbot.storage.MongoDatabaseAdapter',
    'logic_adapters' : [    
        {
            'import_path': 'chatterbot.logic.BestMatch'
        },
        {
            'import_path': 'chatterbot.logic.LowConfidenceAdapter',
            'threshold': 0.90,
            'default_response': 'OhNo'
        }
    ],
    'database':'Chat_Questions'
)

@MYZ88 The solution suggested by @vkosuri is accurate. You just need to modify your Django settings to follow a the parameter pattern. For example, your Django settings might look like this:

CHATTERBOT = {
    'name': 'Django ChatterBot Example',
    'logic_adapters': [
        {
            'import_path': 'chatterbot.logic.BestMatch'
        },
        {
            'import_path': 'chatterbot.logic.LowConfidenceAdapter',
            'threshold': 0.90,
            'default_response': 'OhNo'
        }
    ],

screenshot 2018-03-16 11 25 11

It gives me this error when I changed it to parameter pattern

Please show your code

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