/appmatches
Use /appmatches
to retrieve the full text of phrase matches for applications associated with a transcript.
/appmatches
returns a JSON object with phrase match and score data for leaf categories defined in a given transcript's applications. By default, /appmatches
returns match and score data for each leaf category and for every application associated with the specified transcript.
To limit results to a specific set of applications, categories, or subcategories, specify those entities in JSON data submitted with the request.
For applications with multiple categories, the API returns phrase match data for the categories specified in the request. The response also includes scores without phrase match data for any other categories in that application. A queried transcript with no application matches will return a JSON object with file information, but no scorecard
object data.
Synopsis
GET /appmatches/$co_short/$org_short/$tId?token=$token
GET /appmatches/$co_short/$org_short/$tId?token=$token --data @$json
- $co_short
-
Company short name used to filter the request.
- $org_short
-
Organization short name used to filter the request.
- $tId
-
UUID for the transcript to be queried.
- $token
-
Authorization token with the required read or write permissions for the request.
- $json
- Path to the request's JSON file.
Example cURL requests
The following example specifies a tId
of 3 in the company Co-Short
and the organization Org-Short
. The example does not include a JSON-formatted list of applications and categories, so the response includes all applications linked to the transcript's folder.
curl 'http://example.com:3000/appmatches/Co-Short/Org-Short/3?token=123'
The output of the preceding example is a JSON object with matched phrases and score data for all applications associated with that transcript.
The following example queries a tId
of 6 in the company Co-Short
and the organization Org-Short
. The example also includes JSON data for specific applications and categories:
curl 'http://example.com:3000/appmatches/Co-Short/Org-Short/6?token=123' --header 'Content-Type: application/json' --data-raw '{"Agent Scorecard":["Compliance.Recording"], "TopLevel":["NextLevel.LowestLevel"]}'
The output of the preceding example is a JSON object with matched phrases and score data for the following entities:
-
The
Recording
subcategory of theCompliance
category of theAgent Scorecard
application. -
The
LowestLevel
subcategory of theNextLevel
category in theTopLevel
application.
To use a file instead of in-line JSON data, include the filename and path of the file with the request, as in the following example:
curl 'http://example.com:3000/appmatches/Co-Short/Org-Short/6?token=123' --header 'Content-Type: application/json' --data @phrase-request.json
The preceding example references the file phrase-request.json
instead of in-line JSON data. This file must be saved locally on the system that originates the request.
Example JSON input
The following example JSON specifies application, category, and category names to be submitted with a request to /appmatches
:
{
"APP1": [
"Category1.Leaf1",
"Category2.Leaf2"
],
"APP2": [
"Category3"
]
}
The preceding example specifies the following entities for phrase match data in request output:
-
Leaf1
, a subcategory ofCategory1
, which is a category in the applicationAPP1
. -
Leaf2
, a subcategory ofCategory2
, which is a category in the applicationAPP1
. -
All subcategories defined for
Category3
, which is a category of the applicationAPP2
.
Because only two subcategories are specified for APP1
, phrase matches will be returned for only those two subcategories, including any subcategories below them. Phrase matches will be returned for all subcategories under APP2
's Category3
. The request returns only scores for other categories in APP1
and APP2
.
Any category below the ones specified will be included with results. Subcategories are referenced using the dot operator (for example, the .
in Category2.Leaf2
), and this operator may be used to reference as many subcategories as the application contains. For example, the entry Category5.Subcategory5.Subcategory6.Subcategory7.LastLeaf
could be used to specify the deeply nested LastLeaf
without including phrase matches for its parent subcategories.
Example JSON output
JSON data output from /appmatches
includes the following information:
-
Top-level fields for the transcript's audio
filename
,tId
, andorganization
. -
The top-level
scorecard
object, which contains all application score, match, and phrase data. -
Fields below
scorecard
for each included application category and subcategory. -
A
score
field for each category's overall score. -
A
match_data
object that includes allmatches
objects for that application, along with the query phrase in the application that triggered the match. -
A
matches
object that includes the start and end times for the utterance containing the phrase match, along with the phrase's speaker (either agent or client).
Applications may specify phrases to be excluded from scoring. These exclude phrases can be identified in the application by the -
prefix.
As of V‑Spark 4.2.0, when an application with leaf-level exclude phrases is requested in /appmatches
output, that output contains all exclude phrases and their matches, even if those matches do not impact category scores.
Exclude phrases only impact scoring when they are in the same speaker turn as include phrases, and speaker turns that contain only exclude phrases do not affect category scores. So, to identify exactly which exclude phrases affect scores in /appmatches
output, look for speaker turns that contain both exclude and include phrases.
The following example JSON shows the data returned from an /appmatches
request with relatively few matches. The basic structure for applications illustrated in the you
section of the following example is repeated at the JSON object's lower subcategory levels in the subcategories
section when applicable.
{
"filename": "example.wav",
"tId": 6,
"organization": "Org-Short",
"scorecard": {
"you": {
"subcategories": {},
"score": 3,
"match_data": [
{
"matches": [
[
1249.24,
1252.18,
"agent",
"you have a lock on you when you have a wonderful day. Okay,"
],
[
1248.13,
1249.88,
"client",
"Okay. Thank you. Pamela for your help."
]
],
"phrase": "all: you ~s>1240"
}
]
}
}
}
The following table describes the hierarchy and contents of /appmatches
JSON output:
Element |
Type |
Description | |||
---|---|---|---|---|---|
|
string |
Source audio's filename. | |||
|
value |
Source transcript's UUID. | |||
|
string |
Short name of the organization associated with the transcript. | |||
|
object |
Stores one key-value pair for each application with score and match data. The key is the name of the application, and the value is a JSON object that contains the results from each matched application category. | |||
APPLICATION-NAME |
object |
Stores the phrase and match data for the named application. | |||
|
object |
Stores results from each matched application subcategory contained in its parent category object. Each subcategory with match data repeats the structure of the APPLICATION-NAME object at lower levels. | |||
|
value |
Overall category score. | |||
|
array |
Stores one object for each phrase in the application category. | |||
|
array |
Phrase match's start time, end time, speaker, and utterance. | |||
|
string |
Application phrase that triggered the match. |