/the-cartoonist

A program that generates a cartoon and a caption using SVG paths and Markov chains

Primary LanguagePythonMIT LicenseMIT

Cartoonist

Note: Cartoonist is a work in progress.

Cartoonist is a program that generates an original cartoon and a caption. It creates a combination of SVG paths to form a face and builds a caption using Markov chaining.

The eventual goal is to use sentiment analysis on the generated caption to decide how certain features will be drawn — i.e., the angle and direction of eyebrow slant, shape of mouth, etc.

##How it works

Cartoonist uses svgwrite to generate the outline of the head as well as the facial features. Certain features are added sometimes but not always, and most features have several different styles that are displayed randomly.

Captions are generated using a Python implementation of a Markov Text Generator using TextBlob, a Python (2 and 3) library for processing textual data.

Markov Text Generators generate original, superficially real-looking sentences based on a given source text. Each word is selected based on how often it follows the previous word, and the results are chained together to form a sentence.

The following was generated with this program using George Saunders's Pastoralia as source text:

Around two there is no goat, just killed, sits in our shoes, you always said good, good fishing, son, and when you say it, I’m already deep into the cave was real and all, and you even come into my workplace and started swearing.” “Like you ever worked.” “Like jewelry making wasn’t work,” he says.

##How to use it

You can play with a live (beta) version of Cartoonist at cartoons.torypeterschild.io.

Requires

##Status

###What works

  • Caption generation using Markov chains
  • Cartoon drawing generation using svgwrite

###What doesn't work YET

  • Saving the cartoon (working on this)
  • Database

Examples

##License

Cartoonist is licensed under the MIT License. See LICENSE for more information.