pliers.converters.RevAISpeechAPIConverter¶
- class pliers.converters.RevAISpeechAPIConverter(access_token=None, timeout=1000, request_rate=5, language='en')[source]¶
Bases:
APITransformer
,AudioToTextConverter
Uses the Rev AI speech-to-text API to transcribe an audio file.
- Parameters
access_token (str) – API credential access token. Must be passed explicitly or stored in the environment variable specified in the _env_keys field.
timeout (int) – Number of seconds to wait for audio transcription to finish. Defaults to 90 seconds.
request_rate (int) – Number of seconds to wait between polling the API for completion.
language (str) – Language included in the provided audio file. Must be a language supported by RevAI; for the full list, see their docs: https://docs.rev.ai/api/asynchronous/reference/#operation/SubmitTranscriptionJob!ct=application/json&path=language&t=request #:PEP8 -E501
- transform(stims, validation='strict', *args, **kwargs)¶
Executes the transformation on the passed stim(s).
- Parameters
One or more stimuli to process. Must be one of:
A string giving the path to a file that can be read in as a Stim (e.g., a .txt file, .jpg image, etc.)
A Stim instance of any type.
An iterable of stims, where each element is either a string or a Stim.
validation (str) –
String specifying how validation errors should be handled. Must be one of:
’strict’: Raise an exception on any validation error
’warn’: Issue a warning for all validation errors
’loose’: Silently ignore all validation errors
args – Optional positional arguments to pass onto the internal _transform call.
kwargs – Optional positional arguments to pass onto the internal _transform call.