Click here to Skip to main content
15,893,588 members

Comments by Socks92 (Top 3 by date)

Socks92 20-Jul-21 12:02pm View    
yeah thats exactly what ive just done! thank you for the help
Socks92 20-Jul-21 11:53am View    
Thank you for the prompt reply. I know that i need to code an if statement - im guessing in the response function. I'm just not entirely sure on how to access the 'probability' value inside of the ints variable:

{'intent': 'greeting', 'probability': '0.99985576'}

EDIT: no worries i figured it out :)
Socks92 20-Jul-21 11:20am View    
Hi Richard, apologies. Right so im testing it all at the moment, i have a chat function (can be seen below)


Copy Code
def chat(msg):     ints = prediction(msg)        print(ints[0])    // this here is what is being printed below    res = response(ints, intents)    return reschat("sd")



here when typing "sd" into the function which is NOT in the JSON responses its giving me the following output:

Copy Code
{'intent': 'greeting', 'probability': '0.91055113'}



when I input a word that IS within the responses e.g "hello" it gives me this output:

Copy Code
{'intent': 'greeting', 'probability': '0.99985576'}


so here we can see the probability is higher when typing a response within my JSON file.

What i need to do is basically say if the 'probability' is less than 0.91' then send a message back to the user saying "Sorry i don't understand what you mean, please ask me something else" however if the probability is higher than 0.91 then the chatbot can respond from the intents provided.


I'm just really unsure about how i would implement it