GeometrizeTwitterBot  1.0
Python Twitter bot for geometrizing images into geometric primitives
Namespaces | Functions | Variables
tweet_parser.py File Reference

Namespaces

 tweet_parser
 This module contains code that reads tweet text and figures out how the bot should do in response.
 

Functions

def tweet_parser._represents_int (s)
 Returns true if the given string represents an integer value. More...
 
def tweet_parser._clamp (n, smallest, largest)
 Clamps the given number within the range smallest, largest. More...
 
def tweet_parser._add_shape_type_for_keywords (dict, shape_keywords, shape_name)
 Adds the given items to the given dictionary, mapping each keyword to the given shape name. More...
 
def tweet_parser._make_shape_keyword_dictionary ()
 Creates a dictionary mapping shape keywords to canonical shape names used by ChaiScript scripts Provides a convenient way to map words in tweets like "rects" to the shape type "RECTANGLE". More...
 
def tweet_parser._max_quantity_for_shape_type (shape_type)
 Gets the maximum number of shapes allowed for the given shape type This to to set a sensible limit on the length of time the bot will spend on a single image. More...
 
def tweet_parser._plural_name_for_shape_type (shape_type)
 Gets a human-readable name for the given shape type. More...
 
def tweet_parser._make_loop_body (shape_type)
 Helper for constructing a ChaiScript script for geometrizing shapes. More...
 
def tweet_parser._make_for_loop (step_count, shape_type)
 Helper for constructing a ChaiScript script for geometrizing shapes. More...
 
def tweet_parser._make_shape_code (dict)
 Helper for constructing a ChaiScript script for geometrizing shapes. More...
 
def tweet_parser.make_shape_quantity_dictionary (message)
 Parses a tweet message and returns a dictionary of the shape types and quantities that were requested. More...
 
def tweet_parser.make_code_for_shape_tweet (message)
 Parses the given tweet, returning the ChaiScript code for Geometrize to run based on the contents of the tweet. More...
 
def tweet_parser.make_message_for_shape_dictionary (shape_quantity_dictionary)
 Creates a message for the given shape dictionary, suitable for tweeting along with the result of running the script. More...
 

Variables

list tweet_parser._rect_keywords = [ "rect", "rects", "rectangle", "rectangles" ]
 
list tweet_parser._rotated_rect_keywords = [ "rotated_rect", "rotated_rects", "rotated_rectangle", "rotated_rectangles" ]
 
list tweet_parser._triangle_keywords = [ "tri", "tris", "triangle", "triangles" ]
 
list tweet_parser._ellipse_keywords = [ "ellipse", "ellipses" ]
 
list tweet_parser._rotated_ellipse_keywords = [ "rotated_ellipse", "rotated_ellipses" ]
 
list tweet_parser._circle_keywords = [ "circ", "circs", "circle", "circles" ]
 
list tweet_parser._line_keywords = [ "line", "lines" ]
 
list tweet_parser._quadratic_bezier_keywords = [ "bezier", "beziers", "quadratic_bezier", "quadratic_beziers" ]
 
list tweet_parser._polyline_keywords = [ "polyline", "polylines" ]