Score a Multiple Choice Text

POST https://api.speechace.co/api/scoring/text/v0.5/json?key={{speechacekey}}&user_id=XYZ-ABC-99001&dialect=en-us

In this example we score the multiple choice:

apple banana orange

Note that the text parameter contains the multiple choice options separated by the newline character '\n'

Speechace will return the score of the submitted audio against the closest option from the multiple choices matched by the audio. This allows you to identify which answer the user spoke and how well they spoke the answer.

Copy the example code and be sure to:

  1. Add your Speechace API key
  2. Add a valid file path in the useraudiofile parameter. For example in curl the you would add something like @/tmp/orang_16k.wav

You can download a sample orang_16k.wav file here.

Request Params

KeyDatatypeRequiredDescription
keystringAPI key issued by Speechace.
user_idstringA unique anonymized identifier for the end-user who spoke the audio.

Structure this field to include as much info as possible to aid in reporting and analytics.

For example: user_id=XYZ-ABC-99001 where:

  • XYZ is an id for your Product or App
  • ABC is an id for the customer/site/account
  • 99001 is an id for the end-user

Ensure user_id is unique and anonymized containing no personally identifiable information. | | dialect | string | | The dialect to use for scoring. Supported values are "en-us" (US English) and "en-gb" (UK English).

en-gb requires setting v0.1 in url path. i.e. https://api.speechace.co/api/scoring/text/v0.1/json? |

Request Body

[{"name"=>"text", "value"=>"\"apple\norange\nbanana\"", "datatype"=>"string"}, {"name"=>"user_audio_file", "value"=>nil, "datatype"=>"null"}, {"name"=>"question_info", "value"=>"'u1/q1'", "datatype"=>"string"}]

RESPONSES

status: OK

{"status":"success","quota_remaining":-1,"text_score":{"text":"orange","quality_score":81,"word_score_list":[{"word":"orange","quality_score":81,"phone_score_list":[{"phone":"ao","stress_level":1,"extent":[74,86],"quality_score":97.16666666666667,"stress_score":97.92657157950342,"sound_most_like":"ao"},{"phone":"r","stress_level":null,"extent":[86,91],"quality_score":100,"sound_most_like":"r"},{"phone":"ah","stress_level":0,"extent":[91,101],"quality_score":99.1,"stress_score":97.92657157950342,"sound_most_like":"ah"},{"phone":"n","stress_level":null,"extent":[101,116],"quality_score":97.53333333333333,"sound_most_like":"n"},{"phone":"jh","stress_level":null,"extent":[116,128],"quality_score":11.666666666666663,"sound_most_like":"g","child_phones":[{"extent":[116,117],"quality_score":11.666666666666666,"sound_most_like":"k"},{"extent":[117,125],"quality_score":11.66666666666666,"sound_most_like":"g"},{"extent":[125,128],"quality_score":11.666666666666666,"sound_most_like":"k"}]}],"syllable_score_list":[{"phone_count":1,"stress_level":1,"letters":"o","quality_score":97,"stress_score":97.92657157950342,"extent":[74,86]},{"phone_count":4,"stress_level":0,"letters":"range","quality_score":77,"stress_score":97.92657157950342,"extent":[86,128]}]}],"fidelity_class":"CORRECT"},"version":"0.5"}