简体   繁体   English

当问题字符串反转时,Chatter bot返回错误响应

[英]Chatter bot returns wrong response when question string reversed

yaml file: yaml文件:

- - 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. 我正在使用python Chatterbot库,如果我询问无效密码,它将返回响应联系人xyz@gmail.com,但是如果我询问密码无效,它将为我提供创建聊天机器人实例时设置的默认响应。

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)

The thing is Chatterbot stores unstructured and untrained data into SQLite DB. 问题是Chatterbot将非结构化和未经训练的数据存储到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. 如果输入反向字符串,但响应未存储在YAML文件中,它将无法理解,因此将获取一些随机响应。 You need to train such data (increase the frequency). 您需要训练此类数据(增加频率)。 Also as per my understanding, Jaccard Similarity won't help in this case. 另外,据我了解,在这种情况下,Jaccard相似性将无济于事。

if you only insert password and no other password word stored in YAML then I think it will give the correct reply. 如果您只插入密码,而YAML中没有存储其他密码词,那么我认为它将给出正确的答复。 Chatterbot itself created with NLP and but you need to change the code of Logic adapter as per your requirement. Chatterbot本身是使用NLP创建的,但是您需要根据需要更改Logic适配器的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM