Single Choice

Updated at:

This document is a technical guide for developers who integrate the English multiple-choice speech assessment feature into their products.

Scenarios for this problem type:

  • A score is awarded only if the user pronounces the correct option completely and accurately.

  • The user pronounces one of the predefined answers, and a score is given based on the detected answer.

Assessment request parameters

Field

Type

Optional

Description

coreType

String

Required

en.choc.score indicates the English multiple-choice question type.

rank

int

Optional

The scoring scale. This value can be any number. The final score is rescaled to a 100-point system.

precision

double

Optional

The scoring precision. Supported values are 0.1, 0.5, and 1. The default is 1. If you set a value other than 0.1 or 0.5, the system uses 1.

lm

array

Required

An array of dictionaries that defines the multiple-choice options.1. In the lm sub-field, an answer value of 0 indicates an incorrect answer. A non-zero value indicates a correct answer. Note: The lm field is the lowercase form of LM.2. An overall score is awarded only if the correct text field is read with correct and complete pronunciation.

cmd_word

int

Optional

0: Uses the standard decoding network. This is the default.1: Uses a simplified decoding network. Decoding is faster, but performance may be lower. Set this parameter when the reference text is long.

attachAudioUrl

int

Optional

Specifies whether to return the audio URL in the assessment result.
0: Does not return the URL.
1: Returns the URL.

Parameter example

{
    "coreType": "en.choc.score",
    "rank": 2,
    "precision": 0.5,
    "attachAudioUrl":1,
    "lm": [
        {"answer": 0, "text": "In an office." },
        {"answer": 2, "text": "In a store." },
        {"answer": 0, "text": "In the street." }
    ]
}

Response example

{
    "tokenId": "61265ea188bf5b00000e0001",
    "applicationId": "a148",
    "audioUrl": "http:\/\/files.cloud.ssapi.cn:8080\/a148\/11ec05b74ec73b88a52ea1484261e844",
    "connect": {
        "param": {
            "app": {
                "timestamp": "1629904545",
                "applicationId": "a148",
                "sig": "234dac26e7e6ee712eae6cae644531047c27dfd3"
            },
            "sdk": {
                "os": "6.2(9200)1",
                "product": "",
                "source": 7,
                "protocol": 1,
                "os_version": "6.2(9200)",
                "arch": "586",
                "version": 16778752
            }
        },
        "cmd": "connect"
    },
    "params": {
        "app": {
            "timestamp": "1629904545",
            "userId": "ssound_text",
            "sig": "234dac26e7e6ee712eae6cae644531047c27dfd3",
            "connect_id": "61265ea188bf5b0000100002",
            "clientId": "",
            "applicationId": "a148"
        },
        "audio": {
            "sampleBytes": 2,
            "audioType": "ogg",
            "sampleRate": 16000,
            "channel": 1
        },
        "request": {
            "lm": [
                {
                    "text": "In an office.",
                    "answer": 0
                },
                {
                    "text": "In a store.",
                    "answer": 2
                },
                {
                    "text": "In the street.",
                    "answer": 0
                }
            ],
            "tokenId": "61265ea188bf5b00000e0001",
            "precision": 0.5,
            "attachAudioUrl": 1,
            "request_id": "61265ea188bf5b00000f0001",
            "rank": 2,
            "coreType": "en.choc.score"
        }
    },
    "recordId": "11ec05b74ec73b88a52ea1484261e844",
    "eof": 1,
    "result": {
        "overall": 0,
        "wavetime": 2990,
        "precision": 0.5,
        "systime": 3610,
        "res": "eng.choc.mfcc.0.1",
        "version": "0.0.80.2021.7.24.00:01:28",
        "info": {
            "tipId": 0,
            "clip": 0,
            "snr": 29.888056,
            "volume": 84
        },
        "rank": 2,
        "pretime": 3,
        "delaytime": 67
    },
    "dtLastResponse": "2021-08-25 23:15:43:906",
    "cloud_platform": {
        "origin_audio_length": 11600
    }
}

Response description

Key

Type

Description

Usage suggestion

recordId

string

The unique ID of the audio file.

For reference

tokenId

string

The unique ID of the request.

For reference

applicationId

string

The AppKey for the authorized account

Internal parameter

audioUrl

string

The URL of the user's audio. By default, the audio is stored in the cloud for one month. Save the audio to your product server.

For reference

dtLastResponse

string

The time of the cloud response.

Internal parameter

eof

int

0: The response is not complete. More results will follow.1: All results for this assessment have been returned.

Internal parameter

params

object

Echoes the assessment request parameters sent by the client.

- app

object

- - applicationId

string

AppKey of the authorization account

- - userId

string

The user ID. This is a custom string that helps you locate and troubleshoot issues.

- - timestamp

string

The start time.

- - sig

string

The verification code.

- - clientId

string

- request

object

The node for assessment request parameters.

- audio

object

The node for the audio parameters of the assessment request.

result

object

The assessment result.

- res

string

The name of the resource used to assess this question type.

Internal parameter

- version

string

The version and publish time of the DPI engine.

Internal parameter

- rank

int

The scoring scale.

Internal parameter

- precision

float

The scoring precision.

Internal parameter

- pretime

int

The time, in ms, that the cloud takes to call the Start API.

Internal parameter

- systime

int

The total time, in ms, for the entire assessment process.

Internal parameter

- delaytime

int

The time, in ms, from when the cloud finishes feeding the audio to when the result is obtained.

Internal parameter

- wavetime

int

The audio duration in ms.

For reference

- overall

float

The overall score.

Recommended field

- fake_words

object

(This field appears only when the assessment text contains invalid words. Each word is a node.)

- - char

string

A word that is not in the dictionary.

- info

object

- - snr

float

The signal-to-noise ratio. A higher value indicates clearer audio. Range: 0 to 40 dB. If this parameter affects the score, a corresponding tipId value is set.

For reference

- - clip

float

The audio volume is too high, which causes clipping. Range: 0 to 1. If this parameter affects the score, a corresponding tipId value is set.

Internal parameter

- - volume

int

The recording volume. Range: 0 to 180 dB.

For reference

- - tipId

int

The audio quality. For more information, see tipId prompt information.

Recommended field

Suggestions for displaying assessment results

Dimension

Description

Details

overall

Overall pronunciation score

An overall evaluation of the pronunciation of the selected sentence.

Response when assessment fails

  • An empty result structure in the response indicates that the assessment failed.

  • Retrieve the errId and error from the response. Your application can use the error code for further processing.

Error codes