Scoring text using markup language

POST https://api.speechace.co/api/scoring/text/v9/json?key={{speechacekey}}

In this example we use markup language to explicitly specify the phonetic definition of one or more words.

Markup language allows you to override Speechace lexicon and define your own.

Markup Syntax:

When markup_language=arpa_mark is specified, the input text can have markups on zero, one or multiple words. This flag is supported in both en-us and en-gb requests and can be used in scoring, multiple choice or Validate Text requests.

Each markup has the pattern: [l1|l2|...|ln]{s1|s2|...|sn}, where:

  • l1, l2, ..., ln are substrings of a word in the input text, and
  • s1, s2, ..., sn are syllables of the word corresponding to l1, l2, ..., ln.
  • Each syllable, si, has this pattern: p1 p2 ... pk, where pi is a phoneme in ARPABET notation for the current dialect (i.e. en-us or en-gb).
  • If pi is a vowel phoneme, pi ends with 0, 1 or 2 to denote the stress level of the syllable.
  • There should be at most one vowel per syllable.

Examples of use:

  1. Marking up a word to explicitly specify syllable boundaries and phoneme mapping

There was [noth|ing]{n ah1 th|ih0 ng} on the rock.

2. Specifying which word is intended in a heteronym (i.e. 2 words which share the same spelling but have different pronunciation and meaning).

He [read]{r eh1 d} his [frag|ments]{f r ae1 g|m ah0 n t s} aloud.

3. Handling special acronyms, numbers, or terms

Agent [0||||07]{d ah1 | b ah0 l | ow1 | s eh1 | v ah0 n} worked for MI6.

Note that in this example in order to map 007 to Double-O Seven and no other possible pronunciation of the number 007, we create multiple empty syllables in the word 007.

You can also express phoneme to letter mapping within the markup language.

Request Params

KeyDatatypeRequiredDescription
keystring

Request Body

[{"name"=>"text", "value"=>"I love to [read]{r iy1 d}. Last year I [read]{r eh1 d} Anna Karenina by [Tol|stoy]{t ow1 l|s t oy2}.", "datatype"=>"string"}, {"name"=>"user_audio_file", "value"=>nil, "datatype"=>"null"}, {"name"=>"markup_language", "value"=>"arpa_mark", "datatype"=>"string"}]

RESPONSES

status: OK

{"status":"success","quota_remaining":-1,"text_score":{"text":"Mr. Smith goes to Washington.","word_score_list":[{"word":"Mr.","quality_score":100,"phone_score_list":[{"phone":"m","stress_level":null,"extent":[15,24],"quality_score":100,"word_extent":[0,1],"sound_most_like":"m"},{"phone":"ih","stress_level":1,"extent":[24,27],"quality_score":100,"stress_score":100,"predicted_stress_level":1,"word_extent":[1,1],"sound_most_like":"ih"},{"phone":"s","stress_level":null,"extent":[27,36],"quality_score":100,"word_extent":[1,1],"sound_most_like":"s"},{"phone":"t","stress_level":null,"extent":[36,42],"quality_score":98,"word_extent":[1,1],"sound_most_like":"t"},{"phone":"er","stress_level":0,"extent":[42,48],"quality_score":100,"stress_score":100,"predicted_stress_level":0,"word_extent":[1,3],"sound_most_like":"er"}],"syllable_score_list":[{"phone_count":3,"stress_level":1,"letters":"m","quality_score":100,"stress_score":100,"predicted_stress_level":1,"extent":[15,36]},{"phone_count":2,"stress_level":0,"letters":"r.","quality_score":99,"stress_score":100,"predicted_stress_level":0,"extent":[36,48]}]},{"word":"Smith","quality_score":98,"phone_score_list":[{"phone":"s","stress_level":null,"extent":[48,57],"quality_score":98.66666666666667,"word_extent":[0,1],"sound_most_like":"s"},{"phone":"m","stress_level":null,"extent":[57,66],"quality_score":100,"word_extent":[1,2],"sound_most_like":"m"},{"phone":"ih","stress_level":1,"extent":[66,75],"quality_score":99.33333333333333,"stress_score":100,"predicted_stress_level":0,"word_extent":[2,3],"sound_most_like":"ih"},{"phone":"th","stress_level":null,"extent":[75,81],"quality_score":96,"word_extent":[3,5],"sound_most_like":"th"}],"syllable_score_list":[{"phone_count":4,"stress_level":1,"letters":"smith","quality_score":98,"stress_score":100,"predicted_stress_level":0,"extent":[48,81]}]},{"word":"goes","quality_score":99,"phone_score_list":[{"phone":"g","stress_level":null,"extent":[81,90],"quality_score":99.66666666666667,"word_extent":[0,1],"sound_most_like":"g"},{"phone":"ow","stress_level":1,"extent":[90,99],"quality_score":99.33333333333333,"stress_score":100,"predicted_stress_level":0,"word_extent":[1,3],"sound_most_like":"ow"},{"phone":"z","stress_level":null,"extent":[99,108],"quality_score":98.66666666666667,"word_extent":[3,4],"sound_most_like":"z"}],"syllable_score_list":[{"phone_count":3,"stress_level":1,"letters":"goes","quality_score":99,"stress_score":100,"predicted_stress_level":0,"extent":[81,108]}]},{"word":"to","quality_score":100,"phone_score_list":[{"phone":"t","stress_level":null,"extent":[108,114],"quality_score":100,"word_extent":[0,1],"sound_most_like":"t"},{"phone":"ah","stress_level":0,"extent":[114,117],"quality_score":100,"stress_score":100,"predicted_stress_level":0,"word_extent":[1,2],"sound_most_like":"ah"}],"syllable_score_list":[{"phone_count":2,"stress_level":0,"letters":"to","quality_score":100,"stress_score":100,"predicted_stress_level":0,"extent":[108,117]}]},{"word":"Washington","quality_score":100,"phone_score_list":[{"phone":"w","stress_level":null,"extent":[117,126],"quality_score":99.66666666666667,"word_extent":[0,1],"sound_most_like":"w"},{"phone":"aa","stress_level":1,"extent":[126,138],"quality_score":100,"stress_score":100,"predicted_stress_level":1,"word_extent":[1,2],"sound_most_like":"aa"},{"phone":"sh","stress_level":null,"extent":[138,147],"quality_score":100,"word_extent":[2,4],"sound_most_like":"sh"},{"phone":"ih","stress_level":0,"extent":[147,150],"quality_score":100,"stress_score":100,"predicted_stress_level":0,"word_extent":[4,5],"sound_most_like":"ih"},{"phone":"ng","stress_level":null,"extent":[150,156],"quality_score":100,"word_extent":[5,7],"sound_most_like":"ng"},{"phone":"t","stress_level":null,"extent":[156,165],"quality_score":98.66666666666667,"word_extent":[7,8],"sound_most_like":"t"},{"phone":"ah","stress_level":0,"extent":[165,171],"quality_score":99,"stress_score":96,"predicted_stress_level":1,"word_extent":[8,9],"sound_most_like":"ah"},{"phone":"n","stress_level":null,"extent":[171,189],"quality_score":100,"word_extent":[9,10],"sound_most_like":"n"}],"ending_punctuation":".","syllable_score_list":[{"phone_count":2,"stress_level":1,"letters":"wa","quality_score":100,"stress_score":100,"predicted_stress_level":1,"extent":[117,138]},{"phone_count":3,"stress_level":0,"letters":"shing","quality_score":100,"stress_score":100,"predicted_stress_level":0,"extent":[138,156]},{"phone_count":3,"stress_level":0,"letters":"ton","quality_score":99,"stress_score":96,"predicted_stress_level":1,"extent":[156,189]}]}],"ielts_score":{"pronunciation":9},"pte_score":{"pronunciation":90},"speechace_score":{"pronunciation":99},"toeic_score":{"pronunciation":200},"cefr_score":{"pronunciation":"C2"}},"version":"9.7"}