Instruction:
Can you generate the documentation for the following Python 3 function
def translate(self, text, model_id=None, source=None, target=None,
                  **kwargs):
        """
        Translate.

        Translates the input text from the source language to the target language.

        :param list[str] text: Input text in UTF-8 encoding. Multiple entries will result
        in multiple translations in the response.
        :param str model_id: A globally unique string that identifies the underlying model
        that is used for translation.
        :param str source: Translation source language code.
        :param str target: Translation target language code.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if text is None:
            raise ValueError('text must be provided')

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('language_translator', 'V3', 'translate')
        headers.update(sdk_headers)

        params = {'version': self.version}

        data = {
            'text': text,
            'model_id': model_id,
            'source': source,
            'target': target
        }

        url = '/v3/translate'
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            json=data,
            accept_json=True)
        return response

Response: Translate a text from one language to another.


Instruction:
Create a Python 3 function to
identify language. Identifies the language of the input text. :param str text: Input text in UTF-8 format. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse

Response:
def identify(self, text, **kwargs):
        """
        Identify language.

        Identifies the language of the input text.

        :param str text: Input text in UTF-8 format.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if text is None:
            raise ValueError('text must be provided')

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('language_translator', 'V3', 'identify')
        headers.update(sdk_headers)

        params = {'version': self.version}

        data = text
        headers['content-type'] = 'text/plain'

        url = '/v3/identify'
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            data=data,
            accept_json=True)
        return response


Instruction:
Make a summary of the following Python 3 code
def create_model(self,
                     base_model_id,
                     forced_glossary=None,
                     parallel_corpus=None,
                     name=None,
                     **kwargs):
        """
        Create model.

        Uploads Translation Memory eXchange (TMX) files to customize a translation model.
        You can either customize a model with a forced glossary or with a corpus that
        contains parallel sentences. To create a model that is customized with a parallel
        corpus and a forced glossary, proceed in two steps: customize with a
        parallel corpus first and then customize the resulting model with a glossary.
        Depending on the type of customization and the size of the uploaded corpora,
        training can range from minutes for a glossary to several hours for a large
        parallel corpus. You can upload a single forced glossary file and this file must
        be less than 10 MB. You can upload multiple parallel corpora tmx files. The
        cumulative file size of all uploaded files is limited to 250 MB. To
        successfully train with a parallel corpus you must have at least 5,000 parallel
        sentences in your corpus.
        You can have a maxium of 10 custom models per language pair.

        :param str base_model_id: The model ID of the model to use as the base for
        customization. To see available models, use the `List models` method. Usually all
        IBM provided models are customizable. In addition, all your models that have been
        created via parallel corpus customization, can be further customized with a forced
        glossary.
        :param file forced_glossary: A TMX file with your customizations. The
        customizations in the file completely overwrite the domain translaton data,
        including high frequency or high confidence phrase translations. You can upload
        only one glossary with a file size less than 10 MB per call. A forced glossary
        should contain single words or short phrases.
        :param file parallel_corpus: A TMX file with parallel sentences for source and
        target language. You can upload multiple parallel_corpus files in one request. All
        uploaded parallel_corpus files combined, your parallel corpus must contain at
        least 5,000 parallel sentences to train successfully.
        :param str name: An optional model name that you can use to identify the model.
        Valid characters are letters, numbers, dashes, underscores, spaces and
        apostrophes. The maximum length is 32 characters.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if base_model_id is None:
            raise ValueError('base_model_id must be provided')

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('language_translator', 'V3',
                                      'create_model')
        headers.update(sdk_headers)

        params = {
            'version': self.version,
            'base_model_id': base_model_id,
            'name': name
        }

        form_data = {}
        if forced_glossary:
            form_data['forced_glossary'] = (None, forced_glossary,
                                            'application/octet-stream')
        if parallel_corpus:
            form_data['parallel_corpus'] = (None, parallel_corpus,
                                            'application/octet-stream')

        url = '/v3/models'
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            files=form_data,
            accept_json=True)
        return response

Response: Create a translation model for the given language pair.


Instruction:
How would you code a function in Python 3 to
return a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        return _dict


Instruction:
Create a Python 3 function to
return a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'language') and self.language is not None:
            _dict['language'] = self.language
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        return _dict


Instruction:
Explain what the following Python 3 code does
def _from_dict(cls, _dict):
        args = {}
        if 'languages' in _dict:
            args['languages'] = [
                IdentifiableLanguage._from_dict(x)
                for x in (_dict.get('languages'))
            ]
        else:
            raise ValueError(
                'Required property \'languages\' not present in IdentifiableLanguages JSON'
            )
        return cls(**args)

Response: Initialize a IdentifiableLanguages object from a json dictionary.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'languages') and self.languages is not None:
            _dict['languages'] = [x._to_dict() for x in self.languages]
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
How would you code a function in Python 3 to
return a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'language') and self.language is not None:
            _dict['language'] = self.language
        if hasattr(self, 'confidence') and self.confidence is not None:
            _dict['confidence'] = self.confidence
        return _dict


Instruction:
Given the following Python 3 function, write the documentation
def _from_dict(cls, _dict):
        args = {}
        if 'languages' in _dict:
            args['languages'] = [
                IdentifiedLanguage._from_dict(x)
                for x in (_dict.get('languages'))
            ]
        else:
            raise ValueError(
                'Required property \'languages\' not present in IdentifiedLanguages JSON'
            )
        return cls(**args)

Response: Initialize a IdentifiedLanguages object from a json dictionary.


Instruction:
How would you code a function in Python 3 to
return a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(
                self,
                'translation_output') and self.translation_output is not None:
            _dict['translation'] = self.translation_output
        return _dict


Instruction:
How would you explain what the following Python 3 function does
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'model_id') and self.model_id is not None:
            _dict['model_id'] = self.model_id
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        if hasattr(self, 'source') and self.source is not None:
            _dict['source'] = self.source
        if hasattr(self, 'target') and self.target is not None:
            _dict['target'] = self.target
        if hasattr(self, 'base_model_id') and self.base_model_id is not None:
            _dict['base_model_id'] = self.base_model_id
        if hasattr(self, 'domain') and self.domain is not None:
            _dict['domain'] = self.domain
        if hasattr(self, 'customizable') and self.customizable is not None:
            _dict['customizable'] = self.customizable
        if hasattr(self, 'default_model') and self.default_model is not None:
            _dict['default_model'] = self.default_model
        if hasattr(self, 'owner') and self.owner is not None:
            _dict['owner'] = self.owner
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Can you tell what is the following Python 3 function doing
def _from_dict(cls, _dict):
        args = {}
        if 'models' in _dict:
            args['models'] = [
                TranslationModel._from_dict(x) for x in (_dict.get('models'))
            ]
        else:
            raise ValueError(
                'Required property \'models\' not present in TranslationModels JSON'
            )
        return cls(**args)

Response: Initialize a TranslationModels object from a json dictionary.


Instruction:
Explain what the following Python 3 code does
def _from_dict(cls, _dict):
        args = {}
        if 'word_count' in _dict:
            args['word_count'] = _dict.get('word_count')
        else:
            raise ValueError(
                'Required property \'word_count\' not present in TranslationResult JSON'
            )
        if 'character_count' in _dict:
            args['character_count'] = _dict.get('character_count')
        else:
            raise ValueError(
                'Required property \'character_count\' not present in TranslationResult JSON'
            )
        if 'translations' in _dict:
            args['translations'] = [
                Translation._from_dict(x) for x in (_dict.get('translations'))
            ]
        else:
            raise ValueError(
                'Required property \'translations\' not present in TranslationResult JSON'
            )
        return cls(**args)

Response: Initialize a TranslationResult object from a json dictionary.


Instruction:
Create a Python 3 function for
returning a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'word_count') and self.word_count is not None:
            _dict['word_count'] = self.word_count
        if hasattr(self,
                   'character_count') and self.character_count is not None:
            _dict['character_count'] = self.character_count
        if hasattr(self, 'translations') and self.translations is not None:
            _dict['translations'] = [x._to_dict() for x in self.translations]
        return _dict


Instruction:
Create a Python 3 function to
recognize audio. Sends audio and returns transcription results for a recognition request. You can pass a maximum of 100 MB and a minimum of 100 bytes of audio with a request. The service automatically detects the endianness of the incoming audio and, for audio that includes multiple channels, downmixes the audio to one-channel mono during transcoding. The method returns only final results; to enable interim results, use the WebSocket API. **See also:** [Making a basic HTTP request](https://cloud.ibm.com/docs/services/speech-to-text/http.html#HTTP-basic). ### Streaming mode For requests to transcribe live audio as it becomes available, you must set the `Transfer-Encoding` header to `chunked` to use streaming mode. In streaming mode, the service closes the connection (status code 408) if it does not receive at least 15 seconds of audio (including silence) in any 30-second period. The service also closes the connection (status code 400) if it detects no speech for `inactivity_timeout` seconds of streaming audio; use the `inactivity_timeout` parameter to change the default of 30 seconds. **See also:** * [Audio transmission](https://cloud.ibm.com/docs/services/speech-to-text/input.html#transmission) * [Timeouts](https://cloud.ibm.com/docs/services/speech-to-text/input.html#timeouts) ### Audio formats (content types) The service accepts audio in the following formats (MIME types). * For formats that are labeled **Required**, you must use the `Content-Type` header with the request to specify the format of the audio. * For all other formats, you can omit the `Content-Type` header or specify `application/octet-stream` with the header to have the service automatically detect the format of the audio. (With the `curl` command, you can specify either `\"Content-Type:\"` or `\"Content-Type: application/octet-stream\"`.) Where indicated, the format that you specify must include the sampling rate and can optionally include the number of channels and the endianness of the audio. * `audio/alaw` (**Required.** Specify the sampling rate (`rate`) of the audio.) * `audio/basic` (**Required.** Use only with narrowband models.) * `audio/flac` * `audio/g729` (Use only with narrowband models.) * `audio/l16` (**Required.** Specify the sampling rate (`rate`) and optionally the number of channels (`channels`) and endianness (`endianness`) of the audio.) * `audio/mp3` * `audio/mpeg` * `audio/mulaw` (**Required.** Specify the sampling rate (`rate`) of the audio.) * `audio/ogg` (The service automatically detects the codec of the input audio.) * `audio/ogg;codecs=opus` * `audio/ogg;codecs=vorbis` * `audio/wav` (Provide audio with a maximum of nine channels.) * `audio/webm` (The service automatically detects the codec of the input audio.) * `audio/webm;codecs=opus` * `audio/webm;codecs=vorbis` The sampling rate of the audio must match the sampling rate of the model for the recognition request: for broadband models, at least 16 kHz; for narrowband models, at least 8 kHz. If the sampling rate of the audio is higher than the minimum required rate, the service down-samples the audio to the appropriate rate. If the sampling rate of the audio is lower than the minimum required rate, the request fails. **See also:** [Audio formats](https://cloud.ibm.com/docs/services/speech-to-text/audio-formats.html). ### Multipart speech recognition **Note:** The Watson SDKs do not support multipart speech recognition. The HTTP `POST` method of the service also supports multipart speech recognition. With multipart requests, you pass all audio data as multipart form data. You specify some parameters as request headers and query parameters, but you pass JSON metadata as form data to control most aspects of the transcription. The multipart approach is intended for use with browsers for which JavaScript is disabled or when the parameters used with the request are greater than the 8 KB limit imposed by most HTTP servers and proxies. You can encounter this limit, for example, if you want to spot a very large number of keywords. **See also:** [Making a multipart HTTP request](https://cloud.ibm.com/docs/services/speech-to-text/http.html#HTTP-multi). :param file audio: The audio to transcribe. :param str model: The identifier of the model that is to be used for the recognition request. See [Languages and models](https://cloud.ibm.com/docs/services/speech-to-text/models.html). :param str language_customization_id: The customization ID (GUID) of a custom language model that is to be used with the recognition request. The base model of the specified custom language model must match the model specified with the `model` parameter. You must make the request with credentials for the instance of the service that owns the custom model. By default, no custom language model is used. See [Custom models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom-input). **Note:** Use this parameter instead of the deprecated `customization_id` parameter. :param str acoustic_customization_id: The customization ID (GUID) of a custom acoustic model that is to be used with the recognition request. The base model of the specified custom acoustic model must match the model specified with the `model` parameter. You must make the request with credentials for the instance of the service that owns the custom model. By default, no custom acoustic model is used. See [Custom models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom-input). :param str base_model_version: The version of the specified base model that is to be used with recognition request. Multiple versions of a base model can exist when a model is updated for internal improvements. The parameter is intended primarily for use with custom models that have been upgraded for a new base model. The default value depends on whether the parameter is used with or without a custom model. See [Base model version](https://cloud.ibm.com/docs/services/speech-to-text/input.html#version). :param float customization_weight: If you specify the customization ID (GUID) of a custom language model with the recognition request, the customization weight tells the service how much weight to give to words from the custom language model compared to those from the base model for the current request. Specify a value between 0.0 and 1.0. Unless a different customization weight was specified for the custom model when it was trained, the default value is 0.3. A customization weight that you specify overrides a weight that was specified when the custom model was trained. The default value yields the best performance in general. Assign a higher value if your audio makes frequent use of OOV words from the custom model. Use caution when setting the weight: a higher value can improve the accuracy of phrases from the custom model's domain, but it can negatively affect performance on non-domain phrases. See [Custom models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom-input). :param int inactivity_timeout: The time in seconds after which, if only silence (no speech) is detected in streaming audio, the connection is closed with a 400 error. The parameter is useful for stopping audio submission from a live microphone when a user simply walks away. Use `-1` for infinity. See [Inactivity timeout](https://cloud.ibm.com/docs/services/speech-to-text/input.html#timeouts-inactivity). :param list[str] keywords: An array of keyword strings to spot in the audio. Each keyword string can include one or more string tokens. Keywords are spotted only in the final results, not in interim hypotheses. If you specify any keywords, you must also specify a keywords threshold. You can spot a maximum of 1000 keywords. Omit the parameter or specify an empty array if you do not need to spot keywords. See [Keyword spotting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#keyword_spotting). :param float keywords_threshold: A confidence value that is the lower bound for spotting a keyword. A word is considered to match a keyword if its confidence is greater than or equal to the threshold. Specify a probability between 0.0 and 1.0. If you specify a threshold, you must also specify one or more keywords. The service performs no keyword spotting if you omit either parameter. See [Keyword spotting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#keyword_spotting). :param int max_alternatives: The maximum number of alternative transcripts that the service is to return. By default, the service returns a single transcript. If you specify a value of `0`, the service uses the default value, `1`. See [Maximum alternatives](https://cloud.ibm.com/docs/services/speech-to-text/output.html#max_alternatives). :param float word_alternatives_threshold: A confidence value that is the lower bound for identifying a hypothesis as a possible word alternative (also known as \"Confusion Networks\"). An alternative word is considered if its confidence is greater than or equal to the threshold. Specify a probability between 0.0 and 1.0. By default, the service computes no alternative words. See [Word alternatives](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_alternatives). :param bool word_confidence: If `true`, the service returns a confidence measure in the range of 0.0 to 1.0 for each word. By default, the service returns no word confidence scores. See [Word confidence](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_confidence). :param bool timestamps: If `true`, the service returns time alignment for each word. By default, no timestamps are returned. See [Word timestamps](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_timestamps). :param bool profanity_filter: If `true`, the service filters profanity from all output except for keyword results by replacing inappropriate words with a series of asterisks. Set the parameter to `false` to return results with no censoring. Applies to US English transcription only. See [Profanity filtering](https://cloud.ibm.com/docs/services/speech-to-text/output.html#profanity_filter). :param bool smart_formatting: If `true`, the service converts dates, times, series of digits and numbers, phone numbers, currency values, and internet addresses into more readable, conventional representations in the final transcript of a recognition request. For US English, the service also converts certain keyword strings to punctuation symbols. By default, the service performs no smart formatting. **Note:** Applies to US English, Japanese, and Spanish transcription only. See [Smart formatting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#smart_formatting). :param bool speaker_labels: If `true`, the response includes labels that identify which words were spoken by which participants in a multi-person exchange. By default, the service returns no speaker labels. Setting `speaker_labels` to `true` forces the `timestamps` parameter to be `true`, regardless of whether you specify `false` for the parameter. **Note:** Applies to US English, Japanese, and Spanish transcription only. To determine whether a language model supports speaker labels, you can also use the **Get a model** method and check that the attribute `speaker_labels` is set to `true`. See [Speaker labels](https://cloud.ibm.com/docs/services/speech-to-text/output.html#speaker_labels). :param str customization_id: **Deprecated.** Use the `language_customization_id` parameter to specify the customization ID (GUID) of a custom language model that is to be used with the recognition request. Do not specify both parameters with a request. :param str grammar_name: The name of a grammar that is to be used with the recognition request. If you specify a grammar, you must also use the `language_customization_id` parameter to specify the name of the custom language model for which the grammar is defined. The service recognizes only strings that are recognized by the specified grammar; it does not recognize other custom words from the model's words resource. See [Grammars](https://cloud.ibm.com/docs/services/speech-to-text/input.html#grammars-input). :param bool redaction: If `true`, the service redacts, or masks, numeric data from final transcripts. The feature redacts any number that has three or more consecutive digits by replacing each digit with an `X` character. It is intended to redact sensitive numeric data, such as credit card numbers. By default, the service performs no redaction. When you enable redaction, the service automatically enables smart formatting, regardless of whether you explicitly disable that feature. To ensure maximum security, the service also disables keyword spotting (ignores the `keywords` and `keywords_threshold` parameters) and returns only a single final transcript (forces the `max_alternatives` parameter to be `1`). **Note:** Applies to US English, Japanese, and Korean transcription only. See [Numeric redaction](https://cloud.ibm.com/docs/services/speech-to-text/output.html#redaction). :param str content_type: The format (MIME type) of the audio. For more information about specifying an audio format, see **Audio formats (content types)** in the method description. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse

Response:
def recognize(self,
                  audio,
                  model=None,
                  language_customization_id=None,
                  acoustic_customization_id=None,
                  base_model_version=None,
                  customization_weight=None,
                  inactivity_timeout=None,
                  keywords=None,
                  keywords_threshold=None,
                  max_alternatives=None,
                  word_alternatives_threshold=None,
                  word_confidence=None,
                  timestamps=None,
                  profanity_filter=None,
                  smart_formatting=None,
                  speaker_labels=None,
                  customization_id=None,
                  grammar_name=None,
                  redaction=None,
                  content_type=None,
                  **kwargs):
        """
        Recognize audio.

        Sends audio and returns transcription results for a recognition request. You can
        pass a maximum of 100 MB and a minimum of 100 bytes of audio with a request. The
        service automatically detects the endianness of the incoming audio and, for audio
        that includes multiple channels, downmixes the audio to one-channel mono during
        transcoding. The method returns only final results; to enable interim results, use
        the WebSocket API.
        **See also:** [Making a basic HTTP
        request](https://cloud.ibm.com/docs/services/speech-to-text/http.html#HTTP-basic).
        ### Streaming mode
         For requests to transcribe live audio as it becomes available, you must set the
        `Transfer-Encoding` header to `chunked` to use streaming mode. In streaming mode,
        the service closes the connection (status code 408) if it does not receive at
        least 15 seconds of audio (including silence) in any 30-second period. The service
        also closes the connection (status code 400) if it detects no speech for
        `inactivity_timeout` seconds of streaming audio; use the `inactivity_timeout`
        parameter to change the default of 30 seconds.
        **See also:**
        * [Audio
        transmission](https://cloud.ibm.com/docs/services/speech-to-text/input.html#transmission)
        *
        [Timeouts](https://cloud.ibm.com/docs/services/speech-to-text/input.html#timeouts)
        ### Audio formats (content types)
         The service accepts audio in the following formats (MIME types).
        * For formats that are labeled **Required**, you must use the `Content-Type`
        header with the request to specify the format of the audio.
        * For all other formats, you can omit the `Content-Type` header or specify
        `application/octet-stream` with the header to have the service automatically
        detect the format of the audio. (With the `curl` command, you can specify either
        `\"Content-Type:\"` or `\"Content-Type: application/octet-stream\"`.)
        Where indicated, the format that you specify must include the sampling rate and
        can optionally include the number of channels and the endianness of the audio.
        * `audio/alaw` (**Required.** Specify the sampling rate (`rate`) of the audio.)
        * `audio/basic` (**Required.** Use only with narrowband models.)
        * `audio/flac`
        * `audio/g729` (Use only with narrowband models.)
        * `audio/l16` (**Required.** Specify the sampling rate (`rate`) and optionally the
        number of channels (`channels`) and endianness (`endianness`) of the audio.)
        * `audio/mp3`
        * `audio/mpeg`
        * `audio/mulaw` (**Required.** Specify the sampling rate (`rate`) of the audio.)
        * `audio/ogg` (The service automatically detects the codec of the input audio.)
        * `audio/ogg;codecs=opus`
        * `audio/ogg;codecs=vorbis`
        * `audio/wav` (Provide audio with a maximum of nine channels.)
        * `audio/webm` (The service automatically detects the codec of the input audio.)
        * `audio/webm;codecs=opus`
        * `audio/webm;codecs=vorbis`
        The sampling rate of the audio must match the sampling rate of the model for the
        recognition request: for broadband models, at least 16 kHz; for narrowband models,
        at least 8 kHz. If the sampling rate of the audio is higher than the minimum
        required rate, the service down-samples the audio to the appropriate rate. If the
        sampling rate of the audio is lower than the minimum required rate, the request
        fails.
         **See also:** [Audio
        formats](https://cloud.ibm.com/docs/services/speech-to-text/audio-formats.html).
        ### Multipart speech recognition
         **Note:** The Watson SDKs do not support multipart speech recognition.
        The HTTP `POST` method of the service also supports multipart speech recognition.
        With multipart requests, you pass all audio data as multipart form data. You
        specify some parameters as request headers and query parameters, but you pass JSON
        metadata as form data to control most aspects of the transcription.
        The multipart approach is intended for use with browsers for which JavaScript is
        disabled or when the parameters used with the request are greater than the 8 KB
        limit imposed by most HTTP servers and proxies. You can encounter this limit, for
        example, if you want to spot a very large number of keywords.
        **See also:** [Making a multipart HTTP
        request](https://cloud.ibm.com/docs/services/speech-to-text/http.html#HTTP-multi).

        :param file audio: The audio to transcribe.
        :param str model: The identifier of the model that is to be used for the
        recognition request. See [Languages and
        models](https://cloud.ibm.com/docs/services/speech-to-text/models.html).
        :param str language_customization_id: The customization ID (GUID) of a custom
        language model that is to be used with the recognition request. The base model of
        the specified custom language model must match the model specified with the
        `model` parameter. You must make the request with credentials for the instance of
        the service that owns the custom model. By default, no custom language model is
        used. See [Custom
        models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom-input).
        **Note:** Use this parameter instead of the deprecated `customization_id`
        parameter.
        :param str acoustic_customization_id: The customization ID (GUID) of a custom
        acoustic model that is to be used with the recognition request. The base model of
        the specified custom acoustic model must match the model specified with the
        `model` parameter. You must make the request with credentials for the instance of
        the service that owns the custom model. By default, no custom acoustic model is
        used. See [Custom
        models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom-input).
        :param str base_model_version: The version of the specified base model that is to
        be used with recognition request. Multiple versions of a base model can exist when
        a model is updated for internal improvements. The parameter is intended primarily
        for use with custom models that have been upgraded for a new base model. The
        default value depends on whether the parameter is used with or without a custom
        model. See [Base model
        version](https://cloud.ibm.com/docs/services/speech-to-text/input.html#version).
        :param float customization_weight: If you specify the customization ID (GUID) of a
        custom language model with the recognition request, the customization weight tells
        the service how much weight to give to words from the custom language model
        compared to those from the base model for the current request.
        Specify a value between 0.0 and 1.0. Unless a different customization weight was
        specified for the custom model when it was trained, the default value is 0.3. A
        customization weight that you specify overrides a weight that was specified when
        the custom model was trained.
        The default value yields the best performance in general. Assign a higher value if
        your audio makes frequent use of OOV words from the custom model. Use caution when
        setting the weight: a higher value can improve the accuracy of phrases from the
        custom model's domain, but it can negatively affect performance on non-domain
        phrases.
        See [Custom
        models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom-input).
        :param int inactivity_timeout: The time in seconds after which, if only silence
        (no speech) is detected in streaming audio, the connection is closed with a 400
        error. The parameter is useful for stopping audio submission from a live
        microphone when a user simply walks away. Use `-1` for infinity. See [Inactivity
        timeout](https://cloud.ibm.com/docs/services/speech-to-text/input.html#timeouts-inactivity).
        :param list[str] keywords: An array of keyword strings to spot in the audio. Each
        keyword string can include one or more string tokens. Keywords are spotted only in
        the final results, not in interim hypotheses. If you specify any keywords, you
        must also specify a keywords threshold. You can spot a maximum of 1000 keywords.
        Omit the parameter or specify an empty array if you do not need to spot keywords.
        See [Keyword
        spotting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#keyword_spotting).
        :param float keywords_threshold: A confidence value that is the lower bound for
        spotting a keyword. A word is considered to match a keyword if its confidence is
        greater than or equal to the threshold. Specify a probability between 0.0 and 1.0.
        If you specify a threshold, you must also specify one or more keywords. The
        service performs no keyword spotting if you omit either parameter. See [Keyword
        spotting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#keyword_spotting).
        :param int max_alternatives: The maximum number of alternative transcripts that
        the service is to return. By default, the service returns a single transcript. If
        you specify a value of `0`, the service uses the default value, `1`. See [Maximum
        alternatives](https://cloud.ibm.com/docs/services/speech-to-text/output.html#max_alternatives).
        :param float word_alternatives_threshold: A confidence value that is the lower
        bound for identifying a hypothesis as a possible word alternative (also known as
        \"Confusion Networks\"). An alternative word is considered if its confidence is
        greater than or equal to the threshold. Specify a probability between 0.0 and 1.0.
        By default, the service computes no alternative words. See [Word
        alternatives](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_alternatives).
        :param bool word_confidence: If `true`, the service returns a confidence measure
        in the range of 0.0 to 1.0 for each word. By default, the service returns no word
        confidence scores. See [Word
        confidence](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_confidence).
        :param bool timestamps: If `true`, the service returns time alignment for each
        word. By default, no timestamps are returned. See [Word
        timestamps](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_timestamps).
        :param bool profanity_filter: If `true`, the service filters profanity from all
        output except for keyword results by replacing inappropriate words with a series
        of asterisks. Set the parameter to `false` to return results with no censoring.
        Applies to US English transcription only. See [Profanity
        filtering](https://cloud.ibm.com/docs/services/speech-to-text/output.html#profanity_filter).
        :param bool smart_formatting: If `true`, the service converts dates, times, series
        of digits and numbers, phone numbers, currency values, and internet addresses into
        more readable, conventional representations in the final transcript of a
        recognition request. For US English, the service also converts certain keyword
        strings to punctuation symbols. By default, the service performs no smart
        formatting.
        **Note:** Applies to US English, Japanese, and Spanish transcription only.
        See [Smart
        formatting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#smart_formatting).
        :param bool speaker_labels: If `true`, the response includes labels that identify
        which words were spoken by which participants in a multi-person exchange. By
        default, the service returns no speaker labels. Setting `speaker_labels` to `true`
        forces the `timestamps` parameter to be `true`, regardless of whether you specify
        `false` for the parameter.
        **Note:** Applies to US English, Japanese, and Spanish transcription only. To
        determine whether a language model supports speaker labels, you can also use the
        **Get a model** method and check that the attribute `speaker_labels` is set to
        `true`.
        See [Speaker
        labels](https://cloud.ibm.com/docs/services/speech-to-text/output.html#speaker_labels).
        :param str customization_id: **Deprecated.** Use the `language_customization_id`
        parameter to specify the customization ID (GUID) of a custom language model that
        is to be used with the recognition request. Do not specify both parameters with a
        request.
        :param str grammar_name: The name of a grammar that is to be used with the
        recognition request. If you specify a grammar, you must also use the
        `language_customization_id` parameter to specify the name of the custom language
        model for which the grammar is defined. The service recognizes only strings that
        are recognized by the specified grammar; it does not recognize other custom words
        from the model's words resource. See
        [Grammars](https://cloud.ibm.com/docs/services/speech-to-text/input.html#grammars-input).
        :param bool redaction: If `true`, the service redacts, or masks, numeric data from
        final transcripts. The feature redacts any number that has three or more
        consecutive digits by replacing each digit with an `X` character. It is intended
        to redact sensitive numeric data, such as credit card numbers. By default, the
        service performs no redaction.
        When you enable redaction, the service automatically enables smart formatting,
        regardless of whether you explicitly disable that feature. To ensure maximum
        security, the service also disables keyword spotting (ignores the `keywords` and
        `keywords_threshold` parameters) and returns only a single final transcript
        (forces the `max_alternatives` parameter to be `1`).
        **Note:** Applies to US English, Japanese, and Korean transcription only.
        See [Numeric
        redaction](https://cloud.ibm.com/docs/services/speech-to-text/output.html#redaction).
        :param str content_type: The format (MIME type) of the audio. For more information
        about specifying an audio format, see **Audio formats (content types)** in the
        method description.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if audio is None:
            raise ValueError('audio must be provided')

        headers = {'Content-Type': content_type}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('speech_to_text', 'V1', 'recognize')
        headers.update(sdk_headers)

        params = {
            'model': model,
            'language_customization_id': language_customization_id,
            'acoustic_customization_id': acoustic_customization_id,
            'base_model_version': base_model_version,
            'customization_weight': customization_weight,
            'inactivity_timeout': inactivity_timeout,
            'keywords': self._convert_list(keywords),
            'keywords_threshold': keywords_threshold,
            'max_alternatives': max_alternatives,
            'word_alternatives_threshold': word_alternatives_threshold,
            'word_confidence': word_confidence,
            'timestamps': timestamps,
            'profanity_filter': profanity_filter,
            'smart_formatting': smart_formatting,
            'speaker_labels': speaker_labels,
            'customization_id': customization_id,
            'grammar_name': grammar_name,
            'redaction': redaction
        }

        data = audio

        url = '/v1/recognize'
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            data=data,
            accept_json=True)
        return response


Instruction:
Can you generate the documentation for the following Python 3 function
def register_callback(self, callback_url, user_secret=None, **kwargs):

        if callback_url is None:
            raise ValueError('callback_url must be provided')

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

        params = {'callback_url': callback_url, 'user_secret': user_secret}

        url = '/v1/register_callback'
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            accept_json=True)
        return response

Response: Register a callback URL with the service.


Instruction:
How would you explain what the following Python 3 function does
def unregister_callback(self, callback_url, **kwargs):

        if callback_url is None:
            raise ValueError('callback_url must be provided')

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

        params = {'callback_url': callback_url}

        url = '/v1/unregister_callback'
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            accept_json=False)
        return response

Response: Unregisters a callback URL that was previously white - listed with a ** Register a callback** request for use with the asynchronous interface.


Instruction:
How would you implement a function in Python 3 that
creates a custom language model for a specified base model.

Response:
def create_language_model(self,
                              name,
                              base_model_name,
                              dialect=None,
                              description=None,
                              **kwargs):
        """
        Create a custom language model.

        Creates a new custom language model for a specified base model. The custom
        language model can be used only with the base model for which it is created. The
        model is owned by the instance of the service whose credentials are used to create
        it.
        **See also:** [Create a custom language
        model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#createModel-language).

        :param str name: A user-defined name for the new custom language model. Use a name
        that is unique among all custom language models that you own. Use a localized name
        that matches the language of the custom model. Use a name that describes the
        domain of the custom model, such as `Medical custom model` or `Legal custom
        model`.
        :param str base_model_name: The name of the base language model that is to be
        customized by the new custom language model. The new custom model can be used only
        with the base model that it customizes.
        To determine whether a base model supports language model customization, use the
        **Get a model** method and check that the attribute `custom_language_model` is set
        to `true`. You can also refer to [Language support for
        customization](https://cloud.ibm.com/docs/services/speech-to-text/custom.html#languageSupport).
        :param str dialect: The dialect of the specified language that is to be used with
        the custom language model. The parameter is meaningful only for Spanish models,
        for which the service creates a custom language model that is suited for speech in
        one of the following dialects:
        * `es-ES` for Castilian Spanish (the default)
        * `es-LA` for Latin American Spanish
        * `es-US` for North American (Mexican) Spanish
        A specified dialect must be valid for the base model. By default, the dialect
        matches the language of the base model; for example, `en-US` for either of the US
        English language models.
        :param str description: A description of the new custom language model. Use a
        localized description that matches the language of the custom model.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if name is None:
            raise ValueError('name must be provided')
        if base_model_name is None:
            raise ValueError('base_model_name must be provided')

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

        data = {
            'name': name,
            'base_model_name': base_model_name,
            'dialect': dialect,
            'description': description
        }

        url = '/v1/customizations'
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            json=data,
            accept_json=True)
        return response


Instruction:
Can you generate a brief explanation for the following Python 3 code
def list_language_models(self, language=None, **kwargs):

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

        params = {'language': language}

        url = '/v1/customizations'
        response = self.request(
            method='GET',
            url=url,
            headers=headers,
            params=params,
            accept_json=True)
        return response

Response: List custom language models.


Instruction:
Create a Python 3 function for
training a custom language model on the latest data.

Response:
def train_language_model(self,
                             customization_id,
                             word_type_to_add=None,
                             customization_weight=None,
                             **kwargs):
        """
        Train a custom language model.

        Initiates the training of a custom language model with new resources such as
        corpora, grammars, and custom words. After adding, modifying, or deleting
        resources for a custom language model, use this method to begin the actual
        training of the model on the latest data. You can specify whether the custom
        language model is to be trained with all words from its words resource or only
        with words that were added or modified by the user directly. You must use
        credentials for the instance of the service that owns a model to train it.
        The training method is asynchronous. It can take on the order of minutes to
        complete depending on the amount of data on which the service is being trained and
        the current load on the service. The method returns an HTTP 200 response code to
        indicate that the training process has begun.
        You can monitor the status of the training by using the **Get a custom language
        model** method to poll the model's status. Use a loop to check the status every 10
        seconds. The method returns a `LanguageModel` object that includes `status` and
        `progress` fields. A status of `available` means that the custom model is trained
        and ready to use. The service cannot accept subsequent training requests or
        requests to add new resources until the existing request completes.
        Training can fail to start for the following reasons:
        * The service is currently handling another request for the custom model, such as
        another training request or a request to add a corpus or grammar to the model.
        * No training data have been added to the custom model.
        * One or more words that were added to the custom model have invalid sounds-like
        pronunciations that you must fix.
        **See also:** [Train the custom language
        model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#trainModel-language).

        :param str customization_id: The customization ID (GUID) of the custom language
        model that is to be used for the request. You must make the request with
        credentials for the instance of the service that owns the custom model.
        :param str word_type_to_add: The type of words from the custom language model's
        words resource on which to train the model:
        * `all` (the default) trains the model on all new words, regardless of whether
        they were extracted from corpora or grammars or were added or modified by the
        user.
        * `user` trains the model only on new words that were added or modified by the
        user directly. The model is not trained on new words extracted from corpora or
        grammars.
        :param float customization_weight: Specifies a customization weight for the custom
        language model. The customization weight tells the service how much weight to give
        to words from the custom language model compared to those from the base model for
        speech recognition. Specify a value between 0.0 and 1.0; the default is 0.3.
        The default value yields the best performance in general. Assign a higher value if
        your audio makes frequent use of OOV words from the custom model. Use caution when
        setting the weight: a higher value can improve the accuracy of phrases from the
        custom model's domain, but it can negatively affect performance on non-domain
        phrases.
        The value that you assign is used for all recognition requests that use the model.
        You can override it for any recognition request by specifying a customization
        weight for that request.
        :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')

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

        params = {
            'word_type_to_add': word_type_to_add,
            'customization_weight': customization_weight
        }

        url = '/v1/customizations/{0}/train'.format(
            *self._encode_path_vars(customization_id))
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            accept_json=True)
        return response


Instruction:
How would you implement a function in Python 3 that
adds a corpus to the custom language model.

Response:
def add_corpus(self,
                   customization_id,
                   corpus_name,
                   corpus_file,
                   allow_overwrite=None,
                   **kwargs):
        """
        Add a corpus.

        Adds a single corpus text file of new training data to a custom language model.
        Use multiple requests to submit multiple corpus text files. You must use
        credentials for the instance of the service that owns a model to add a corpus to
        it. Adding a corpus does not affect the custom language model until you train the
        model for the new data by using the **Train a custom language model** method.
        Submit a plain text file that contains sample sentences from the domain of
        interest to enable the service to extract words in context. The more sentences you
        add that represent the context in which speakers use words from the domain, the
        better the service's recognition accuracy.
        The call returns an HTTP 201 response code if the corpus is valid. The service
        then asynchronously processes the contents of the corpus and automatically
        extracts new words that it finds. This can take on the order of a minute or two to
        complete depending on the total number of words and the number of new words in the
        corpus, as well as the current load on the service. You cannot submit requests to
        add additional resources to the custom model or to train the model until the
        service's analysis of the corpus for the current request completes. Use the **List
        a corpus** method to check the status of the analysis.
        The service auto-populates the model's words resource with words from the corpus
        that are not found in its base vocabulary. These are referred to as
        out-of-vocabulary (OOV) words. You can use the **List custom words** method to
        examine the words resource. You can use other words method to eliminate typos and
        modify how words are pronounced as needed.
        To add a corpus file that has the same name as an existing corpus, set the
        `allow_overwrite` parameter to `true`; otherwise, the request fails. Overwriting
        an existing corpus causes the service to process the corpus text file and extract
        OOV words anew. Before doing so, it removes any OOV words associated with the
        existing corpus from the model's words resource unless they were also added by
        another corpus or grammar, or they have been modified in some way with the **Add
        custom words** or **Add a custom word** method.
        The service limits the overall amount of data that you can add to a custom model
        to a maximum of 10 million total words from all sources combined. Also, you can
        add no more than 30 thousand custom (OOV) words to a model. This includes words
        that the service extracts from corpora and grammars, and words that you add
        directly.
        **See also:**
        * [Working with
        corpora](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#workingCorpora)
        * [Add corpora to the custom language
        model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#addCorpora).

        :param str customization_id: The customization ID (GUID) of the custom language
        model that is to be used for the request. You must make the request with
        credentials for the instance of the service that owns the custom model.
        :param str corpus_name: The name of the new corpus for the custom language model.
        Use a localized name that matches the language of the custom model and reflects
        the contents of the corpus.
        * Include a maximum of 128 characters in the name.
        * Do not include spaces, slashes, or backslashes in the name.
        * Do not use the name of an existing corpus or grammar that is already defined for
        the custom model.
        * Do not use the name `user`, which is reserved by the service to denote custom
        words that are added or modified by the user.
        :param file corpus_file: A plain text file that contains the training data for the
        corpus. Encode the file in UTF-8 if it contains non-ASCII characters; the service
        assumes UTF-8 encoding if it encounters non-ASCII characters.
        Make sure that you know the character encoding of the file. You must use that
        encoding when working with the words in the custom language model. For more
        information, see [Character
        encoding](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#charEncoding).
        With the `curl` command, use the `--data-binary` option to upload the file for the
        request.
        :param bool allow_overwrite: If `true`, the specified corpus overwrites an
        existing corpus with the same name. If `false`, the request fails if a corpus with
        the same name already exists. The parameter has no effect if a corpus with the
        same name does not already exist.
        :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 corpus_name is None:
            raise ValueError('corpus_name must be provided')
        if corpus_file is None:
            raise ValueError('corpus_file must be provided')

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

        params = {'allow_overwrite': allow_overwrite}

        form_data = {}
        form_data['corpus_file'] = (None, corpus_file, 'text/plain')

        url = '/v1/customizations/{0}/corpora/{1}'.format(
            *self._encode_path_vars(customization_id, corpus_name))
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            files=form_data,
            accept_json=True)
        return response


Instruction:
Make a summary of the following Python 3 code
def add_word(self,
                 customization_id,
                 word_name,
                 word=None,
                 sounds_like=None,
                 display_as=None,
                 **kwargs):
        """
        Add a custom word.

        Adds a custom word to a custom language model. The service populates the words
        resource for a custom model with out-of-vocabulary (OOV) words from each corpus or
        grammar that is added to the model. You can use this method to add a word or to
        modify an existing word in the words resource. The words resource for a model can
        contain a maximum of 30 thousand custom (OOV) words. This includes words that the
        service extracts from corpora and grammars and words that you add directly.
        You must use credentials for the instance of the service that owns a model to add
        or modify a custom word for the model. Adding or modifying a custom word does not
        affect the custom model until you train the model for the new data by using the
        **Train a custom language model** method.
        Use the `word_name` parameter to specify the custom word that is to be added or
        modified. Use the `CustomWord` object to provide one or both of the optional
        `sounds_like` and `display_as` fields for the word.
        * The `sounds_like` field provides an array of one or more pronunciations for the
        word. Use the parameter to specify how the word can be pronounced by users. Use
        the parameter for words that are difficult to pronounce, foreign words, acronyms,
        and so on. For example, you might specify that the word `IEEE` can sound like `i
        triple e`. You can specify a maximum of five sounds-like pronunciations for a
        word.
        * The `display_as` field provides a different way of spelling the word in a
        transcript. Use the parameter when you want the word to appear different from its
        usual representation or from its spelling in training data. For example, you might
        indicate that the word `IBM(trademark)` is to be displayed as `IBM™`.
        If you add a custom word that already exists in the words resource for the custom
        model, the new definition overwrites the existing data for the word. If the
        service encounters an error, it does not add the word to the words resource. Use
        the **List a custom word** method to review the word that you add.
        **See also:**
        * [Working with custom
        words](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#workingWords)
        * [Add words to the custom language
        model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#addWords).

        :param str customization_id: The customization ID (GUID) of the custom language
        model that is to be used for the request. You must make the request with
        credentials for the instance of the service that owns the custom model.
        :param str word_name: The custom word that is to be added to or updated in the
        custom language model. Do not include spaces in the word. Use a `-` (dash) or `_`
        (underscore) to connect the tokens of compound words. URL-encode the word if it
        includes non-ASCII characters. For more information, see [Character
        encoding](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#charEncoding).
        :param str word: For the **Add custom words** method, you must specify the custom
        word that is to be added to or updated in the custom model. Do not include spaces
        in the word. Use a `-` (dash) or `_` (underscore) to connect the tokens of
        compound words.
        Omit this parameter for the **Add a custom word** method.
        :param list[str] sounds_like: An array of sounds-like pronunciations for the
        custom word. Specify how words that are difficult to pronounce, foreign words,
        acronyms, and so on can be pronounced by users.
        * For a word that is not in the service's base vocabulary, omit the parameter to
        have the service automatically generate a sounds-like pronunciation for the word.
        * For a word that is in the service's base vocabulary, use the parameter to
        specify additional pronunciations for the word. You cannot override the default
        pronunciation of a word; pronunciations you add augment the pronunciation from the
        base vocabulary.
        A word can have at most five sounds-like pronunciations. A pronunciation can
        include at most 40 characters not including spaces.
        :param str display_as: An alternative spelling for the custom word when it appears
        in a transcript. Use the parameter when you want the word to have a spelling that
        is different from its usual representation or from its spelling in corpora
        training data.
        :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_name is None:
            raise ValueError('word_name must be provided')

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

        data = {
            'word': word,
            'sounds_like': sounds_like,
            'display_as': display_as
        }

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

Response: Add a custom word to the custom language model.


Instruction:
Can you create a Python 3 function that
adds a grammar to a custom language model.

Response:
def add_grammar(self,
                    customization_id,
                    grammar_name,
                    grammar_file,
                    content_type,
                    allow_overwrite=None,
                    **kwargs):
        """
        Add a grammar.

        Adds a single grammar file to a custom language model. Submit a plain text file in
        UTF-8 format that defines the grammar. Use multiple requests to submit multiple
        grammar files. You must use credentials for the instance of the service that owns
        a model to add a grammar to it. Adding a grammar does not affect the custom
        language model until you train the model for the new data by using the **Train a
        custom language model** method.
        The call returns an HTTP 201 response code if the grammar is valid. The service
        then asynchronously processes the contents of the grammar and automatically
        extracts new words that it finds. This can take a few seconds to complete
        depending on the size and complexity of the grammar, as well as the current load
        on the service. You cannot submit requests to add additional resources to the
        custom model or to train the model until the service's analysis of the grammar for
        the current request completes. Use the **Get a grammar** method to check the
        status of the analysis.
        The service populates the model's words resource with any word that is recognized
        by the grammar that is not found in the model's base vocabulary. These are
        referred to as out-of-vocabulary (OOV) words. You can use the **List custom
        words** method to examine the words resource and use other words-related methods
        to eliminate typos and modify how words are pronounced as needed.
        To add a grammar that has the same name as an existing grammar, set the
        `allow_overwrite` parameter to `true`; otherwise, the request fails. Overwriting
        an existing grammar causes the service to process the grammar file and extract OOV
        words anew. Before doing so, it removes any OOV words associated with the existing
        grammar from the model's words resource unless they were also added by another
        resource or they have been modified in some way with the **Add custom words** or
        **Add a custom word** method.
        The service limits the overall amount of data that you can add to a custom model
        to a maximum of 10 million total words from all sources combined. Also, you can
        add no more than 30 thousand OOV words to a model. This includes words that the
        service extracts from corpora and grammars and words that you add directly.
        **See also:**
        * [Working with grammars](https://cloud.ibm.com/docs/services/speech-to-text/)
        * [Add grammars to the custom language
        model](https://cloud.ibm.com/docs/services/speech-to-text/).

        :param str customization_id: The customization ID (GUID) of the custom language
        model that is to be used for the request. You must make the request with
        credentials for the instance of the service that owns the custom model.
        :param str grammar_name: The name of the new grammar for the custom language
        model. Use a localized name that matches the language of the custom model and
        reflects the contents of the grammar.
        * Include a maximum of 128 characters in the name.
        * Do not include spaces, slashes, or backslashes in the name.
        * Do not use the name of an existing grammar or corpus that is already defined for
        the custom model.
        * Do not use the name `user`, which is reserved by the service to denote custom
        words that are added or modified by the user.
        :param str grammar_file: A plain text file that contains the grammar in the format
        specified by the `Content-Type` header. Encode the file in UTF-8 (ASCII is a
        subset of UTF-8). Using any other encoding can lead to issues when compiling the
        grammar or to unexpected results in decoding. The service ignores an encoding that
        is specified in the header of the grammar.
        :param str content_type: The format (MIME type) of the grammar file:
        * `application/srgs` for Augmented Backus-Naur Form (ABNF), which uses a
        plain-text representation that is similar to traditional BNF grammars.
        * `application/srgs+xml` for XML Form, which uses XML elements to represent the
        grammar.
        :param bool allow_overwrite: If `true`, the specified grammar overwrites an
        existing grammar with the same name. If `false`, the request fails if a grammar
        with the same name already exists. The parameter has no effect if a grammar with
        the same name does not already exist.
        :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 grammar_name is None:
            raise ValueError('grammar_name must be provided')
        if grammar_file is None:
            raise ValueError('grammar_file must be provided')
        if content_type is None:
            raise ValueError('content_type must be provided')

        headers = {'Content-Type': content_type}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('speech_to_text', 'V1', 'add_grammar')
        headers.update(sdk_headers)

        params = {'allow_overwrite': allow_overwrite}

        data = grammar_file

        url = '/v1/customizations/{0}/grammars/{1}'.format(
            *self._encode_path_vars(customization_id, grammar_name))
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            data=data,
            accept_json=True)
        return response


Instruction:
Write a Python 3 script to
add an audio resource to the acoustic model.

Response:
def add_audio(self,
                  customization_id,
                  audio_name,
                  audio_resource,
                  contained_content_type=None,
                  allow_overwrite=None,
                  content_type=None,
                  **kwargs):
        """
        Add an audio resource.

        Adds an audio resource to a custom acoustic model. Add audio content that reflects
        the acoustic characteristics of the audio that you plan to transcribe. You must
        use credentials for the instance of the service that owns a model to add an audio
        resource to it. Adding audio data does not affect the custom acoustic model until
        you train the model for the new data by using the **Train a custom acoustic
        model** method.
        You can add individual audio files or an archive file that contains multiple audio
        files. Adding multiple audio files via a single archive file is significantly more
        efficient than adding each file individually. You can add audio resources in any
        format that the service supports for speech recognition.
        You can use this method to add any number of audio resources to a custom model by
        calling the method once for each audio or archive file. But the addition of one
        audio resource must be fully complete before you can add another. You must add a
        minimum of 10 minutes and a maximum of 100 hours of audio that includes speech,
        not just silence, to a custom acoustic model before you can train it. No audio
        resource, audio- or archive-type, can be larger than 100 MB. To add an audio
        resource that has the same name as an existing audio resource, set the
        `allow_overwrite` parameter to `true`; otherwise, the request fails.
        The method is asynchronous. It can take several seconds to complete depending on
        the duration of the audio and, in the case of an archive file, the total number of
        audio files being processed. The service returns a 201 response code if the audio
        is valid. It then asynchronously analyzes the contents of the audio file or files
        and automatically extracts information about the audio such as its length,
        sampling rate, and encoding. You cannot submit requests to add additional audio
        resources to a custom acoustic model, or to train the model, until the service's
        analysis of all audio files for the current request completes.
        To determine the status of the service's analysis of the audio, use the **Get an
        audio resource** method to poll the status of the audio. The method accepts the
        customization ID of the custom model and the name of the audio resource, and it
        returns the status of the resource. Use a loop to check the status of the audio
        every few seconds until it becomes `ok`.
        **See also:** [Add audio to the custom acoustic
        model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-create.html#addAudio).
        ### Content types for audio-type resources
         You can add an individual audio file in any format that the service supports for
        speech recognition. For an audio-type resource, use the `Content-Type` parameter
        to specify the audio format (MIME type) of the audio file, including specifying
        the sampling rate, channels, and endianness where indicated.
        * `audio/alaw` (Specify the sampling rate (`rate`) of the audio.)
        * `audio/basic` (Use only with narrowband models.)
        * `audio/flac`
        * `audio/g729` (Use only with narrowband models.)
        * `audio/l16` (Specify the sampling rate (`rate`) and optionally the number of
        channels (`channels`) and endianness (`endianness`) of the audio.)
        * `audio/mp3`
        * `audio/mpeg`
        * `audio/mulaw` (Specify the sampling rate (`rate`) of the audio.)
        * `audio/ogg` (The service automatically detects the codec of the input audio.)
        * `audio/ogg;codecs=opus`
        * `audio/ogg;codecs=vorbis`
        * `audio/wav` (Provide audio with a maximum of nine channels.)
        * `audio/webm` (The service automatically detects the codec of the input audio.)
        * `audio/webm;codecs=opus`
        * `audio/webm;codecs=vorbis`
        The sampling rate of an audio file must match the sampling rate of the base model
        for the custom model: for broadband models, at least 16 kHz; for narrowband
        models, at least 8 kHz. If the sampling rate of the audio is higher than the
        minimum required rate, the service down-samples the audio to the appropriate rate.
        If the sampling rate of the audio is lower than the minimum required rate, the
        service labels the audio file as `invalid`.
         **See also:** [Audio
        formats](https://cloud.ibm.com/docs/services/speech-to-text/audio-formats.html).
        ### Content types for archive-type resources
         You can add an archive file (**.zip** or **.tar.gz** file) that contains audio
        files in any format that the service supports for speech recognition. For an
        archive-type resource, use the `Content-Type` parameter to specify the media type
        of the archive file:
        * `application/zip` for a **.zip** file
        * `application/gzip` for a **.tar.gz** file.
        When you add an archive-type resource, the `Contained-Content-Type` header is
        optional depending on the format of the files that you are adding:
        * For audio files of type `audio/alaw`, `audio/basic`, `audio/l16`, or
        `audio/mulaw`, you must use the `Contained-Content-Type` header to specify the
        format of the contained audio files. Include the `rate`, `channels`, and
        `endianness` parameters where necessary. In this case, all audio files contained
        in the archive file must have the same audio format.
        * For audio files of all other types, you can omit the `Contained-Content-Type`
        header. In this case, the audio files contained in the archive file can have any
        of the formats not listed in the previous bullet. The audio files do not need to
        have the same format.
        Do not use the `Contained-Content-Type` header when adding an audio-type resource.
        ### Naming restrictions for embedded audio files
         The name of an audio file that is embedded within an archive-type resource must
        meet the following restrictions:
        * Include a maximum of 128 characters in the file name; this includes the file
        extension.
        * Do not include spaces, slashes, or backslashes in the file name.
        * Do not use the name of an audio file that has already been added to the custom
        model as part of an archive-type resource.

        :param str customization_id: The customization ID (GUID) of the custom acoustic
        model that is to be used for the request. You must make the request with
        credentials for the instance of the service that owns the custom model.
        :param str audio_name: The name of the new audio resource for the custom acoustic
        model. Use a localized name that matches the language of the custom model and
        reflects the contents of the resource.
        * Include a maximum of 128 characters in the name.
        * Do not include spaces, slashes, or backslashes in the name.
        * Do not use the name of an audio resource that has already been added to the
        custom model.
        :param file audio_resource: The audio resource that is to be added to the custom
        acoustic model, an individual audio file or an archive file.
        :param str contained_content_type: **For an archive-type resource,** specify the
        format of the audio files that are contained in the archive file if they are of
        type `audio/alaw`, `audio/basic`, `audio/l16`, or `audio/mulaw`. Include the
        `rate`, `channels`, and `endianness` parameters where necessary. In this case, all
        audio files that are contained in the archive file must be of the indicated type.
        For all other audio formats, you can omit the header. In this case, the audio
        files can be of multiple types as long as they are not of the types listed in the
        previous paragraph.
        The parameter accepts all of the audio formats that are supported for use with
        speech recognition. For more information, see **Content types for audio-type
        resources** in the method description.
        **For an audio-type resource,** omit the header.
        :param bool allow_overwrite: If `true`, the specified audio resource overwrites an
        existing audio resource with the same name. If `false`, the request fails if an
        audio resource with the same name already exists. The parameter has no effect if
        an audio resource with the same name does not already exist.
        :param str content_type: For an audio-type resource, the format (MIME type) of the
        audio. For more information, see **Content types for audio-type resources** in the
        method description.
        For an archive-type resource, the media type of the archive file. For more
        information, see **Content types for archive-type resources** in the method
        description.
        :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 audio_name is None:
            raise ValueError('audio_name must be provided')
        if audio_resource is None:
            raise ValueError('audio_resource must be provided')

        headers = {
            'Contained-Content-Type': contained_content_type,
            'Content-Type': content_type
        }
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('speech_to_text', 'V1', 'add_audio')
        headers.update(sdk_headers)

        params = {'allow_overwrite': allow_overwrite}

        data = audio_resource

        url = '/v1/acoustic_customizations/{0}/audio/{1}'.format(
            *self._encode_path_vars(customization_id, audio_name))
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            data=data,
            accept_json=True)
        return response


Instruction:
Create a Python 3 function for
returning a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self,
                   'customization_id') and self.customization_id is not None:
            _dict['customization_id'] = self.customization_id
        if hasattr(self, 'created') and self.created is not None:
            _dict['created'] = self.created
        if hasattr(self, 'language') and self.language is not None:
            _dict['language'] = self.language
        if hasattr(self, 'versions') and self.versions is not None:
            _dict['versions'] = self.versions
        if hasattr(self, 'owner') and self.owner is not None:
            _dict['owner'] = self.owner
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        if hasattr(self, 'description') and self.description is not None:
            _dict['description'] = self.description
        if hasattr(self,
                   'base_model_name') and self.base_model_name is not None:
            _dict['base_model_name'] = self.base_model_name
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        if hasattr(self, 'progress') and self.progress is not None:
            _dict['progress'] = self.progress
        if hasattr(self, 'warnings') and self.warnings is not None:
            _dict['warnings'] = self.warnings
        return _dict


Instruction:
Make a summary of the following Python 3 code
def _from_dict(cls, _dict):
        args = {}
        if 'customizations' in _dict:
            args['customizations'] = [
                AcousticModel._from_dict(x)
                for x in (_dict.get('customizations'))
            ]
        else:
            raise ValueError(
                'Required property \'customizations\' not present in AcousticModels JSON'
            )
        return cls(**args)

Response: Initialize a AcousticModels object from a json dictionary.


Instruction:
Given the following Python 3 function, write the documentation
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'customizations') and self.customizations is not None:
            _dict['customizations'] = [
                x._to_dict() for x in self.customizations
            ]
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
How would you implement a function in Python 3 that
returns a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'type') and self.type is not None:
            _dict['type'] = self.type
        if hasattr(self, 'codec') and self.codec is not None:
            _dict['codec'] = self.codec
        if hasattr(self, 'frequency') and self.frequency is not None:
            _dict['frequency'] = self.frequency
        if hasattr(self, 'compression') and self.compression is not None:
            _dict['compression'] = self.compression
        return _dict


Instruction:
Can you generate a brief explanation for the following Python 3 code
def _from_dict(cls, _dict):
        args = {}
        if 'duration' in _dict:
            args['duration'] = _dict.get('duration')
        if 'name' in _dict:
            args['name'] = _dict.get('name')
        if 'details' in _dict:
            args['details'] = AudioDetails._from_dict(_dict.get('details'))
        if 'status' in _dict:
            args['status'] = _dict.get('status')
        if 'container' in _dict:
            args['container'] = AudioResource._from_dict(_dict.get('container'))
        if 'audio' in _dict:
            args['audio'] = [
                AudioResource._from_dict(x) for x in (_dict.get('audio'))
            ]
        return cls(**args)

Response: Initialize a AudioListing object from a json dictionary.


Instruction:
Write a Python 3 function for
returning a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'duration') and self.duration is not None:
            _dict['duration'] = self.duration
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        if hasattr(self, 'details') and self.details is not None:
            _dict['details'] = self.details._to_dict()
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        if hasattr(self, 'container') and self.container is not None:
            _dict['container'] = self.container._to_dict()
        if hasattr(self, 'audio') and self.audio is not None:
            _dict['audio'] = [x._to_dict() for x in self.audio]
        return _dict


Instruction:
How would you implement a function in Python 3 that
returns a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'duration') and self.duration is not None:
            _dict['duration'] = self.duration
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        if hasattr(self, 'details') and self.details is not None:
            _dict['details'] = self.details._to_dict()
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        return _dict


Instruction:
How would you explain what the following Python 3 function does
def _from_dict(cls, _dict):
        args = {}
        if 'total_minutes_of_audio' in _dict:
            args['total_minutes_of_audio'] = _dict.get('total_minutes_of_audio')
        else:
            raise ValueError(
                'Required property \'total_minutes_of_audio\' not present in AudioResources JSON'
            )
        if 'audio' in _dict:
            args['audio'] = [
                AudioResource._from_dict(x) for x in (_dict.get('audio'))
            ]
        else:
            raise ValueError(
                'Required property \'audio\' not present in AudioResources JSON'
            )
        return cls(**args)

Response: Initialize a AudioResources object from a json dictionary.


Instruction:
Can you write a function in Python 3 where it
returns a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'total_minutes_of_audio'
                  ) and self.total_minutes_of_audio is not None:
            _dict['total_minutes_of_audio'] = self.total_minutes_of_audio
        if hasattr(self, 'audio') and self.audio is not None:
            _dict['audio'] = [x._to_dict() for x in self.audio]
        return _dict


Instruction:
Implement a Python 3 function for
initializing a Corpora object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a Corpora object from a json dictionary."""
        args = {}
        if 'corpora' in _dict:
            args['corpora'] = [
                Corpus._from_dict(x) for x in (_dict.get('corpora'))
            ]
        else:
            raise ValueError(
                'Required property \'corpora\' not present in Corpora JSON')
        return cls(**args)


Instruction:
Explain what the following Python 3 code does
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'corpora') and self.corpora is not None:
            _dict['corpora'] = [x._to_dict() for x in self.corpora]
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'word') and self.word is not None:
            _dict['word'] = self.word
        if hasattr(self, 'sounds_like') and self.sounds_like is not None:
            _dict['sounds_like'] = self.sounds_like
        if hasattr(self, 'display_as') and self.display_as is not None:
            _dict['display_as'] = self.display_as
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
How would you code a function in Python 3 to
return a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        if hasattr(self, 'out_of_vocabulary_words'
                  ) and self.out_of_vocabulary_words is not None:
            _dict['out_of_vocabulary_words'] = self.out_of_vocabulary_words
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        if hasattr(self, 'error') and self.error is not None:
            _dict['error'] = self.error
        return _dict


Instruction:
Can you generate a brief explanation for the following Python 3 code
def _from_dict(cls, _dict):
        args = {}
        if 'grammars' in _dict:
            args['grammars'] = [
                Grammar._from_dict(x) for x in (_dict.get('grammars'))
            ]
        else:
            raise ValueError(
                'Required property \'grammars\' not present in Grammars JSON')
        return cls(**args)

Response: Initialize a Grammars object from a json dictionary.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'grammars') and self.grammars is not None:
            _dict['grammars'] = [x._to_dict() for x in self.grammars]
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Create a Python 3 function to
return a json dictionary representing this model.

Response:
def _to_dict(self):
        """Return a json dictionary representing this model."""
        _dict = {}
        if hasattr(self,
                   'normalized_text') and self.normalized_text is not None:
            _dict['normalized_text'] = self.normalized_text
        if hasattr(self, 'start_time') and self.start_time is not None:
            _dict['start_time'] = self.start_time
        if hasattr(self, 'end_time') and self.end_time is not None:
            _dict['end_time'] = self.end_time
        if hasattr(self, 'confidence') and self.confidence is not None:
            _dict['confidence'] = self.confidence
        return _dict


Instruction:
How would you explain what the following Python 3 function does
def _from_dict(cls, _dict):
        args = {}
        if 'customizations' in _dict:
            args['customizations'] = [
                LanguageModel._from_dict(x)
                for x in (_dict.get('customizations'))
            ]
        else:
            raise ValueError(
                'Required property \'customizations\' not present in LanguageModels JSON'
            )
        return cls(**args)

Response: Initialize a LanguageModels object from a json dictionary.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def _from_dict(cls, _dict):
        args = {}
        if 'id' in _dict:
            args['id'] = _dict.get('id')
        else:
            raise ValueError(
                'Required property \'id\' not present in RecognitionJob JSON')
        if 'status' in _dict:
            args['status'] = _dict.get('status')
        else:
            raise ValueError(
                'Required property \'status\' not present in RecognitionJob JSON'
            )
        if 'created' in _dict:
            args['created'] = _dict.get('created')
        else:
            raise ValueError(
                'Required property \'created\' not present in RecognitionJob JSON'
            )
        if 'updated' in _dict:
            args['updated'] = _dict.get('updated')
        if 'url' in _dict:
            args['url'] = _dict.get('url')
        if 'user_token' in _dict:
            args['user_token'] = _dict.get('user_token')
        if 'results' in _dict:
            args['results'] = [
                SpeechRecognitionResults._from_dict(x)
                for x in (_dict.get('results'))
            ]
        if 'warnings' in _dict:
            args['warnings'] = _dict.get('warnings')
        return cls(**args)

Response: Initialize a RecognitionJob object from a json dictionary.


Instruction:
Can you generate the documentation for the following Python 3 function
def _to_dict(self):
        _dict = {}
        if hasattr(self, 'id') and self.id is not None:
            _dict['id'] = self.id
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        if hasattr(self, 'created') and self.created is not None:
            _dict['created'] = self.created
        if hasattr(self, 'updated') and self.updated is not None:
            _dict['updated'] = self.updated
        if hasattr(self, 'url') and self.url is not None:
            _dict['url'] = self.url
        if hasattr(self, 'user_token') and self.user_token is not None:
            _dict['user_token'] = self.user_token
        if hasattr(self, 'results') and self.results is not None:
            _dict['results'] = [x._to_dict() for x in self.results]
        if hasattr(self, 'warnings') and self.warnings is not None:
            _dict['warnings'] = self.warnings
        return _dict

Response: Return a json dictionary representing this model.


Instruction:
Create a Python 3 function for
initializing a RecognitionJobs object from a json dictionary.

Response:
def _from_dict(cls, _dict):
        """Initialize a RecognitionJobs object from a json dictionary."""
        args = {}
        if 'recognitions' in _dict:
            args['recognitions'] = [
                RecognitionJob._from_dict(x)
                for x in (_dict.get('recognitions'))
            ]
        else:
            raise ValueError(
                'Required property \'recognitions\' not present in RecognitionJobs JSON'
            )
        return cls(**args)