{ "info": { "author": "Allison Parrish", "author_email": "allison@decontextualize.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Science/Research", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Artistic Software", "Topic :: Scientific/Engineering :: Artificial Intelligence" ], "description": "Tracery for Python\n==================\n\n.. image:: https://img.shields.io/travis/aparrish/pytracery.svg\n :target: https://travis-ci.org/aparrish/pytracery\n\nThis is a (rough) port of `Kate Compton `_'s\nwonderful `Tracery `_ to Python. The port\nis by `Allison Parrish `_.\n\nI'm always writing little one-off recursive template/grammar expansion\nfunctions in my Python generative text projects. And I *love* working with\nTracery! So I figured: why not save myself (and potentially others) some time\nand just make it possible to use Tracery from within Python? This port is the\nresult!\n\nThe port is a fairly literal Python translation of `this version\n`_\nof `tracery.js` in the official repository's `tracery2` branch.\n\nInstallation\n------------\n\nInstall with pip like so::\n\n pip install tracery\n\nYou can also download the source code and install manually::\n\n python setup.py install\n\nUsage\n-----\n\nSee `Kate Compton's Tracery\ntutorial `_ for information\nabout how Tracery works. In the Python port, you use Python dictionaries\ninstead of JavaScript objects for the rules, but the concept is the same\notherwise.\n\n::\n\n import tracery\n from tracery.modifiers import base_english\n\n rules = {\n 'origin': '#hello.capitalize#, #location#!',\n 'hello': ['hello', 'greetings', 'howdy', 'hey'],\n 'location': ['world', 'solar system', 'galaxy', 'universe']\n }\n\n grammar = tracery.Grammar(rules)\n grammar.add_modifiers(base_english)\n print grammar.flatten(\"#origin#\") # prints, e.g., \"Hello, world!\"\n\nAny valid Tracery grammar should work in this port. The ``base_english``\nmodifiers in ``tracery.modifiers`` are a port of the modifiers in the JavaScript\npackage. Many aspects of Tracery are not standardized, so in some edge cases\nyou may get output that doesn't exactly conform to what you would get if you\nused the same grammar with the JavaScript version. (e.g., \"None\" in strings\nwhere in JavaScript you might see \"undefined\")\n\nCommand line\n------------\n\nYou can run the module on a JSON Tracery grammar file on the command line to output example lines::\n\n positional arguments:\n json Input JSON file\n number Number of lines to generate (default: 1)\n\nFor example::\n\n $ python -m tracery potterpapers.json \n Harry Potter and the Tchebyshev transforms of the first and second kind\n \n $ python -m tracery potterpapers.json 3\n Harry Potter and the Impact of Extremes in Outdoor Temperature and Sunshine Exposure on Birth Weight.\n Harry Potter and the Chromatin Remodelling Enzymes SNF2H and SNF2L Position Nucleosomes adjacent to CTCF and Other Transcription Factors.\n Harry Potter and the Model Organism Hermissenda crassicornis (Gastropoda: Heterobranchia) Is a Species Complex.\n\nLicense\n-------\n\nThis port inherits Tracery's original Apache License 2.0.\n\n::\n\n Copyright 2016 Allison Parrish\n Based on code by Kate Compton\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n\n\n\n\nHistory\n=======\n\n0.1.1 (2017-03-27)\n------------------\n\n* Obligatory \"foreseeable mistake in setup.py\" release. (thx `_).\n\n0.1.0 (2017-03-27)\n------------------\n\n* Initial release on PyPI, incorporating many contributions from `hugovk\n `_.\n\n0.0.1 (2016-03-09)\n------------------\n\n* First release on Github.", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/aparrish/pytracery", "keywords": "tracery", "license": "Apache License 2.0", "maintainer": null, "maintainer_email": null, "name": "tracery", "package_url": "https://pypi.org/project/tracery/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/tracery/", "project_urls": { "Homepage": "https://github.com/aparrish/pytracery" }, "release_url": "https://pypi.org/project/tracery/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "Python port of Kate Compton's tracery text generation library", "version": "0.1.1" }, "last_serial": 2733994, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "88ad6a0de4190d64922135d053066782", "sha256": "84e32ce3dd3b835a3a70412052183728fa3da16a739f60ca0a07da180aa76225" }, "downloads": -1, "filename": "tracery-0.1.0.tar.gz", "has_sig": false, "md5_digest": "88ad6a0de4190d64922135d053066782", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8027, "upload_time": "2017-03-27T15:20:52", "url": "https://files.pythonhosted.org/packages/b0/82/e0db89fa549ebeb87c5e440859704a9c57cd815c4db0da2d9a7315073943/tracery-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "8ca4b0d5e131c48b1df3c26cf942033a", "sha256": "3fefb23a0b12c6568fdc32bcab2ec6f4395c81ea8568c019fc9905d1eb9dd232" }, "downloads": -1, "filename": "tracery-0.1.1.tar.gz", "has_sig": false, "md5_digest": "8ca4b0d5e131c48b1df3c26cf942033a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8110, "upload_time": "2017-03-27T16:55:24", "url": "https://files.pythonhosted.org/packages/96/9a/7a7ffa8ace49ac6a3f422fdd83caf8d0ad0d132f01389f02845379033a7b/tracery-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8ca4b0d5e131c48b1df3c26cf942033a", "sha256": "3fefb23a0b12c6568fdc32bcab2ec6f4395c81ea8568c019fc9905d1eb9dd232" }, "downloads": -1, "filename": "tracery-0.1.1.tar.gz", "has_sig": false, "md5_digest": "8ca4b0d5e131c48b1df3c26cf942033a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8110, "upload_time": "2017-03-27T16:55:24", "url": "https://files.pythonhosted.org/packages/96/9a/7a7ffa8ace49ac6a3f422fdd83caf8d0ad0d132f01389f02845379033a7b/tracery-0.1.1.tar.gz" } ] }