Grammar Intent Syntax Reference
Grammar intents detect specific keywords or phrases in an interaction using a defined syntax rather than an AI evaluation model. This makes them fast to evaluate and free of external AI provider costs, and best suited for matching known vocabulary. For an overview of how grammar intents fit alongside AI intents, see Intent Studio.
This reference describes the full syntax available when writing a grammar intent definition, from basic keyword and phrase matching to speaking party qualifiers, timing and word-position constraints, and the logical operators that combine them. Each section includes examples showing how a pattern matches against spoken text.
Keyword & Phrase Matching
To detect intents using exact keyword or phrase matching, place the target keyword(s) or phrase(s) in quotes (“”).
Keyword and phrase matching is 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
Grammar intent patterns must indicate whose speech should be evaluated for a match. The supported speaking party qualifiers are:
AGENT - matches text spoken by an agent
CUSTOMER - matches text spoken by a customer
ANY - matches text spoken by either party
Standard Behavior
In typical configurations, grammar intents are evaluated against the current message being processed. The party qualifier must be followed by a colon (:) and then the keyword or phrase to match. For example:
AGENT: "hello"- triggers when the agent says “hello"
CUSTOMER: "appointment"- triggers when the customer says “appointment”
ANY: "support"- triggers when either participant says “support”
Autoscoring Behavior
Some additional qualifiers and modifiers apply when grammar intents are used in Autoscoring:
Other
The OTHER qualifier is available in Autoscoring scenarios that involve multiple agents. When more than one agent participates in an interaction, Autoscoring evaluates each agent independently. For each evaluation, the system generates a partial transcript in which:
- AGENT represents the agent currently being scored
- CUSTOMER represents the customer
- OTHER represents all remaining participants, including additional agents or supervisors
This allows scoring logic to distinguish between the target agent’s statements and statements made by others in the same interaction.
Enable Context
The ENABLE_CONTEXT modifier can be used with speaking party qualifiers when Autoscoring cases. During case processing, Autoscoring evaluates agent responses individually. By default, intent matching is limited to:
- the agent message currently being evaluated, and
- the associated customer message
If your intent depends on information introduced earlier in the conversation, append [ENABLE_CONTEXT] to the party qualifier.
For example:
CUSTOMER: "appointment"- matches only if the customer says “appointment” in the current message
CUSTOMER[ENABLE_CONTEXT]: "appointment"- matches if the customer mentioned “appointment” either in the current message or in an earlier message within the same case
ANY[ENABLE_CONTEXT]: "support"- matches if either party referenced “support” previously or in the current message
Use [ENABLE_CONTEXT] when an intent relies on context established earlier in the interaction (for example, when verifying a precondition mentioned in a prior message).
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.
Word Specification
Alternatively, you can use the number of words said instead of seconds using “w” instead of “s”.
For example:
AGENT[:10w]: “thank you for calling bright pattern”- will match if the agent said the phrase in the first 10 words.
AGENT[-10w:]: “thank you for calling bright pattern”- will match if the agent said the phrase in the last 10 words.
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.
Call Events (Hold, Mute, Silence)
In addition to spoken words and phrases, grammar intents can detect non-verbal call events: when a party placed the call on hold, muted their microphone, or when the line went silent. These variables let you score hold-handling procedures (for example, whether the agent asked permission before a hold and thanked the customer on return) without an AI model.
Call event variables apply to voice calls only. Chats, emails, and other channels do not produce these events.
Hold
The HOLD variable matches when a party placed the call on hold. The speaking party qualifier identifies the party that performed the hold.
AGENT: HOLD- matches when the agent placed the call on hold at least once (any hold, any duration).
AGENT: HOLD[N]- matches when the agent placed the call on hold at least N times in the interaction. N is an integer ≥ 1.
- For example,
AGENT: HOLD[3]matches when the agent placed the call on hold three or more times.
AGENT: HOLD > M- matches when a single hold segment lasted longer than M seconds. M is an integer ≥ 1.
- For example,
AGENT: HOLD > 120matches when the agent held the call for more than two minutes.
Each qualifying hold segment triggers the intent once, regardless of the segment's length.
Mute
The MUTE variable matches when an agent muted their microphone. It follows the same forms as HOLD.
AGENT: MUTE- matches when the agent muted the microphone at least once (any duration).
AGENT: MUTE[N]- matches when the agent muted the microphone at least N times. N is an integer ≥ 1.
AGENT: MUTE > M- matches when a single mute segment lasted longer than M seconds. M is an integer ≥ 1.
- For example,
AGENT: MUTE > 120can be used to detect an agent muting the line instead of using hold.
Silence
The SILENCE variable matches a continuous, call-wide segment of "dead air" in which no party produces detectable speech for longer than M seconds. Because silence is call-wide rather than attributed to one party, SILENCE is written without a speaking party qualifier.
SILENCE > M- matches when no party speaks for longer than M seconds. M is an integer ≥ 1.
- For example,
SILENCE > 120matches a dead-air gap longer than two minutes, useful for detecting an agent stuck in a silent call.
No Speech
The NO_SPEECH variable matches a continuous segment in which a specific party produces no detectable speech for longer than M seconds, regardless of whether other parties are speaking. Unlike SILENCE, it takes a speaking party qualifier.
CUSTOMER: NO_SPEECH > M- matches when the customer does not speak for longer than M seconds. M is an integer ≥ 1.
- For example,
AGENT: NO_SPEECH > 120matches when the agent produces no speech for more than two minutes.
Use in BEFORE / AFTER / NEAR
Call event variables can be combined with spoken phrases using the AFTER, BEFORE, and NEAR operators, which is how hold-handling guidelines are typically scored.
For example:
AGENT: "may I place you on hold while I check that for you" BEFORE CUSTOMER: "yes" BEFORE AGENT: HOLD- matches when the agent asked permission, the customer agreed, and only then the agent placed the call on hold.
AGENT: "thank you for waiting" AFTER AGENT: HOLD- matches when the agent thanked the customer after returning from hold.
|
The SILENCE (stuck / dead-air) and MUTE (mute-instead-of-hold) detections are available in historical mode only and are therefore usable for Autoscoring of completed interactions, not for real-time suggestions or alerts. HOLD detection is available in both real-time and historical modes. | ||
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.
Related:
The ENABLE_CONTEXT modifier provides a targeted way to match a specific party’s prior messages in a case. While global operators evaluate logical relationships across the conversation, PARTY[ENABLE_CONTEXT] extends the search scope for a single speaking party without requiring logical operators.