// // Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"). // You may not use this file except in compliance with the License. // A copy of the License is located at // // http://aws.amazon.com/apache2.0 // // or in the "license" file accompanying this file. This file is distributed // on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either // express or implied. See the License for the specific language governing // permissions and limitations under the License. // #import #import #import NS_ASSUME_NONNULL_BEGIN FOUNDATION_EXPORT NSString *const AWSTranscribeStreamingErrorDomain; typedef NS_ENUM(NSInteger, AWSTranscribeStreamingErrorType) { AWSTranscribeStreamingErrorUnknown, AWSTranscribeStreamingErrorBadRequest, AWSTranscribeStreamingErrorConflict, AWSTranscribeStreamingErrorInternalFailure, AWSTranscribeStreamingErrorLimitExceeded, AWSTranscribeStreamingErrorServiceUnavailable, }; typedef NS_ENUM(NSInteger, AWSTranscribeStreamingItemType) { AWSTranscribeStreamingItemTypeUnknown, AWSTranscribeStreamingItemTypePronunciation, AWSTranscribeStreamingItemTypePunctuation, }; typedef NS_ENUM(NSInteger, AWSTranscribeStreamingLanguageCode) { AWSTranscribeStreamingLanguageCodeUnknown, AWSTranscribeStreamingLanguageCodeEnUS, AWSTranscribeStreamingLanguageCodeEnGB, AWSTranscribeStreamingLanguageCodeEsUS, AWSTranscribeStreamingLanguageCodeFrCA, AWSTranscribeStreamingLanguageCodeFrFR, AWSTranscribeStreamingLanguageCodeEnAU, AWSTranscribeStreamingLanguageCodeItIT, AWSTranscribeStreamingLanguageCodeDeDE, AWSTranscribeStreamingLanguageCodePtBR, AWSTranscribeStreamingLanguageCodeJaJP, AWSTranscribeStreamingLanguageCodeKoKR, AWSTranscribeStreamingLanguageCodeZhCN, AWSTranscribeStreamingLanguageCodeHiIN, AWSTranscribeStreamingLanguageCodeThTH, }; typedef NS_ENUM(NSInteger, AWSTranscribeStreamingMediaEncoding) { AWSTranscribeStreamingMediaEncodingUnknown, AWSTranscribeStreamingMediaEncodingPcm, }; @class AWSTranscribeStreamingAlternative; @class AWSTranscribeStreamingAudioEvent; @class AWSTranscribeStreamingAudioStream; @class AWSTranscribeStreamingItem; @class AWSTranscribeStreamingResult; @class AWSTranscribeStreamingStartStreamTranscriptionRequest; @class AWSTranscribeStreamingStartStreamTranscriptionResponse; @class AWSTranscribeStreamingTranscript; @class AWSTranscribeStreamingTranscriptEvent; @class AWSTranscribeStreamingTranscriptResultStream; /**

A list of possible transcriptions for the audio.

*/ @interface AWSTranscribeStreamingAlternative : AWSModel /**

One or more alternative interpretations of the input audio.

*/ @property (nonatomic, strong) NSArray * _Nullable items; /**

The text that was transcribed from the audio.

*/ @property (nonatomic, strong) NSString * _Nullable transcript; @end /**

Provides a wrapper for the audio chunks that you are sending.

*/ @interface AWSTranscribeStreamingAudioEvent : AWSModel /**

An audio blob that contains the next part of the audio that you want to transcribe.

*/ @property (nonatomic, strong) NSData * _Nullable audioChunk; @end /**

Represents the audio stream from your application to Amazon Transcribe.

*/ @interface AWSTranscribeStreamingAudioStream : AWSModel /**

A blob of audio from your application. You audio stream consists of one or more audio events.

*/ @property (nonatomic, strong) AWSTranscribeStreamingAudioEvent * _Nullable audioEvent; @end /**

A word or phrase transcribed from the input audio.

*/ @interface AWSTranscribeStreamingItem : AWSModel /**

The word or punctuation that was recognized in the input audio.

*/ @property (nonatomic, strong) NSString * _Nullable content; /**

The offset from the beginning of the audio stream to the end of the audio that resulted in the item.

*/ @property (nonatomic, strong) NSNumber * _Nullable endTime; /**

The offset from the beginning of the audio stream to the beginning of the audio that resulted in the item.

*/ @property (nonatomic, strong) NSNumber * _Nullable startTime; /**

The type of the item. PRONUNCIATION indicates that the item is a word that was recognized in the input audio. PUNCTUATION indicates that the item was interpreted as a pause in the input audio.

*/ @property (nonatomic, assign) AWSTranscribeStreamingItemType types; @end /**

The result of transcribing a portion of the input audio stream.

*/ @interface AWSTranscribeStreamingResult : AWSModel /**

A list of possible transcriptions for the audio. Each alternative typically contains one item that contains the result of the transcription.

*/ @property (nonatomic, strong) NSArray * _Nullable alternatives; /**

The offset in milliseconds from the beginning of the audio stream to the end of the result.

*/ @property (nonatomic, strong) NSNumber * _Nullable endTime; /**

true to indicate that Amazon Transcribe has additional transcription data to send, false to indicate that this is the last transcription result for the audio stream.

*/ @property (nonatomic, strong) NSNumber * _Nullable isPartial; /**

A unique identifier for the result.

*/ @property (nonatomic, strong) NSString * _Nullable resultId; /**

The offset in milliseconds from the beginning of the audio stream to the beginning of the result.

*/ @property (nonatomic, strong) NSNumber * _Nullable startTime; @end /** */ @interface AWSTranscribeStreamingStartStreamTranscriptionRequest : AWSRequest /**

PCM-encoded stream of audio blobs. The audio stream is encoded as an HTTP2 data frame.

*/ @property (nonatomic, strong) AWSTranscribeStreamingAudioStream * _Nullable audioStream; /**

Indicates the language used in the input audio stream.

*/ @property (nonatomic, assign) AWSTranscribeStreamingLanguageCode languageCode; /**

The encoding used for the input audio.

*/ @property (nonatomic, assign) AWSTranscribeStreamingMediaEncoding mediaEncoding; /**

The sample rate, in Hertz, of the input audio. We suggest that you use 8000 Hz for low quality audio and 16000 Hz for high quality audio.

*/ @property (nonatomic, strong) NSNumber * _Nullable mediaSampleRateHertz; /**

A identifier for the transcription session. Use this parameter when you want to retry a session. If you don't provide a session ID, Amazon Transcribe will generate one for you and return it in the response.

*/ @property (nonatomic, strong) NSString * _Nullable sessionId; /**

The name of the vocabulary to use when processing the transcription job.

*/ @property (nonatomic, strong) NSString * _Nullable vocabularyName; @end /** */ @interface AWSTranscribeStreamingStartStreamTranscriptionResponse : AWSModel /**

The language code for the input audio stream.

*/ @property (nonatomic, assign) AWSTranscribeStreamingLanguageCode languageCode; /**

The encoding used for the input audio stream.

*/ @property (nonatomic, assign) AWSTranscribeStreamingMediaEncoding mediaEncoding; /**

The sample rate for the input audio stream. Use 8000 Hz for low quality audio and 16000 Hz for high quality audio.

*/ @property (nonatomic, strong) NSNumber * _Nullable mediaSampleRateHertz; /**

An identifier for the streaming transcription.

*/ @property (nonatomic, strong) NSString * _Nullable requestId; /**

An identifier for a specific transcription session.

*/ @property (nonatomic, strong) NSString * _Nullable sessionId; /**

Represents the stream of transcription events from Amazon Transcribe to your application.

*/ @property (nonatomic, strong) AWSTranscribeStreamingTranscriptResultStream * _Nullable transcriptResultStream; /**

The name of the vocabulary used when processing the job.

*/ @property (nonatomic, strong) NSString * _Nullable vocabularyName; @end /**

The transcription in a TranscriptEvent.

*/ @interface AWSTranscribeStreamingTranscript : AWSModel /**

Result objects that contain the results of transcribing a portion of the input audio stream. The array can be empty.

*/ @property (nonatomic, strong) NSArray * _Nullable results; @end /**

Represents a set of transcription results from the server to the client. It contains one or more segments of the transcription.

*/ @interface AWSTranscribeStreamingTranscriptEvent : AWSModel /**

The transcription of the audio stream. The transcription is composed of all of the items in the results list.

*/ @property (nonatomic, strong) AWSTranscribeStreamingTranscript * _Nullable transcript; @end /**

Represents the transcription result stream from Amazon Transcribe to your application.

*/ @interface AWSTranscribeStreamingTranscriptResultStream : AWSModel /**

A client error occurred when the stream was created. Check the parameters of the request and try your request again.

*/ @property (nonatomic, strong) NSError* _Nullable badRequestException; /**

A new stream started with the same session ID. The current stream has been terminated.

*/ @property (nonatomic, strong) NSError* _Nullable conflictException; /**

A problem occurred while processing the audio. Amazon Transcribe terminated processing.

*/ @property (nonatomic, strong) NSError* _Nullable internalFailureException; /**

Your client has exceeded one of the Amazon Transcribe limits, typically the limit on audio length. Break your audio stream into smaller chunks and try your request again.

*/ @property (nonatomic, strong) NSError* _Nullable limitExceededException; /**

A portion of the transcription of the audio stream. Events are sent periodically from Amazon Transcribe to your application. The event can be a partial transcription of a section of the audio stream, or it can be the entire transcription of that portion of the audio stream.

*/ @property (nonatomic, strong) AWSTranscribeStreamingTranscriptEvent * _Nullable transcriptEvent; @end NS_ASSUME_NONNULL_END