gunthercox / ChatterBot

ChatterBot is a machine learning, conversational dialog engine for creating chat bots
https://chatterbot.readthedocs.io
BSD 3-Clause "New" or "Revised" License
14.11k stars 4.44k forks source link

Trouble in LowConfidenceAdapter #1644

Open CelliusCtba opened 5 years ago

CelliusCtba commented 5 years ago

from chatterbot import ChatBot

chatbot = ChatBot( "Search in lists",

storage_adapter='chatterbot.storage.MongoDatabaseAdapter',
database_url='mongodb://localhost:27017/',
database='chatterbot_Searchinlists',
input_adapter="chatterbot.input.TerminalAdapter",
output_adapter="chatterbot.output.OutputAdapter",
    output_format="text",

logic_adapters=[
    {
        "import_path": "chatterbot.logic.BestMatch",
        "statement_comparison_function": "chatterbot.comparisons.levenshtein_distance",
        "response_selection_method": "chatterbot.response_selection.get_most_frequent_response"
    },
    {
        'import_path': 'chatterbot.logic.LowConfidenceAdapter',
        'threshold': 0.51,
        'default_response': 'Sorry did not understand. Can be more specific?.'
    },
    {
        'import_path': 'chatterbot.logic.SpecificResponseAdapter',
        'input_text': 'I have a question about an issue',
        'output_text': 'Reply with quote: https://answers.squarespace.com/questions/index.html/'
    },
],

preprocessors=[
    'chatterbot.preprocessors.clean_whitespace'
],

read_only=True,

) DEFAULT_SESSION_ID = chatbot.default_session.id

from chatterbot.trainers import ChatterBotCorpusTrainer

chatbot.set_trainer(ChatterBotCorpusTrainer) chatbot.train("./searchinlists_EN.yml")

while True: input_statement = chatbot.input.process_input_statement() statement, response = chatbot.generate_response(input_statement, DEFAULT_SESSION_ID) print("\n%s\n\n" % response)


Result

AttributeError: module 'chatterbot.logic' has no attribute 'LowConfidenceAdapter'


This is the error it presents. Can anyone analyze and give a hint where the code is wrong? Thank you very much

gunthercox commented 5 years ago

The LowConfidenceAdapter was removed from ChatterBot. Take a look at how the default_response and maximum_similarity_threshold are used in this example as an alternative:

https://github.com/gunthercox/ChatterBot/blob/master/examples/default_response_example.py

CelliusCtba commented 5 years ago

Thanks for the answer, I will have to study this better to be able to correct it, it changes a lot from version to version and I get lost in the library. Exploring a little more, it is possible to put on a server, type heroku, I did but it does not elevate the chatterbot, can put in a site and run to collect the learning? If you have any material that can achieve the goal, thank you immensely!

Augus2411 commented 5 years ago

@gunthercox is there a way for the logic adapters can give responce even though the users input right key words in a random way. below is oneof the statement for my data training

can logic adapters still give the - $ 4, 588.00 answer? please help

gunthercox commented 5 years ago

@Augus2411 Nope, I don't think there is a way to do that.

Augus2411 commented 5 years ago

can you please explain to me how low confidence adapter works. in a more simplified way

On Sat, Mar 23, 2019 at 10:21 PM Gunther Cox notifications@github.com wrote:

@Augus2411 https://github.com/Augus2411 Nope, I don't think there is a way to do that.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gunthercox/ChatterBot/issues/1644#issuecomment-475873763, or mute the thread https://github.com/notifications/unsubscribe-auth/AtwOS0Zg6CVkNAp79SRWKUPRt-lRsJUtks5vZjhugaJpZM4bUtWi .