2

I'm getting an 'unrecognizedInputFormatException' while creating a Python Chatterbot instance. I'm using code based on the examples posted here. Here is the code:

from chatterbot import ChatBot


def main():
    from chatterbot.training.trainers import ChatterBotCorpusTrainer
    # create a new instance of a chatbot
    bot = ChatBot("proactive_response1",
              storage_adapter="chatterbot.adapters.storage.JsonDatabaseAdapter",
              logic_adapters=["chatterbot.adapters.logic.ClosestMatchAdapter"],
              input_adapter="chatterbot.adapters.input.VariableInputTypeAdapter",
              output_adapter="chatterbot.adapters.output.OutputFormatAdapter",
              output_format='text',
              database="../database.db"
              )

# set up machine learning training
    bot.set_trainer(ChatterBotCorpusTrainer)
    bot.train("chatterbot.corpus.english.proactive_corpus.proactive_response1")

print('Welcome , I\'m theProActive Response Bot, how are you today?')

while True:
    try:
        bot_input = bot.get_response(None)
        print(bot_input)

    # Press ctrl-c or ctrl-d on the keyboard to exit
    except (KeyboardInterrupt, EOFError, SystemExit):
        break


main()

And here is the stacktrace:

    Traceback (most recent call last):
    Welcome , I'm theProActive Response Bot, how are you today?
 File "C:/Users/brohj_000/PycharmProjects/chatterbot/chatbot        /__init__.py", line 32, in <module>
    main()
 File "C:/Users/brohj_000/PycharmProjects/chatterbot/chatbot/__init__.py",   line 24, in main
   bot_input = bot.get_response(None)
File "C:\Users\brohj_000\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chatterbot\chatterbot.py", line 133, in get_response
input_statement = self.input.process_input(input_item)
File "C:\Users\brohj_000\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chatterbot\adapters\input\variable_input_type_adapter.py", line 39, in process_input
input_type = self.detect_type(statement)
File "C:\Users\brohj_000\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chatterbot\adapters\input\variable_input_type_adapter.py", line 34, in detect_type
input_type
Chatterbot.adapters.input.variable_input_type_adapter.UnrecognizedInputFormatException: "The type <class 'NoneType'> is not recognized as a valid input type."

Process finished with exit code 1

Raja Simon
  • 10,126
  • 5
  • 43
  • 74
brohjoe
  • 854
  • 4
  • 17
  • 39

1 Answers1

0

I believe that you can try replacing

bot.get_response(None)

with

bot.get_response(user_input)

The "user_input" variable can be defined earlier

Vishnu Joshi
  • 333
  • 1
  • 9