For a full overview on Replacement Libraries see our guide on Using Replacement Libraries

Replacements allow you to specify any word and provide an alternative pronunciation of that word. This replacement text can either be a phonetic_respelling which must by formatted using WellSaid's Respelling System to be accepted as a replacement. Alternatively you can provide your own suggestion to the model where you would set the phonetic_respelling value to FALSE.

To create a Replacement Make a POST request to this URL, including your API key in the header and the library_idof the Library you want to add your replacement(s) to :

https://api.wellsaidlabs.com/v1/tts/post_clips

An example curl command:

curl --request POST \
     --url https://api.wellsaidlabs.com/v1/tts/replacement_libraries/c1b7c009-904d-48c2-a2d6-4249863cb995/replacements \
     --header 'X-API-KEY: <YOUR_API_KEY>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "original": "pizza",
  "replacement_text": "PEET-suh",
  "is_phonetic_respelling": true,
  "enabled": true
}
'

Response

Below is an example of a successful response showing one avatar with the following structure:

{
"replacement_id": "YOUR_REPLACEMENT_ID"
}

Get Lists of Replacements

Make a GET request to this URL, including your API key in the header:

https://api.wellsaidlabs.com/v1/tts/replacement_libraries/{library_id}/replacements

An example curl command:

curl --request GET \
     --url <https://api.wellsaidlabs.com/v1/tts/replacement_libraries/{library_id}/replacements> \
     --header 'X-API-KEY: <YOUR_API_KEY>' \

Response

Below is an example of a successful response showing one avatar with the following structure:{

{
  "count": 1,
  "library_id": "YOUR_LIBRARY_ID",
  "replacements": [
    {
      "enabled": true,
      "is_phonetic_respelling": true,
      "library_id": "YOUR_LIBRARY_ID",
      "original": "pizza",
      "replacement_id": "YOUR_REPLACEMENT_ID",
      "replacement_text": "PEET-suh"
    }
  ]
}

Details of response

Fieldtypenotes
countintegerTotal count of libraries created for your account
library_idstringThe ID for a library
replacementsarrayArray that contains all replacements in this library
enabledbooleanThe ability to turn on an off a replacement when passing a library to a TTS endpoint
is_phonetic_respellingbooleanReplacements can be stored as Respellings which provide our models with precise pronunciation instructions and you can query for optimal pronunciations using our Respelling Suggestions call
originalstringThe original word you want to add the replacement for
replacement_idstringThe ID for the replacement
replacement_textstringthe replacement text you want used when this replacement is enabled, this text is what WellSaid will send to the model.