Add a custom word.

        Adds a single word and its translation to the specified custom voice model. Adding
        a new translation for a word that already exists in a custom model overwrites the
        word's existing translation. A custom model can contain no more than 20,000
        entries. You must use credentials for the instance of the service that owns a
        model to add a word to it.
        You can define sounds-like or phonetic translations for words. A sounds-like
        translation consists of one or more words that, when combined, sound like the
        word. Phonetic translations are based on the SSML phoneme format for representing
        a word. You can specify them in standard International Phonetic Alphabet (IPA)
        representation
          <code>&lt;phoneme alphabet=\"ipa\"
        ph=\"t&#601;m&#712;&#593;to\"&gt;&lt;/phoneme&gt;</code>
          or in the proprietary IBM Symbolic Phonetic Representation (SPR)
          <code>&lt;phoneme alphabet=\"ibm\"
        ph=\"1gAstroEntxrYFXs\"&gt;&lt;/phoneme&gt;</code>
        **Note:** This method is currently a beta release.
        **See also:**
        * [Adding a single word to a custom
        model](https://cloud.ibm.com/docs/services/text-to-speech/custom-entries.html#cuWordAdd)
        * [Adding words to a Japanese custom
        model](https://cloud.ibm.com/docs/services/text-to-speech/custom-entries.html#cuJapaneseAdd)
        * [Understanding
        customization](https://cloud.ibm.com/docs/services/text-to-speech/custom-intro.html).

        :param str customization_id: The customization ID (GUID) of the custom voice
        model. You must make the request with service credentials created for the instance
        of the service that owns the custom model.
        :param str word: The word that is to be added or updated for the custom voice
        model.
        :param str translation: The phonetic or sounds-like translation for the word. A
        phonetic translation is based on the SSML format for representing the phonetic
        string of a word either as an IPA translation or as an IBM SPR translation. A
        sounds-like is one or more words that, when combined, sound like the word.
        :param str part_of_speech: **Japanese only.** The part of speech for the word. The
        service uses the value to produce the correct intonation for the word. You can
        create only a single entry, with or without a single part of speech, for any word;
        you cannot create multiple entries with different parts of speech for the same
        word. For more information, see [Working with Japanese
        entries](https://cloud.ibm.com/docs/services/text-to-speech/custom-rules.html#jaNotes).
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse

def add_word(self,
                 customization_id,
                 word,
                 translation,
                 part_of_speech=None,
                 **kwargs):
        """
        Add a custom word.

        Adds a single word and its translation to the specified custom voice model. Adding
        a new translation for a word that already exists in a custom model overwrites the
        word's existing translation. A custom model can contain no more than 20,000
        entries. You must use credentials for the instance of the service that owns a
        model to add a word to it.
        You can define sounds-like or phonetic translations for words. A sounds-like
        translation consists of one or more words that, when combined, sound like the
        word. Phonetic translations are based on the SSML phoneme format for representing
        a word. You can specify them in standard International Phonetic Alphabet (IPA)
        representation
          <code>&lt;phoneme alphabet=\"ipa\"
        ph=\"t&#601;m&#712;&#593;to\"&gt;&lt;/phoneme&gt;</code>
          or in the proprietary IBM Symbolic Phonetic Representation (SPR)
          <code>&lt;phoneme alphabet=\"ibm\"
        ph=\"1gAstroEntxrYFXs\"&gt;&lt;/phoneme&gt;</code>
        **Note:** This method is currently a beta release.
        **See also:**
        * [Adding a single word to a custom
        model](https://cloud.ibm.com/docs/services/text-to-speech/custom-entries.html#cuWordAdd)
        * [Adding words to a Japanese custom
        model](https://cloud.ibm.com/docs/services/text-to-speech/custom-entries.html#cuJapaneseAdd)
        * [Understanding
        customization](https://cloud.ibm.com/docs/services/text-to-speech/custom-intro.html).

        :param str customization_id: The customization ID (GUID) of the custom voice
        model. You must make the request with service credentials created for the instance
        of the service that owns the custom model.
        :param str word: The word that is to be added or updated for the custom voice
        model.
        :param str translation: The phonetic or sounds-like translation for the word. A
        phonetic translation is based on the SSML format for representing the phonetic
        string of a word either as an IPA translation or as an IBM SPR translation. A
        sounds-like is one or more words that, when combined, sound like the word.
        :param str part_of_speech: **Japanese only.** The part of speech for the word. The
        service uses the value to produce the correct intonation for the word. You can
        create only a single entry, with or without a single part of speech, for any word;
        you cannot create multiple entries with different parts of speech for the same
        word. For more information, see [Working with Japanese
        entries](https://cloud.ibm.com/docs/services/text-to-speech/custom-rules.html#jaNotes).
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if customization_id is None:
            raise ValueError('customization_id must be provided')
        if word is None:
            raise ValueError('word must be provided')
        if translation is None:
            raise ValueError('translation must be provided')

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('text_to_speech', 'V1', 'add_word')
        headers.update(sdk_headers)

        data = {'translation': translation, 'part_of_speech': part_of_speech}

        url = '/v1/customizations/{0}/words/{1}'.format(
            *self._encode_path_vars(customization_id, word))
        response = self.request(
            method='PUT',
            url=url,
            headers=headers,
            json=data,
            accept_json=False)
        return response