Safe Haskell | None |
---|---|
Language | Haskell2010 |
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 parseJSON :: Value -> Parser Credentials # parseJSONList :: Value -> Parser [Credentials] # |
:: Text | Access Key |
-> Text | Secret Key |
-> Credentials |
:: String | Access Key environment variable |
-> String | Secret Key environment variable |
-> IO (Maybe Credentials) |
Use the provided environment variables to create
Credentials
:: 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 Bytestring
s are written to the channel to be transcribed.
Transcribed StreamingResponse
s 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
data LanguageCode Source #
The language code for the input audio.
Amazon Transcribe Streaming regions
StreamingResponse
data StreamingResponse Source #
Instances
Eq StreamingResponse Source # | |
Defined in AWS.Transcribe.StreamingResponse (==) :: StreamingResponse -> StreamingResponse -> Bool # (/=) :: StreamingResponse -> StreamingResponse -> Bool # | |
Show StreamingResponse Source # | |
Defined in AWS.Transcribe.StreamingResponse showsPrec :: Int -> StreamingResponse -> ShowS # show :: StreamingResponse -> String # showList :: [StreamingResponse] -> ShowS # |
data StreamingError Source #
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 (==) :: StreamingError -> StreamingError -> Bool # (/=) :: StreamingError -> StreamingError -> Bool # | |
Show StreamingError Source # | |
Defined in AWS.Transcribe.StreamingResponse showsPrec :: Int -> StreamingError -> ShowS # show :: StreamingError -> String # showList :: [StreamingError] -> ShowS # |
data TranscriptEvent Source #
Instances
Eq TranscriptEvent Source # | |
Defined in AWS.Transcribe.StreamingResponse (==) :: TranscriptEvent -> TranscriptEvent -> Bool # (/=) :: TranscriptEvent -> TranscriptEvent -> Bool # | |
Show TranscriptEvent Source # | |
Defined in AWS.Transcribe.StreamingResponse showsPrec :: Int -> TranscriptEvent -> ShowS # show :: TranscriptEvent -> String # showList :: [TranscriptEvent] -> ShowS # | |
FromJSON TranscriptEvent Source # | |
Defined in AWS.Transcribe.StreamingResponse parseJSON :: Value -> Parser TranscriptEvent # parseJSONList :: Value -> Parser [TranscriptEvent] # |
data Transcript Source #
Instances
Eq Transcript Source # | |
Defined in AWS.Transcribe.StreamingResponse (==) :: Transcript -> Transcript -> Bool # (/=) :: Transcript -> Transcript -> Bool # | |
Show Transcript Source # | |
Defined in AWS.Transcribe.StreamingResponse showsPrec :: Int -> Transcript -> ShowS # show :: Transcript -> String # showList :: [Transcript] -> ShowS # | |
FromJSON Transcript Source # | |
Defined in AWS.Transcribe.StreamingResponse parseJSON :: Value -> Parser Transcript # parseJSONList :: Value -> Parser [Transcript] # |
data Alternative Source #
Instances
Eq Alternative Source # | |
Defined in AWS.Transcribe.Alternative (==) :: Alternative -> Alternative -> Bool # (/=) :: Alternative -> Alternative -> Bool # | |
Show Alternative Source # | |
Defined in AWS.Transcribe.Alternative showsPrec :: Int -> Alternative -> ShowS # show :: Alternative -> String # showList :: [Alternative] -> ShowS # | |
ToJSON Alternative Source # | |
Defined in AWS.Transcribe.Alternative toJSON :: Alternative -> Value # toEncoding :: Alternative -> Encoding # toJSONList :: [Alternative] -> Value # toEncodingList :: [Alternative] -> Encoding # | |
FromJSON Alternative Source # | |
Defined in AWS.Transcribe.Alternative parseJSON :: Value -> Parser Alternative # parseJSONList :: Value -> Parser [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