pliers.converters.GoogleSpeechAPIConverter

class pliers.converters.GoogleSpeechAPIConverter(language_code='en-US', profanity_filter=False, speech_contexts=None, discovery_file=None, api_version='v1', max_results=100, num_retries=3, rate_limit=None)[source]

Bases: GoogleAPITransformer, AudioToTextConverter

Uses the Google Speech API to do speech-to-text transcription.

Args:

language_code (str): The language of the supplied AudioStim. profanity_filter (bool): If set to True, will ask Google to try and

filter out profanity from the resulting Text.

speech_contexts (list): A list of favored phrases or words

  • to assist the API.

discovery_file (str): path to discovery file containing Google

application credentials.

api_version (str): API version to use. max_results (int): Max number of results per page. num_retries (int): Number of times to retry query on failure. rate_limit (int): The minimum number of seconds required between

transform calls on this Transformer.

__init__(language_code='en-US', profanity_filter=False, speech_contexts=None, discovery_file=None, api_version='v1', max_results=100, num_retries=3, rate_limit=None)[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.