pliers.converters.IBMSpeechAPIConverter

class pliers.converters.IBMSpeechAPIConverter(username=None, password=None, resolution='words', rate_limit=None, model='en-US')[source]

Bases: APITransformer, AudioToTextConverter

Uses the IBM Watson Text to Speech API to run speech-to-text transcription on an audio file.

Parameters
  • username (str) – API credential username. Must be passed explicitly or stored in the environment variable specified in the _env_keys field.

  • password (str) – API credential password. Must be passed explicitly or stored in the environment variable specified in the _env_keys field.

  • resolution (str) – what resolution the resultant ComplexTextStim should be separated by (i.e. the unit each TextStim in the ComplexTextStim elements should be). Currently, only ‘words’ or ‘phrases’ are supported.

  • rate_limit (int) – The minimum number of seconds required between transform calls on this Transformer.

  • model (str) – The model to use for speech recognition (e.g., ‘en-US’, ‘zh-CN’, etc.). Don’t include the “_BroadbandModel” suffix.

__init__(username=None, password=None, resolution='words', rate_limit=None, model='en-US')[source]
transform(stims, validation='strict', *args, **kwargs)

Executes the transformation on the passed stim(s).

Parameters
  • stims (str, Stim, list) –

    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.