pliers.converters.GoogleVisionAPITextConverter

class pliers.converters.GoogleVisionAPITextConverter(handle_annotations='first', discovery_file=None, api_version='v1', max_results=100, num_retries=3, rate_limit=None)[source]

Bases: GoogleVisionAPITransformer, ImageToTextConverter

Detects text within images using the Google Cloud Vision API.

Parameters
  • handle_annotations (str) – How to handle cases where there are multiple detected text labels. Valid values are ‘first’ (only return the first response as a TextStim), ‘concatenate’ (concatenate all responses into a single TextStim), or ‘list’ (return a list of TextStims).

  • args – Optional positional and keyword arguments to pass to the superclass init.

  • kwargs – Optional positional and keyword arguments to pass to the superclass init.

__init__(handle_annotations='first', 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.