From Bright Pattern Documentation
Jump to: navigation, search
• 5.19

Grammar Intent Syntax Reference

Keyword & Phrase Matching

To detect intents using exact keyword or phrase matching, you must place the keyword(s) or phrase(s) you want to match in quotes (“”).

Keywords and phrases matched are case insensitive.

For example:

  • “thank you”

Fillers & Placeholders

Placement holders can be used in between words allowing for any filler words in your phrases.  

Fill words are represented using an asterisk (*).

To represent multiple fill words, you can multiple asterisks separated by spaces (* * *) or with a single asterisk and a number in square brackets (*[3]).

For example:

  • “thank you * * for your business”
  • “thank you *[2] for your business”


Using a placeholder does not need a fill word present to match. This means that using *[2] can have 0, 1, or up to 2 fill words present and still match.

For instance, In the previous examples, the following sentences would match:

  • “thank you for your business”
  • “thank you all for your business”
  • “thank you so much for your business”

Affixes (Prefixes & Suffixes)

Keywords can be extended by using an asterisk (*) at the beginning or end of a word.

For example:

  • “*end” matches “send” or “bend”
  • “end*” matches “ended” or “ends”

Alternative Words

You can specify alternative words or phrases within a phrase by using angle brackets and a pipe in between each word/phrase (“<first word or phrase | second word or phrase>").

Doing this allows your phrases to match when one or other word or phrase is detected.

For example, “have a good <day | week>” would match with the phrases:

  • “have a good day”
  • “have a good week”

Speaking Party

You must specify who said a keyword or phrase using the variable AGENT for your agents and CUSTOMER for your customers. The party variable must be followed by a colon (:) and the keyword or phrases to indicate it was spoken by them. The intent will only be detected if the speaking party matches the variable used.

For example:

  • AGENT: “hi”
    • will match when the agent says “hi”
  • CUSTOMER: “bye”
    • will match when the customer says “bye”

Time Specification

You can specify the period of time when a keyword or phrase was said by adding a square brackets and a start and end time in seconds separated by a colon to the right of the specified speaking party variable (AGENT[0s:30s]:).

Leaving the first time slot blank will represent “from the very beginning of the call” and leaving the second timeslot blank will represent “to the end of the call”.

Negative values time values will represent the amount of time from the end of the call.

For example:

  • AGENT[0s:30s]:  “thank you for calling bright pattern”
    • will match when the agent said the phrase in the first 30 seconds of the call.
  • AGENT[:30s]:  “thank you for calling bright pattern”
    • will match also when the agent said the phrase in the first 30 seconds of the call.
  • AGENT[-180s:]: “is there anything else I can help you with today”
    • will match when the agent said the phrase in the last 180 seconds of the call.
  • AGENT[-180s:-5s]: “is there anything else I can help you with today”
    • will match when the agent said the phrase anytime from the last 180 seconds to the last 5 seconds of the call.

Interruption

You can detect when an interruption occurs by using the variable INTERRUPTION. An interruption is detected when a person begins talking while the other person has already been talking for more than a second.

You can also indicate how many times an interruption has to occur before being detected by using square brackets with the number value inside (INTERRUPTION[3]).

For example:

  • AGENT: INTERRUPTION
    • will match when the agent interrupts the customer once.
  • CUSTOMER: INTERRUPTION[3]
    • will match when the customer interrupts the agent three times.

--- Operators ---

Local “AND”

You can detect multiple keywords or phrases in a single spoken phrase using an ampersand (&). The order of the keywords and phrases do not have an effect.

For example:

  • CUSTOMER: “want to schedule” & “appointment”
    • will match when both the word “appointment” AND the phrase “want to schedule” are present in the same spoken phrase said by the customer.
    • For example, the intent would match if the customer said “I want to schedule an appointment”.

Grouping

You can group keywords and phrases joined by operators using parentheses “()”. This is useful when working with multiple joined phrases

For example:

  • CUSTOMER: (“want to schedule” | “need to reschedule) & “appointment”

Local “OR”

You can detect for one of many keywords or phrases in a single spoken phrase using a pipe (|). The order of the keywords and phrases do not have an effect.

For example:

  • CUSTOMER: (“cancel” | “postpone”) & “subscription”
    • will match if “cancel” OR “postpone” are present with the word “appointment” in the same spoken phrase said by the customer.
    • For example, the intent would match if the customer said “I want to cancel my subscription” or “I want to postpone my subscription”.

Local “NOT”

You can match an intent when specified keywords or phrases are NOT present in a single spoken phrase using an exclamation point (!).

For example:

  • CUSTOMER: “want” & “subscription” & !(”cancel” & “my”)
    • will match if the words “want” and “subscription” are present in the same spoken phrase but only if the word “cancel” is also not present.
    • For example, the intent would match if the customer said “I want to purchase a subscription” but would NOT match if the customer said “I want to cancel my subscription”.

Global “AND”

You can detect multiple keywords or phrases said by a spoken party at any point in the entire conversation using a double ampersand (&&). The order of the keywords and phrases do not have an effect. You can also join multiple speaking party’s phrases using the global AND.

For example:

  • CUSTOMER: “want to schedule an appointment” && “available next week”
    • will match if the customer said the phrases “want to schedule an appointment” AND “available next week” at any point in the conversation.
    • For example, the intent would match if the customer said “I want to schedule an appointment.” and then later said “I am available next week”.
  • AGENT: “hi” && CUSTOMER: “hi”
    • will match if the agent said “hi” at any point in the conversation AND if the customer also said “hi” at any point in the conversation.

Global “OR”

You can detect for one of many keywords or phrases said by a spoken party at any point in the entire conversation using a double pipe (||). The order of the keywords and phrases do not have an effect. You can also join multiple speaking party’s phrases using the global OR.

For example:

  • CUSTOMER: “schedule an appointment” || “available next week”
    • will match if the customer said the phrase “want to schedule an appointment” OR “available next week” at any point in the conversation.
    • For example, the intent would match if the customer said “I want to schedule an appointment.” or “are you available next week for an appointment”.
  • AGENT: “schedule an appointment” || CUSTOMER: “schedule an appointment”
    • will match if the agent said the phrase “do you want to schedule an appointment” OR if the customer said the phrase “i want to schedule an appointment”.

Global “NOT”

You can match an intent when specified keywords or phrases are NOT present at any point in the entire conversation using a double exclamation point (!!).

For example:

  • CUSTOMER: !!“have used * services before”
    • will detect the intent if the customer never mentions the phrase “have used __ services before”.
    • For example, the intent would NOT match if the customer says “I have used your services before”.

Global AFTER

You can detect when a speaking party said a word or phrase at any point after another speaking party by using the variable AFTER.

For example:

  • CUSTOMER: “i would like to” AFTER AGENT: “would you like to purchase”
    • will match when the agent says “would you like to purchase” and the customer says “i would like to purchase” at any point afterwards.

Global BEFORE

You can detect when a speaking party said a word or phrase at any point before another speaking party by using the variable BEFORE.

For example:

  • AGENT: “would you like to purchase” BEFORE CUSTOMER: “i would like to”
    • will match when the agent says “would you like to purchase” before the customer says “i would like to purchase” at any point.

Global NEAR

You can detect when a word or phrase between both speaking parties are said within a certain time period or within a few words of each other using the variable NEAR. To indicate the period of time or number of words between the spoken words or phrases, you can use a square bracket with a number value inside - using “s” for seconds and “w” for words (NEAR[30s] or NEAR[20w]).

For example:

  • CUSTOMER: “need help” NEAR[10s] AGENT: “let me assist”
    • will match if the customer said the phrase “i need help” within 10 seconds of the agent saying “let me assist” and vice versa.
      < Previous | Next >