pliers.stimuli.TweetStim

class pliers.stimuli.TweetStim(status)[source]

Bases: CompoundStim

Represents the text and associated media from a single tweet.

Parameters

status (python-twitter Status object) – the Status from which to extract information, can either be generated from the TweetFactory or user-provided.

__init__(status)[source]
get_stim(type_, return_all=False)

Returns component elements of the specified type.

Parameters
  • type (str or Stim class) – the desired Stim subclass to return.

  • return_all (bool) – when True, returns all elements that matched the specified type as a list. When False (default), returns only the first matching Stim.

Returns

If return_all is True, a list of matching elements (or an empty list if no elements match). If return_all is False, returns the first matching Stim, or None if no elements match.

get_types()

Return tuple of types of all available Stims.

has_types(types, all_=True)

Check whether the current component list matches all Stim types in the types argument.

Parameters
  • types (Stim, list) – a Stim class or iterable of Stim classes.

  • all (bool) – if True, all input types must match; if False, at least one input type must match.

Returns

True if all passed types match at least one Stim in the component list, otherwise False.