Meme

Meme objects contain the information you need to analyze a meme.

class meme_get.memesites.Meme(pic_url, time, title=None, caption=None, raw_pic_url=None, origin=<Origins.NA: 0>, tags=[], score=-1)[source]

A class for representing memes

This class provides a high-level abstraction for memes.

Attributes:
  • _pic_url (str): A string representing the url of the picture
  • _caption (str): A string representing the caption of the meme
  • _time (datetime object): The time of creation of the meme
  • _origin (Orgins Enum): The origins enum object representing the origin
  • _tags (list): A list of string representing the categories of the meme
get_caption()[source]

Get caption of the meme

Returns:The captions of the meme.
Return type:str
get_origin()[source]

Return the origin of the meme

get_pic_url()[source]

Get url to the picture

Returns:The url to the meme picture. Notice that this picture contains the captions.
Return type:str
get_raw_pic_url()[source]

Return the url of the meme’s picture without caption

Returns:The url pointing to the meme’s background picture
Return type:str
Raises:ValueError – if the meme does not have a empty background picture
get_tags()[source]

Representing a list of tags for the meme

get_time()[source]

Return the meme’s creation time

Returns:The creation time of the meme
Return type:datetime object
get_title()[source]

Get the title of the meme

Returns:The title of the meme
Return type:str
Raises:ValueError – if the meme does not have a title
ocr_caption(method='Tesseract', **kwargs)[source]

Use ocr to update self caption

OCR Methods Available

  • Tesseract: Open-source OCR Engine
  • FontMatching: Using Impact Font and template matching to conduct OCR

When using Tesseract, users need to provide two keyword arguments:

  • thres (bool): a boolean indicating whether we need to threshold the image
  • cfg (str): a string representing the configuration to use for Tesseract