1

yaml file:

- - Invalid Password
  - contact xyz@gmail.com

I am using python Chatterbot library, if I ask Invalid Password it returns the response contact xyz@gmail.com, but if I ask Password Invalid it gives me the default response which I have set while creating the chat bot instance.

bot = ChatBot(
    'Norman',
    storage_adapter='chatterbot.storage.SQLStorageAdapter',
    input_adapter='chatterbot.input.TerminalAdapter',
    output_adapter='chatterbot.output.TerminalAdapter',
    logic_adapters=[
        {
            'import_path': 'my_logic_adapter.MyLogicAdapter',
            "statement_comparison_function": "chatterbot.comparisons.JaccardSimilarity",
            "response_selection_method": "chatterbot.response_selection.get_random_response",
            'threshold': 0.65,
            'default_response': 'I am sorry, but I do not understand.'
        }
    ],
    filters=["chatterbot.filters.RepetitiveResponseFilter"],
    preprocessors=[
        'chatterbot.preprocessors.clean_whitespace',
        'chatterbot.preprocessors.unescape_html',
        'chatterbot.preprocessors.convert_to_ascii'
    ],
    database='./database.sqlite3',
    trainer='chatterbot.trainers.ListTrainer'
)
bot.set_trainer(ListTrainer)
Yamini
  • 129
  • 1
  • 10

1 Answers1

0

The thing is Chatterbot stores unstructured and untrained data into SQLite DB. If you enter a reverse string and the response is not stored in the YAML file, it will not be able to understand, hence it will fetch some random response. You need to train such data (increase the frequency). Also as per my understanding, Jaccard Similarity won't help in this case.

if you only insert password and no other password word stored in YAML then I think it will give the correct reply. Chatterbot itself created with NLP and but you need to change the code of Logic adapter as per your requirement.

Naitik Chandak
  • 110
  • 1
  • 3
  • 14
  • I have set the threshold as 65% of string match and in the reverse string case it is 100% match why do I need to train the bot with reversed question? what is the point of use NLP then? why jaccardSimilarty won't help? – Yamini Apr 10 '19 at 12:57
  • the ratio calculated by string matching is not 0.65, Its 0.50 as per my program. Though the threshold set high is the main reason you are not getting an accurate result – Naitik Chandak Apr 10 '19 at 13:03