pytorch-chatbot icon indicating copy to clipboard operation
pytorch-chatbot copied to clipboard

Functions for each intent tag

Open Rohith-JN opened this issue 2 years ago • 0 comments

How do I execute a function for a specific tag? for example if the tag is 'goodbye' I want the chatbot to stop the program using sys.exit(0)

I tried this:

if prob.item() > 0.75:
    for intent in intents['intents']:
        if tag == intent["tag"]:
            speak(f"{random.choice(intent['responses'])}")

        if tag == "goodbye":
            speak(f"{random.choice(intent['responses'])}")
            sys.exit(0)

But the chatbot does not respond with a response from that specific tag

Rohith-JN avatar Mar 07 '22 07:03 Rohith-JN