1. सीखें
  2. /
  3. पाठ्यक्रम
  4. /
  5. Building Chatbots in Python

Connected

अभ्यास

Intent classification with regex II

With your patterns dictionary created, it's now time to define a function to find the intent of a message.

निर्देश

100 XP
  • Iterate over the intents and patterns in the patterns dictionary using its .items() method.
  • Use the .search() method of pattern to look for keywords in the message.
  • If there is a match, return the corresponding intent.
  • Call your match_intent() function inside respond() with message as the argument and then hit 'Submit Answer' to see how the bot responds to the provided messages.