question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi there, previously I faced a problem of updating the ChatterBot answers when its could not find the right one for a given question, my chatterbot was trained using data from the ChatterBot dialog corpus .

Then I decide to create a chatterbot database from scratch by creating empty database and inserting the question and the the answer one by one using the example “learning_new_response.py”.

the application works like this: type something to begin … me: hi chatterbot: Is “hi” a coherent response to “hi”? me: no chatterbot: please input the correct one me: Hello Dear! chatterbot: Responses added to bot! … and so on until I enter, let say 5 questions and answers. Then if I choose a pre-definde question it will choose a wrong answer. for example if I write “hi” the chatterbot will respond : Is “I am good thank you.” a coherent response to “hi”? I wondering what is going wrong here! ?

by the way, if I open the created database I can find all the questions with the right answers but I don’t know why it chooses a different answer even when I use the BestMatch as logic adapter.

bellow is my code that has been used:

from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
bot = ChatBot(
    "Terminal",
    storage_adapter="chatterbot.storage.SQLStorageAdapter",
    trainer = "chatterbot.trainers.ChatterBotCorpusTrainer",
        logic_adapters=[
        {
            "import_path": "chatterbot.logic.BestMatch",
            "statement_comparison_function": "chatterbot.comparisons.levenshtein_distance",
            "response_selection_method": "chatterbot.response_selection.get_most_frequent_response"
        }
    ]
)

def get_feedback():
    text = input()
    if 'yes' in text.lower():
        return False
    elif 'no' in text.lower():
        return True
    else:
        print('Please type either "Yes" or "No"')
        return get_feedback()
print("Type something to begin...")

while True:
    try:
        request=input()
        input_statement = bot.input.process_input(request)
        temp1,response = bot.generate_response(
            input_statement,1
        )
        bot.output.process_response(response)
        print('\n Is "{}" a coherent response to "{}"? \n'.format(response, input_statement))
        if get_feedback():
            print("please input the correct one")
            request1=input()
            response1 = bot.input.process_input(request1)
            bot.learn_response(response1, input_statement)
            print("Responses added to bot!")
    except (KeyboardInterrupt, EOFError, SystemExit):
        break

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Aljumaili85commented, Feb 12, 2019

It a problem of incompatibility of the given code and the installed ChatterBot version. try to install the latest ChatterBot and try again. meanwhile i will try to see whats wrong

0reactions
Dulce06commented, Feb 12, 2019

Hi @Aljumaili85

Thanks for the prompt response.

Upgraded the chatterbot version. I have the following errors now:

DEFAULT_SESSION_ID = bot.default_session.id AttributeError: ‘ChatBot’ object has no attribute ‘default_session’

Cannot find reference ‘input_function’ in ‘utils.py’ less… (Ctrl+F1) Inspection info: This inspection detects names that should resolve but don’t. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Check & update your Android version - Google Support
Find your "Android version," "Android security update," and "Build number." Get the latest Android updates available for you. When you get a notification,...
Read more >
Amazon Alexa's new 'Answer Update' feature will notify you ...
Amazon confirmed it's rolling out a new feature called “Answer Update” to Alexa device users over the next week, which will notify users ......
Read more >
Subscribe to our newsletters - Answers in Genesis
AiG–Australia UpdatesStore specials, new resources, event notifications, and ministry news from AiG–Australia. ... Store specials, new resources, event ...
Read more >
Windows Update: FAQ - Microsoft Support
Learn how to get the latest Windows updates. Find answers to FAQ about updating Windows to keep your PC up to date.
Read more >
IRS updates answers to states and local governments on ...
IRS updates answers to states and local governments on taxability and reporting of payments from Coronavirus State and Local Fiscal Recovery ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found