Introduction
Moments Query Language (MQL) is a special-purpose query language designed to analyze call transcripts.
The expressions written in MQL are used in the MiaRec platform for the following tasks:
- extracting topics and keywords from a transcript
- automatic evaluation of agents
- redacting sensitive data from recordings and transcripts, for example, credit card numbers
Advantages of MQL
MQL lets you search not only the words spoken, but also temporal patterns like beginning/end of a call, nearness, speaker (agent vs customer), fuzzy matching and more.
Examples of such queries:
error NEAR:5 website
-
Search for the word "error" spoken near the word "website", with a distance between these words no more than 5 words.
AGENT: ("my name is" OR "this is")
-
Search for an agent to say the words "my name is" or "this is"
R"[0-9]+" AFTER ("credit card" OR "security code")
-
Search for any digits (0-9) spoken after the anchor words "credit card" or "security code"
POSAFTER:-50 CUSTOMER: thank*
-
Search in the last 50 words of the conversation (i.e. the end of a call) for a customer saying words that match a wildcard pattern
thank*
(i.e. match "thank", "thanks", etc)
MQL lets you query the metadata attributes like call duration, sentiment score, etc.
Examples of such queries:
AGENT: (problem NEAR ship*) AND $call-duration > "2:00"
-
Search for an agent to say the word "problem" near a word that starts with
ship
(e.g. "shipment", "shipping", as well as probably non-relevant "ship"), but only when a call duration is longer than 2 minutes. (cancel NEAR order) AND $sentiment-score < -50
-
Search for the word "cancel" near the word "order", but only when a sentiment score is lower than -50 (very negative).
More examples of MQL expressions
error
-
Search for the word "error" in a transcript
error NEAR:5 website
-
Search for the word "error" spoken near the word "website", with a distance between these two words no more than 5 words. Such a query would match phrases like "error on your website", "website shows an error", but not "error when I tried to order the service on your website", because the distance between the searched words in this last example is more than 5.
("speak to" OR "transfer to") ONEAR (supervisor OR manager)
-
Search for the phrase that begins with the anchor words "speak to" or "transfer to" followed by either the word "supervisor" or "manager", i.e. such an expression will match phrases like "speak to supervisor", "speak to manager", "transer to supervisor", as well as "speak to YOUR supervisor" (i.e. with other words in a middle).
AGENT: "my name is"
-
Search for the phrase "my name is" spoken by an agent.
POSBEFORE:50 AGENT: ("my name is" OR "this is")
-
Search for the phrase "my name is" or "this is" spoken by an agent in the first 50 words of a conversation.
POSAFTER:-20 CUSTOMER: thank*
-
Search for any word that starts with "thank" (e.g. "thank", "thanks") spoken by a customer in the last 20 words of the conversation.
R"[0-9]+" AFTER:50 ("credit card" OR "security code")
-
Search for any digit (0-9) spoken after the anchor words "credit card" or "security code", with a distance of up to 50 words between the anchor words and the digits.