Skip to content

Commit 6b2f7da

Browse files
committed
chore(stt): regenerate speech to text
1 parent ebdff64 commit 6b2f7da

File tree

1 file changed

+61
-37
lines changed

1 file changed

+61
-37
lines changed

ibm_watson/speech_to_text_v1.py

Lines changed: 61 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,8 +1249,9 @@ def train_language_model(self,
12491249
* No training data have been added to the custom model.
12501250
* The custom model contains one or more invalid corpora, grammars, or words (for
12511251
example, a custom word has an invalid sounds-like pronunciation). You can correct
1252-
the invalid resources. The model must contain at least one valid resource for training
1253-
to succeed.
1252+
the invalid resources or set the `strict` parameter to `false` to exclude the
1253+
invalid resources from the training. The model must contain at least one valid
1254+
resource for training to succeed.
12541255
12551256
:param str customization_id: The customization ID (GUID) of the custom language
12561257
model that is to be used for the request. You must make the request with
@@ -1481,11 +1482,17 @@ def add_corpus(self,
14811482
Use a localized name that matches the language of the custom model and reflects
14821483
the contents of the corpus.
14831484
* Include a maximum of 128 characters in the name.
1484-
* Do not include spaces, slashes, or backslashes in the name.
1485+
* Do not use characters that need to be URL-encoded. For example, do not use
1486+
spaces, slashes, backslashes, colons, ampersands, double quotes, plus signs,
1487+
equals signs, questions marks, and so on in the name. (The service does not
1488+
prevent the use of these characters. But because they must be URL-encoded wherever
1489+
used, their use is strongly discouraged.)
14851490
* Do not use the name of an existing corpus or grammar that is already defined for
14861491
the custom model.
14871492
* Do not use the name `user`, which is reserved by the service to denote custom
14881493
words that are added or modified by the user.
1494+
* Do not use the name `base_lm` or `default_lm`. Both names are reserved for
1495+
future use by the service.
14891496
:param file corpus_file: A plain text file that contains the training data for the
14901497
corpus. Encode the file in UTF-8 if it contains non-ASCII characters; the service
14911498
assumes UTF-8 encoding if it encounters non-ASCII characters.
@@ -1644,7 +1651,7 @@ def list_words(self, customization_id, word_type=None, sort=None, **kwargs):
16441651
descending order. By default, words are sorted in ascending alphabetical order.
16451652
For alphabetical ordering, the lexicographical precedence is numeric values,
16461653
uppercase letters, and lowercase letters. For count ordering, values with the same
1647-
count are ordered alphabetically. With the `curl` command, URL encode the `+`
1654+
count are ordered alphabetically. With the `curl` command, URL-encode the `+`
16481655
symbol as `%2B`.
16491656
:param dict headers: A `dict` containing the request headers
16501657
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
@@ -2032,11 +2039,17 @@ def add_grammar(self,
20322039
model. Use a localized name that matches the language of the custom model and
20332040
reflects the contents of the grammar.
20342041
* Include a maximum of 128 characters in the name.
2035-
* Do not include spaces, slashes, or backslashes in the name.
2042+
* Do not use characters that need to be URL-encoded. For example, do not use
2043+
spaces, slashes, backslashes, colons, ampersands, double quotes, plus signs,
2044+
equals signs, questions marks, and so on in the name. (The service does not
2045+
prevent the use of these characters. But because they must be URL-encoded wherever
2046+
used, their use is strongly discouraged.)
20362047
* Do not use the name of an existing grammar or corpus that is already defined for
20372048
the custom model.
20382049
* Do not use the name `user`, which is reserved by the service to denote custom
20392050
words that are added or modified by the user.
2051+
* Do not use the name `base_lm` or `default_lm`. Both names are reserved for
2052+
future use by the service.
20402053
:param str grammar_file: A plain text file that contains the grammar in the format
20412054
specified by the `Content-Type` header. Encode the file in UTF-8 (ASCII is a
20422055
subset of UTF-8). Using any other encoding can lead to issues when compiling the
@@ -2360,8 +2373,10 @@ def train_acoustic_model(self,
23602373
model** method to poll the model's status. Use a loop to check the status once a
23612374
minute. The method returns an `AcousticModel` object that includes `status` and
23622375
`progress` fields. A status of `available` indicates that the custom model is
2363-
trained and ready to use. The service cannot accept subsequent training requests,
2364-
or requests to add new audio resources, until the existing request completes.
2376+
trained and ready to use. The service cannot train a model while it is handling
2377+
another request for the model. The service cannot accept subsequent training
2378+
requests, or requests to add new audio resources, until the existing training
2379+
request completes.
23652380
You can use the optional `custom_language_model_id` parameter to specify the GUID
23662381
of a separately created custom language model that is to be used during training.
23672382
Train with a custom language model if you have verbatim transcriptions of the
@@ -2384,7 +2399,8 @@ def train_acoustic_model(self,
23842399
`custom_language_model_id` query parameter. Both custom models must be based on
23852400
the same version of the same base model.
23862401
* The custom model contains one or more invalid audio resources. You can correct
2387-
the invalid audio resources. The model must contain at least one valid
2402+
the invalid audio resources or set the `strict` parameter to `false` to exclude
2403+
the invalid resources from the training. The model must contain at least one valid
23882404
resource for training to succeed.
23892405
23902406
:param str customization_id: The customization ID (GUID) of the custom acoustic
@@ -2412,9 +2428,7 @@ def train_acoustic_model(self,
24122428
'train_acoustic_model')
24132429
headers.update(sdk_headers)
24142430

2415-
params = {
2416-
'custom_language_model_id': custom_language_model_id
2417-
}
2431+
params = {'custom_language_model_id': custom_language_model_id}
24182432

24192433
url = '/v1/acoustic_customizations/{0}/train'.format(
24202434
*self._encode_path_vars(customization_id))
@@ -2433,8 +2447,11 @@ def reset_acoustic_model(self, customization_id, **kwargs):
24332447
Resets a custom acoustic model by removing all audio resources from the model.
24342448
Resetting a custom acoustic model initializes the model to its state when it was
24352449
first created. Metadata such as the name and language of the model are preserved,
2436-
but the model's audio resources are removed and must be re-created. You must use
2437-
credentials for the instance of the service that owns a model to reset it.
2450+
but the model's audio resources are removed and must be re-created. The service
2451+
cannot reset a model while it is handling another request for the model. The
2452+
service cannot accept subsequent requests for the model until the existing reset
2453+
request completes. You must use credentials for the instance of the service that
2454+
owns a model to reset it.
24382455
**See also:** [Resetting a custom acoustic
24392456
model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#resetModel-acoustic).
24402457
@@ -2483,8 +2500,10 @@ def upgrade_acoustic_model(self,
24832500
returns an `AcousticModel` object that includes `status` and `progress` fields.
24842501
Use a loop to check the status once a minute. While it is being upgraded, the
24852502
custom model has the status `upgrading`. When the upgrade is complete, the model
2486-
resumes the status that it had prior to upgrade. The service cannot accept
2487-
subsequent requests for the model until the upgrade completes.
2503+
resumes the status that it had prior to upgrade. The service cannot upgrade a
2504+
model while it is handling another request for the model. The service cannot
2505+
accept subsequent requests for the model until the existing upgrade request
2506+
completes.
24882507
If the custom acoustic model was trained with a separately created custom language
24892508
model, you must use the `custom_language_model_id` parameter to specify the GUID
24902509
of that custom language model. The custom language model must be upgraded before
@@ -2600,21 +2619,21 @@ def add_audio(self,
26002619
efficient than adding each file individually. You can add audio resources in any
26012620
format that the service supports for speech recognition.
26022621
You can use this method to add any number of audio resources to a custom model by
2603-
calling the method once for each audio or archive file. But the addition of one
2604-
audio resource must be fully complete before you can add another. You must add a
2605-
minimum of 10 minutes and a maximum of 200 hours of audio that includes speech,
2606-
not just silence, to a custom acoustic model before you can train it. No audio
2607-
resource, audio- or archive-type, can be larger than 100 MB. To add an audio
2608-
resource that has the same name as an existing audio resource, set the
2609-
`allow_overwrite` parameter to `true`; otherwise, the request fails.
2622+
calling the method once for each audio or archive file. You can add multiple
2623+
different audio resources at the same time. You must add a minimum of 10 minutes
2624+
and a maximum of 200 hours of audio that includes speech, not just silence, to a
2625+
custom acoustic model before you can train it. No audio resource, audio- or
2626+
archive-type, can be larger than 100 MB. To add an audio resource that has the
2627+
same name as an existing audio resource, set the `allow_overwrite` parameter to
2628+
`true`; otherwise, the request fails.
26102629
The method is asynchronous. It can take several seconds to complete depending on
26112630
the duration of the audio and, in the case of an archive file, the total number of
26122631
audio files being processed. The service returns a 201 response code if the audio
26132632
is valid. It then asynchronously analyzes the contents of the audio file or files
26142633
and automatically extracts information about the audio such as its length,
2615-
sampling rate, and encoding. You cannot submit requests to add additional audio
2616-
resources to a custom acoustic model, or to train the model, until the service's
2617-
analysis of all audio files for the current request completes.
2634+
sampling rate, and encoding. You cannot submit requests to train or upgrade the
2635+
model until the service's analysis of all audio resources for current requests
2636+
completes.
26182637
To determine the status of the service's analysis of the audio, use the **Get an
26192638
audio resource** method to poll the status of the audio. The method accepts the
26202639
customization ID of the custom model and the name of the audio resource, and it
@@ -2671,13 +2690,9 @@ def add_audio(self,
26712690
have the same format.
26722691
Do not use the `Contained-Content-Type` header when adding an audio-type resource.
26732692
### Naming restrictions for embedded audio files
2674-
The name of an audio file that is embedded within an archive-type resource must
2675-
meet the following restrictions:
2676-
* Include a maximum of 128 characters in the file name; this includes the file
2677-
extension.
2678-
* Do not include spaces, slashes, or backslashes in the file name.
2679-
* Do not use the name of an audio file that has already been added to the custom
2680-
model as part of an archive-type resource.
2693+
The name of an audio file that is contained in an archive-type resource can
2694+
include a maximum of 128 characters. This includes the file extension and all
2695+
elements of the name (for example, slashes).
26812696
26822697
:param str customization_id: The customization ID (GUID) of the custom acoustic
26832698
model that is to be used for the request. You must make the request with
@@ -2686,7 +2701,11 @@ def add_audio(self,
26862701
model. Use a localized name that matches the language of the custom model and
26872702
reflects the contents of the resource.
26882703
* Include a maximum of 128 characters in the name.
2689-
* Do not include spaces, slashes, or backslashes in the name.
2704+
* Do not use characters that need to be URL-encoded. For example, do not use
2705+
spaces, slashes, backslashes, colons, ampersands, double quotes, plus signs,
2706+
equals signs, questions marks, and so on in the name. (The service does not
2707+
prevent the use of these characters. But because they must be URL-encoded wherever
2708+
used, their use is strongly discouraged.)
26902709
* Do not use the name of an audio resource that has already been added to the
26912710
custom model.
26922711
:param file audio_resource: The audio resource that is to be added to the custom
@@ -2808,12 +2827,13 @@ def delete_audio(self, customization_id, audio_name, **kwargs):
28082827
Delete an audio resource.
28092828
28102829
Deletes an existing audio resource from a custom acoustic model. Deleting an
2811-
archive-type audio resource removes the entire archive of files; the current
2812-
interface does not allow deletion of individual files from an archive resource.
2830+
archive-type audio resource removes the entire archive of files. The service does
2831+
not allow deletion of individual files from an archive resource.
28132832
Removing an audio resource does not affect the custom model until you train the
28142833
model on its updated data by using the **Train a custom acoustic model** method.
2815-
You must use credentials for the instance of the service that owns a model to
2816-
delete its audio resources.
2834+
You can delete an existing audio resource from a model while a different resource
2835+
is being added to the model. You must use credentials for the instance of the
2836+
service that owns a model to delete its audio resources.
28172837
**See also:** [Deleting an audio resource from a custom acoustic
28182838
model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAudio#deleteAudio).
28192839
@@ -2905,6 +2925,10 @@ class AcousticModel(object):
29052925
:attr str created: (optional) The date and time in Coordinated Universal Time (UTC) at
29062926
which the custom acoustic model was created. The value is provided in full ISO 8601
29072927
format (`YYYY-MM-DDThh:mm:ss.sTZD`).
2928+
:attr str updated: (optional) The date and time in Coordinated Universal Time (UTC) at
2929+
which the custom acoustic model was last modified. The `created` and `updated` fields
2930+
are equal when an acoustic model is first added but has yet to be updated. The value
2931+
is provided in full ISO 8601 format (YYYY-MM-DDThh:mm:ss.sTZD).
29082932
:attr str language: (optional) The language identifier of the custom acoustic model
29092933
(for example, `en-US`).
29102934
:attr list[str] versions: (optional) A list of the available versions of the custom

0 commit comments

Comments
 (0)