Skip to main content

Surreal sentence and error message generator.

Project description

surrealism module for Python

This module allows you to generate surreal sentences and error messages very easily from within your python programs.

This module is a derivative work (used with permission) from www.ravenblack.net.

Credit also goes to Kevan Davis on whose work the surrealism generator at www.ravenblack.net is based on.

Installation

If you have downloaded the source distribution, to install do the following at the commandline:

$ python setup.py install

Or using easy_install:

$ easy_install surrealism

And it will download and install the latest version from the Python Package Index.

Or pip:

$ pip install surrealism

And it will download and install the latest version from the Python Package Index.

Usage Examples

Generate a surreal sentence:

>>> import surrealism
>>> sentence = surrealism.getsentence()
>>> print sentence
>>> If I can get the Pot Noodle to enter Radiohead's Lead Singer, the lego-brick will dilute Julian Assange and I'll be able to spy on Neil Armstrong!

You can also specify an integer representing the relevant row ID from the database in order to return a specific sentence:

>>> import surrealism
>>> sentence = surrealism.getsentence(39)
>>> print sentence
>>> Don't drop things on X-Wings - get blood out of deep-fat friers!

Generate a surreal error message:

>>> import surrealism
>>> print surrealism.getfault()
>>> thing.c:466: fearsome error in 'blow-up doll()' - missing thing-a-ma-jig.

You can also specify an integer representing the relevant row ID from the database in order to return a specific sentence:

>>> import surrealism
>>> print surrealism.getfault(3)
>>> Traceback (most recent call last):  File '/party popper/fighter plane/glistening_seashell/anti-depressant.py', line 20, in straggly_particle accelerator.  waterproofError: salmon mousse did not deep-fry hand-drill.

Please feel free to leave bug reports and feature requests on the github homepage at https://github.com/Morrolan/surrealism.

All comments are welcome!

Changelog

0.9.0

Added the ability to override getfault() and getsentence() allowing you to now specify a fault_id or sentence_id from within the database.

0.8.0

Added comments to code and fixed some dodgy sentences in the database.

0.7.0

Added a new table which allows more faults rather than just the C++ syntax fault. Also added faulttest() and sentencetest() so you can print out all sentences and faults.

0.6.0

Added the ability to have the entire sentence in uppercase (some sentences require it) and tripled the size of the ‘names’ table.

0.5.6

More database tweaks to fix spacing issues.

0.5.5

Fixed print statement which prevented installation and use on Python 3x.

0.5.4

Added pkg_resources to manage sqlite file installation (particularly a problem when using virtualenv).

0.5.3

Added seperate script (sentence_test)

0.5.2

Fixed bug with adjectives and tidied database.

0.5.1

Added basic docstrings.

0.5.0

Removed unnecessary Class, now making it even easier and simpler to use.

0.4.1

Minor bug fix to the getfault sentences where 2 periods were printing instead of 1.

0.4

Urgent bug fix to getfault where returned result was incomplete.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

surrealism-0.9.0.tar.gz (123.2 kB view hashes)

Uploaded Source

Built Distribution

surrealism-0.9.0-py2.7.egg (117.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page