Keyword Detection For Multiple Targets V2

Detects one of the topics using the keywords supplied per topic (key). V2 now supplies regex, case sensitive search, accents normalisation, sequences match with conditions, special characters removed.

This action is used to detect keywords from an input text. This can be used in the flow both to detect intents with keywords or filter out messages with stopwords.
You can detect multiple topics with a set of RegEx.

{
      "topic1": "group1, group2, group3",
      "topic2": "group4, group5, group6"
}

List of supported operators:

  • , the comma separates groups of words to match: Group1, group2, group3, group4. If any of them match, the action will return True.
  • OR to use inside a group with brackets. Instead of writing: “I want to buy, I want to acquire, I want to purchase” You can write: “I want to (buy OR acquire OR purchase)”. This will match "I want to purchase a headphone" and "I want to buy new shoes"
  • AND to use inside a group. “Cancel AND refund” will match “I want to cancel my order, please refund”
  • REGEX you can use any regex

❗️

  • DON'T FORGET THE SPACE AFTER THE COMMA, otherwise it will be taken as a regex group
  • if you need to use escaped characters for regex, double escape it, ie: [\\w\\s]+

Examples

{
      "charging issue": "charge[d]? AND battery, my (battery OR charger) is (dead OR not working)"
}
{
      "found": "charging issue",
      "topic_found": true,
      "matches_detail": {
            "charging issue": true
       }
}

group1 charge[d]? AND battery:

  • ✅ will match: I charged my device but the battery is dead
  • ✅ will match: Even if I put it on charge, the battery is not charging
  • ❌ will not match: I charged it but its not working

group2 my (battery OR charger) is (dead OR not working):

  • ✅ will match: I think my battery is dead
  • ✅ will match: my charger is not working and I want a refund
  • ❌ will not match: my charger is working
  • ❌ will not match: my battery is completely dead

Inputs

InputTypeDescription
TextStringInput text to search keywords in
KeywordsObjectKeywords in json format, see example above
Normalise AccentBooleanWhether you want to ignore accents. It can be helpful in some European languages like french or spanish (etre in keywords will match être)
Case SensitiveBooleanWhether you want to ignore capital letters

Outputs

OutputTypeDescription
Result TopicStringFirst topic detected or None if nothing was detected
Topic Found?BooleanTrue / False if a topic is detected
Details of matched topicObjectJSON object of topics detected ex: {"charging": true}