Dinesh Thakur
Dinesh Thakur

Reputation: 21

AttributeError: 'ChatBot' object has no attribute 'get_responce'

I am trying to make chatbot but it has some unexpected errors. please help me to solve it.

from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
import os

bot = ChatBot('bot',storage_adapter='chatterbot.storage.SQLStorageAdapter',
                      trainer='chatterbot.trainers.ListTrainer')

for files in os.listdir('C:/Users/HP/Downloads/Packages/chatterbot-corpus-master/chatterbot-corpus-master/chatterbot_corpus/data/english/') :

    data = open(r'C:/Users/HP/Downloads/Packages/chatterbot-corpus-master/chatterbot-corpus-master/chatterbot_corpus/data/english/'+files,).readlines()

    trainer = ListTrainer(bot)
    trainer.train(data)
    print("Training completed")

while True :

    message = input('You: ')

    if message.strip() != 'Bye':

        replay = bot.get_responce(message)

        print('ChatBot :',replay)

    if message.strip()=='bye':

        print('bye')

        break

THE OUTPUT ON CMD

E:\Tempo\Victoria>python victoria_train.py


[nltk_data] Downloading package averaged_perceptron_tagger to


[nltk_data]     C:\Users\HP\AppData\Roaming\nltk_data...


[nltk_data]   Package averaged_perceptron_tagger is already up-to-


[nltk_data]       date!


[nltk_data] Downloading package stopwords to


[nltk_data]     C:\Users\HP\AppData\Roaming\nltk_data...


[nltk_data]   Package stopwords is already up-to-date!


List Trainer: [####################] 100%
Training completed


List Trainer: [####################] 100%
Training completed


List Trainer: [####################] 100%
Training completed


List Trainer: [####################] 100%
Training completed


You: hi

Traceback (most recent call last): File "victoria_train.py", line 21, in replay = bot.get_responce(message) AttributeError: 'ChatBot' object has no attribute 'get_responce'

Upvotes: 2

Views: 1464

Answers (1)

Ricardo Sanchez
Ricardo Sanchez

Reputation: 730

You are using a non existing function (typo on responce). Instead use: get_response. Click here for chatterbot docs.

Upvotes: 2

Related Questions