{ "info": { "author": "Ryan Heuser", "author_email": "heuser@stanford.edu", "bugtrack_url": null, "classifiers": [], "description": "# Poesy\n\n## Poetic processing, for Python ##\n\nCode developed in the Stanford Literary Lab's \"Transhistorical Poetry Project\" by Ryan Heuser (@quadrismegistus), J.D. Porter, Jonathan Sensenbaugh, Justin Tackett, Mark Algee-Hewitt, and Maria Kraxenberger. Cleaned and modified from [its original form](http://github.com/quadrismegistus/litlab-poetry) in 2018.\n\nPoesy is built on [Prosodic](http://github.com/quadrismegistus/prosodic), a metrical-phonological parser written in Python.\n\n## Installation\n\n### 1. Install Poesy\n\nInstall from pip (preferred):\n\n```\npip install poesy\n```\n\nOr install latest sources (advanced):\n\n```\ngit clone git@github.com:quadrismegistus/poesy.git\ncd poesy\npython setup.py develop\n```\n\n### 2. Install eSpeak (optional but recommended)\n\n[eSpeak](http://espeak.sourceforge.net/) is an open-source text-to-speech (TTS) engine for Windows and Unix systems (including Mac OS X). Poesy, built on [Prosodic](https://github.com/quadrismegistus/prosodic), uses it in order to sound out unfamiliar words. Otherwise, lines with words not contained in the CMU Pronunciation Dictionary will not be available for metrical parsing.\n\n[Download eSpeak for your operating system](http://espeak.sourceforge.net/download.html). Or, if you're running Mac OS X, install eSpeak with the [HomeBrew package manager](http://brew.sh/):\n\n```\nbrew install espeak\n```\n\n## Usage\n\n### Create a poem: `poem = Poem()`\n\n```python\nfrom poesy import Poem\n\n# create a Poem object by string\npoem = Poem(\"\"\"\nWhen in the chronicle of wasted time\nI see descriptions of the fairest wights,\nAnd beauty making beautiful old rhyme\nIn praise of ladies dead and lovely knights,\nThen, in the blazon of sweet beauty's best,\nOf hand, of foot, of lip, of eye, of brow,\nI see their antique pen would have express'd\nEven such a beauty as you master now.\nSo all their praises are but prophecies\nOf this our time, all you prefiguring;\nAnd, for they look'd but with divining eyes,\nThey had not skill enough your worth to sing:\nFor we, which now behold these present days,\nHad eyes to wonder, but lack tongues to praise.\n\"\"\")\n\n# or create a Poem object by pointing to a text file\nla_belle_dame = Poem(fn='poems/keats.la_belle_dame_sans_merci.txt')\n```\n\n### Summary of annotations: `poem.summary()`\n\nA quick tabular summary of most of the annotations Poesy has made on the poem.\n\n (#s,#l) parse rhyme #feet #syll #parse\n --------- ------------------------------------------------ ------- ------- ------- --------\n 1.1 WHEN|in.the|CHRON|i|CLE*|of|WAST|ed|TIME a 5 10 2\n 1.2 i|SEE|de|SCRIP|tions|OF*|the|FAI|rest|WIGHTS b 5 10 1\n 1.3 and|BEAU|ty|MAK|ing|BEAU|ti|FUL*|old*|RHYME a 5 10 3\n 1.4 in|PRAISE|of|LAD|ies|DEAD|and|LOVE|ly|KNIGHTS b 5 10 1\n 1.5 THEN|in.the|BLA|zon|OF*|sweet*|BEAU|tys|BEST c 5 10 8\n 1.6 of|HAND|of|FOOT|of|LIP|of|EYE|of|BROW d 5 10 1\n 1.7 i|SEE|their.an*|TIQUE.PEN*|would|HAVE|ex|PRESSD c 4 10 5\n 1.8 EV|en|SUCH*|a|BEAU|ty|AS*|you|MAS|ter|NOW d 6 11 1\n 1.9 so|ALL|their|PRAIS|es|ARE*|but|PRO|phe|CIES* e 5 10 3\n 1.1 OF*|this.our|TIME|all|YOU*|pre|FIG|ur|ING* f 5 10 15\n 1.11 and.for|THEY.LOOKD*|but|WITH*|di|VIN|ing|EYES e 4 10 3\n 1.12 THEY|had.not|SKILL|en|OUGH|your|WORTH|to|SING f 5 10 2\n 1.13 for|WE|which|NOW|be|HOLD|these|PRE|sent|DAYS e 5 10 1\n 1.14 had|EYES|to|WON|der|BUT*|lack*|TONGUES|to|PRAISE e 5 10 3\n\n\n estimated schema\n ----------\n meter: Iambic\n feet: Pentameter\n syllables: 10\n rhyme: Sonnet, Shakespearean (abab cdcd efefgg)\n\n### Statistics on annotations: `poem.statd`\n\nThis dictionary combines the following dictionaries.\n\n#### 1. Estimated line scheme (in feet): `poem.schemed_beat`\n\n```\n{'scheme': (5,),\n 'scheme_diff': 2,\n 'scheme_length': 1,\n 'scheme_repr': 'Pentameter',\n 'scheme_type': 'Invariable'}\n```\n\n#### 2. Estimated line scheme (in syllables): `poem.schemed_syll`\n\n```\n{'scheme': (10,),\n 'scheme_diff': 1,\n 'scheme_length': 1,\n 'scheme_repr': 10,\n 'scheme_type': 'Invariable'}\n```\n\n#### 3. Estimated metrical scheme: `poem.meterd`\n\n```\n{'ambiguity': 3.5,\n 'constraint_TOTAL': 0.14285714285714285,\n 'constraint_footmin-f-resolution': 0.007142857142857143,\n 'constraint_footmin-w-resolution': 0.0,\n 'constraint_strength_w=>-p': 0.0,\n 'constraint_stress_s=>-u': 0.10714285714285714,\n 'constraint_stress_w=>-p': 0.02857142857142857,\n 'length_avg_line': 10.071428571428571,\n 'length_avg_parse': 10.071428571428571,\n 'mpos_s': 0.5,\n 'mpos_ss': 0.007142857142857143,\n 'mpos_w': 0.4928571428571429,\n 'perc_lines_ending_s': 1.0,\n 'perc_lines_fourthpos_s': 0.8571428571428571,\n 'perc_lines_fourthpos_w': 0.14285714285714285,\n 'perc_lines_starting_s': 0.14285714285714285,\n 'perc_lines_starting_w': 0.8571428571428571,\n 'type_foot': 'binary',\n 'type_head': 'final',\n 'type_scheme': 'iambic'}\n```\n\n#### 4. Estimated rhyme scheme: `poem.rhymed`\n\n```\n{'rhyme_scheme': ('Sonnet, Shakespearean', 'abab cdcd efefgg'),\n 'rhyme_scheme_accuracy': 0.6363636363636364,\n 'rhyme_scheme_form': 'abab cdcd efefgg',\n 'rhyme_scheme_name': 'Sonnet, Shakespearean',\n 'rhyme_schemes': [(('Sonnet, Shakespearean', 'abab cdcd efefgg'),\n 0.6363636363636364),\n (('Sonnet A', 'abab cdcd eefeff'), 0.6153846153846154),\n (('Sonnet E', 'abab cbcd cdedee'), 0.4117647058823529),\n (('Quatrain And Triplet', 'ababccc'), 0.4),\n (('Sonnet C', 'ababacdc edefef'), 0.4)]}\n```\n\n### Iterate over lines: `poem.lined`\n\nEvery poem has a number of dictionaries, each keyed to a \"line ID\", a tuple of `(linenum, stanzanum)`.\n\n```python\n# The dictionary storing the string representation for the line:\nfor lineid,line_str in sorted(poem.lined.items()):\n print lineid,line_str\n \n# Use this dictionary to loop over prosodic's Line objects instead\nfor lineid,line_obj in sorted(poem.prosodic.items()):\n print lineid,line_obj.bestParse()\n \n# Other dictionaries\npoem.linenums # lineid -> line number within poem\npoem.linenums_bystanza # lineid -> line number within stanza\npoem.stanzanums # lineid -> stanza number\npoem.linelengths # lineid -> length of line\npoem.linelengths_bybeat # lineid -> length of line (in feet)\npoem.numparses # lineid -> number of plausible parses for line\npoem.rhymes # lineid -> rhyme scheme symbol\n```\n\n\n## Configure\n\nPoesy depends on [Prosodic](http://github.com/quadrismegistus/prosodic) for metrical parsing. Prosodic stores its configuration data in `~/prosodic_data/`; the `README.txt` there has more information.\n\nBy default, Poesy will use `~/prosodic_data/meters/meter_default.py` as its meter (its set of metrical constraints and behaviors). Open that file to read more details.\n\nTo specify a different meter, pass a meter name to a Poem object:\n\n```python\nfrom poesy import Poem\npoem = Poem(fn='poems/shakespeare_sonnets/sonnet-001.txt',\n meter='iambic_pentameter')\n```\nOr to the parse method:\n\n```python\npoem.parse(meter='iambic_pentameter')\n```\n\nThese will load the meter in `~/prosodic_data/meters/iambic_pentameter.py`.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/quadrismegistus/poesy", "keywords": "", "license": "MPL-2.0", "maintainer": "", "maintainer_email": "", "name": "poesy", "package_url": "https://pypi.org/project/poesy/", "platform": "", "project_url": "https://pypi.org/project/poesy/", "project_urls": { "Homepage": "https://github.com/quadrismegistus/poesy" }, "release_url": "https://pypi.org/project/poesy/0.2.3/", "requires_dist": null, "requires_python": "", "summary": "Poetic processing, for Python", "version": "0.2.3" }, "last_serial": 4808317, "releases": { "0.1.6": [ { "comment_text": "", "digests": { "md5": "6b3babab04828769e1ecfc2213784dff", "sha256": "5c5bf394aba0f8ec52c1255efdd91ee7d5c697eeef694fd84b50681998c8f952" }, "downloads": -1, "filename": "poesy-0.1.6.tar.gz", "has_sig": false, "md5_digest": "6b3babab04828769e1ecfc2213784dff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14069, "upload_time": "2018-11-19T07:26:19", "url": "https://files.pythonhosted.org/packages/44/d5/3d4dbcb78850cc2354c6351e0c9b97536a44d6d805d658ffcc71f6674603/poesy-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "dc9919b4f2c9ccaf23eac96d8c58af1c", "sha256": "a2cf209dadad668c7071ca22637910fbb1794ba795fd558c4498bd9511f88a63" }, "downloads": -1, "filename": "poesy-0.1.7.tar.gz", "has_sig": false, "md5_digest": "dc9919b4f2c9ccaf23eac96d8c58af1c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14114, "upload_time": "2018-11-19T07:32:12", "url": "https://files.pythonhosted.org/packages/76/a8/4d9a0f7457c8563abcd8846467d06a07b3cd0b98abbfbce5fde3f5040603/poesy-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "b035e570e8a2eb90be5a963fc64a9a96", "sha256": "4f0e2bff7457972133b44e5ffb029d0adca7691abce2ce3e3b4c366b25e5d73d" }, "downloads": -1, "filename": "poesy-0.1.8.tar.gz", "has_sig": false, "md5_digest": "b035e570e8a2eb90be5a963fc64a9a96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15007, "upload_time": "2018-11-19T08:28:14", "url": "https://files.pythonhosted.org/packages/00/ac/38fbcb9f8d1c9a832f67987bef1b31b71ff3c4629e82608e26a73faf4c6c/poesy-0.1.8.tar.gz" } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "37f2c575c2a439d005b6c5739459b7a9", "sha256": "a0292f571f0022943f7774eb353b4770a08826aeb9bfbc0fa6bb78c9de9faad5" }, "downloads": -1, "filename": "poesy-0.1.9.tar.gz", "has_sig": false, "md5_digest": "37f2c575c2a439d005b6c5739459b7a9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15396, "upload_time": "2019-02-11T16:52:51", "url": "https://files.pythonhosted.org/packages/4a/50/304e6d8d21de11888d96e8f32f32d8bc320141977d135a412813ee6590fc/poesy-0.1.9.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "23d2aa713a843d12b87e6b398cea449e", "sha256": "2e1a23a3b587a03a4621d1b7f4225615a3b42304642c9cd9c647c6127537e8a0" }, "downloads": -1, "filename": "poesy-0.2.0.tar.gz", "has_sig": false, "md5_digest": "23d2aa713a843d12b87e6b398cea449e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15598, "upload_time": "2019-02-11T17:02:09", "url": "https://files.pythonhosted.org/packages/8c/cb/caacbdb06f69dc7905fb28bcc8486fc659c5f8fcf4303f158851ae336b93/poesy-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "97e49e6260e4bcdf6fc9036767021d03", "sha256": "b25ecda84f68bbf1a7dbef1bd549fc0da0bae6a18a13990ffa23d60d165702a3" }, "downloads": -1, "filename": "poesy-0.2.1.tar.gz", "has_sig": false, "md5_digest": "97e49e6260e4bcdf6fc9036767021d03", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14669, "upload_time": "2019-02-11T17:08:45", "url": "https://files.pythonhosted.org/packages/95/f0/7832cd536dd834487cab5bee51c8cf0937e91f32be69c03396a5b88699dd/poesy-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "e7f969c611ba5887c0ab03ccc7cd4c85", "sha256": "8e682dc63be916e7d7da1860145e4b709eb8c2a7cd10e70f3c1d718fda1e1247" }, "downloads": -1, "filename": "poesy-0.2.2.tar.gz", "has_sig": false, "md5_digest": "e7f969c611ba5887c0ab03ccc7cd4c85", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14682, "upload_time": "2019-02-11T17:10:27", "url": "https://files.pythonhosted.org/packages/17/bc/8125279821dc16ce3a1ef9f11a6028852abb1f1747100c102ec9e24457d4/poesy-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "486f3e0cb78808c3a353760d84e5c213", "sha256": "475ff505d6e491556d087cc411238abff7756e63041db6d44f307bbf6b2d71de" }, "downloads": -1, "filename": "poesy-0.2.3.tar.gz", "has_sig": false, "md5_digest": "486f3e0cb78808c3a353760d84e5c213", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14679, "upload_time": "2019-02-11T22:44:40", "url": "https://files.pythonhosted.org/packages/da/b3/3336187cea75edccadb2ab42e5cd72c5ab29150fb343c9cafb3ab1318d00/poesy-0.2.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "486f3e0cb78808c3a353760d84e5c213", "sha256": "475ff505d6e491556d087cc411238abff7756e63041db6d44f307bbf6b2d71de" }, "downloads": -1, "filename": "poesy-0.2.3.tar.gz", "has_sig": false, "md5_digest": "486f3e0cb78808c3a353760d84e5c213", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14679, "upload_time": "2019-02-11T22:44:40", "url": "https://files.pythonhosted.org/packages/da/b3/3336187cea75edccadb2ab42e5cd72c5ab29150fb343c9cafb3ab1318d00/poesy-0.2.3.tar.gz" } ] }