Score Text/Markup Language
Run in Postman: Scoring text using markup language
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 can be used in scoring pronunciation, 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, ands1
,s2
, ...,sn
are syllables of the word corresponding tol1
,l2
, ...,ln
.Each syllable,
si
, has this pattern:p1
p2
...pk
, wherepi
is a phoneme in ARPABET notation for the dialect.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.
Let's take a word "Nothing" and divide it into its syllables and phonemes along with its stress level to understand it better:
[noth | ing]: "Nothing" has two syllables, "noth" and "ing".
{n ah1 th | ih0 ng}: This part is a phonetic transcription where:
n: Represents the phoneme /n/, as in "no".
ah1: Represents the stressed vowel phoneme /ʌ/, as in "cup". The "1" indicates primary stress.
th: Represents the phoneme /θ/, as in "think".
ih0: Represents the vowel phoneme /ɪ/, as in "sit", with "0" indicating no stress or secondary stress.
ng: Represents the phoneme /ŋ/, as in "sing".
Markup Language Use-cases
Marking up a word to explicitly specify syllable boundaries and phoneme mapping
There was [noth|ing]{n ah1 th|ih0 ng} on the rock.
Specifying which word is intended in a heteronym (i.e. 2 words which share the same spelling but have different pronunciation and meaning). Here the heteronyms are "read" and "fragments".
He [read]{r eh1 d} his [frag|ments]{f r ae1 g|m ah0 n t s} aloud.
Handling special acronyms, numbers, or terms
Agent [0||||07]{d ah1 | b ah0 l | ow1 | s eh1 | v ah0 n} worked for MI6.
Note: In the above 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".
For detailed explanation of markup language, refer the Markup Language guide.
Request Response Example
We will evaluate the sentence using the markup language applied to the word "read," as demonstrated below:
The request parameters which you can see in the cURL below can be found in Score Text/Pronunciation.
Notice the different phonemes for both instances of the word "read" in the sentence and compare them with the phonemes present in the response for the same words.
Last updated