| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
AWS.Transcribe
Description
Use the WebSocket protocol to stream audio to the AWS Transcribe service
For general information regarding the service see the relevant AWS documentation (https://docs.aws.amazon.com/transcribe/latest/dg/websocket.html)
Synopsis
- data Credentials
- newCredentials :: Text -> Text -> Credentials
- lookupCredentials :: String -> String -> IO (Maybe Credentials)
- runClient :: Credentials -> Settings -> Channel -> IO ()
- data Channel
- newChannel :: IO Channel
- readChannel :: Channel -> IO StreamingResponse
- writeChannel :: Channel -> ByteString -> IO ()
- tryReadChannel :: Channel -> IO (Maybe StreamingResponse)
- isEmpty :: Channel -> IO Bool
- data Settings = MkSettings {}
- data LanguageCode
- data MediaEncoding
- data Region
- data StreamingResponse
- data StreamingError
- data TranscriptEvent
- transcript :: Iso' TranscriptEvent Transcript
- data Transcript
- results :: Iso' Transcript [Result]
- data Result
- alternatives :: Lens' Result [Alternative]
- channelId :: Lens' Result (Maybe Text)
- endTime :: Lens' Result Double
- isPartial :: Lens' Result Bool
- resultId :: Lens' Result Text
- startTime :: Lens' Result Double
- data Alternative
- items :: Lens' Alternative [Item]
- altTranscript :: Lens' Alternative (Maybe Text)
- data Item
- confidence :: Lens' Item (Maybe Double)
- content :: Lens' Item (Maybe Text)
- iEndTime :: Lens' Item (Maybe Double)
- speaker :: Lens' Item (Maybe Text)
- stable :: Lens' Item (Maybe Bool)
- iStartTime :: Lens' Item (Maybe Double)
- itemType :: Lens' Item (Maybe ItemType)
- vocabularyFilterMatch :: Lens' Item (Maybe Bool)
- data ItemType
Credentials
data Credentials Source #
AWS Security credentials comprising of an access key ID and a secret key. Temporary security tokens are not supported
Instances
| FromJSON Credentials Source # | |
Defined in AWS.Credentials | |
Arguments
| :: Text | Access Key |
| -> Text | Secret Key |
| -> Credentials |
Arguments
| :: String | Access Key environment variable |
| -> String | Secret Key environment variable |
| -> IO (Maybe Credentials) |
Use the provided environment variables to create
Credentials
Arguments
| :: Credentials | AWS Credentials |
| -> Settings | Session settings |
| -> Channel | Transcribe channel |
| -> IO () |
Start a WebSocket client.
The client will probe the channel for incoming ByteString, encode it in
the expected Event Stream and transmit them to the AWS Transcribe endpoint.
When a response is received it will be written in the channel.
Sending an empty ByteString will close the WebSocket connection. Receiving any kind
of exception from AWS Transcribe will also close the connection.
Channel
An AWS Transcribe channel abstraction.
Audio Bytestrings are written to the channel to be transcribed.
Transcribed StreamingResponses are read from the channel.
readChannel :: Channel -> IO StreamingResponse Source #
Read a StreamingResponse from the Channel
writeChannel :: Channel -> ByteString -> IO () Source #
Write an audio ByteString to the channel
tryReadChannel :: Channel -> IO (Maybe StreamingResponse) Source #
Read a StreamingResponse from the Channel if one is available
Settings
Transcribe session specific settings
Constructors
| MkSettings | |
Fields
| |
data LanguageCode Source #
The language code for the input audio.
Amazon Transcribe Streaming regions
StreamingResponse
data StreamingResponse Source #
Constructors
| Event TranscriptEvent | |
| Error StreamingError | |
| EndOfStream |
Instances
| Eq StreamingResponse Source # | |
Defined in AWS.Transcribe.StreamingResponse Methods (==) :: StreamingResponse -> StreamingResponse -> Bool # (/=) :: StreamingResponse -> StreamingResponse -> Bool # | |
| Show StreamingResponse Source # | |
Defined in AWS.Transcribe.StreamingResponse Methods showsPrec :: Int -> StreamingResponse -> ShowS # show :: StreamingResponse -> String # showList :: [StreamingResponse] -> ShowS # | |
data StreamingError Source #
Constructors
| BadRequestException | |
| InternalFailureException | |
| LimitExceededException | |
| UnrecognizedClientException | |
| TranscriptEventError String | An error in decoding a |
| OtherStreamingError Message String | An unrecognised exception type or a binary decoding error. The original message is returned along with a possible description of the error |
Instances
| Eq StreamingError Source # | |
Defined in AWS.Transcribe.StreamingResponse Methods (==) :: StreamingError -> StreamingError -> Bool # (/=) :: StreamingError -> StreamingError -> Bool # | |
| Show StreamingError Source # | |
Defined in AWS.Transcribe.StreamingResponse Methods showsPrec :: Int -> StreamingError -> ShowS # show :: StreamingError -> String # showList :: [StreamingError] -> ShowS # | |
data TranscriptEvent Source #
Instances
| Eq TranscriptEvent Source # | |
Defined in AWS.Transcribe.StreamingResponse Methods (==) :: TranscriptEvent -> TranscriptEvent -> Bool # (/=) :: TranscriptEvent -> TranscriptEvent -> Bool # | |
| Show TranscriptEvent Source # | |
Defined in AWS.Transcribe.StreamingResponse Methods showsPrec :: Int -> TranscriptEvent -> ShowS # show :: TranscriptEvent -> String # showList :: [TranscriptEvent] -> ShowS # | |
| FromJSON TranscriptEvent Source # | |
Defined in AWS.Transcribe.StreamingResponse Methods parseJSON :: Value -> Parser TranscriptEvent # parseJSONList :: Value -> Parser [TranscriptEvent] # | |
data Transcript Source #
Instances
| Eq Transcript Source # | |
Defined in AWS.Transcribe.StreamingResponse | |
| Show Transcript Source # | |
Defined in AWS.Transcribe.StreamingResponse Methods showsPrec :: Int -> Transcript -> ShowS # show :: Transcript -> String # showList :: [Transcript] -> ShowS # | |
| FromJSON Transcript Source # | |
Defined in AWS.Transcribe.StreamingResponse | |
data Alternative Source #
Instances
| Eq Alternative Source # | |
Defined in AWS.Transcribe.Alternative | |
| Show Alternative Source # | |
Defined in AWS.Transcribe.Alternative Methods showsPrec :: Int -> Alternative -> ShowS # show :: Alternative -> String # showList :: [Alternative] -> ShowS # | |
| ToJSON Alternative Source # | |
Defined in AWS.Transcribe.Alternative Methods toJSON :: Alternative -> Value # toEncoding :: Alternative -> Encoding # toJSONList :: [Alternative] -> Value # toEncodingList :: [Alternative] -> Encoding # | |
| FromJSON Alternative Source # | |
Defined in AWS.Transcribe.Alternative | |
A word, phrase, or punctuation mark that is transcribed from the input audio. https://docs.aws.amazon.com/transcribe/latest/dg/API_streaming_Item.html