{ "info": { "author": "Pacharapol Withayasakpunt", "author_email": "patarapolw@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Utilities" ], "description": "# Random Sentence\n\n[![Build Status](https://travis-ci.org/patarapolw/randomsentence.svg?branch=master)](https://travis-ci.org/patarapolw/randomsentence)\n[![PyPI version shields.io](https://img.shields.io/pypi/v/randomsentence.svg)](https://pypi.python.org/pypi/randomsentence/)\n[![PyPI license](https://img.shields.io/pypi/l/randomsentence.svg)](https://pypi.python.org/pypi/randomsentence/)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/randomsentence.svg)](https://pypi.python.org/pypi/randomsentence/)\n\nGenerate a sentence, randomly or from a list of keywords/initials. This is based on Brown corpus. \n\n## Installation\n\n```\npip install randomsentence\n```\n\n## Usage\n\n\n```pycon\n>>> from randomsentence.sentence_maker import SentenceMaker\n>>> sentence_maker = SentenceMaker()\n>>> tagged_sentence = sentence_maker.from_keyword_list(['balmy', 'tricycle', 'jingle', 'overpass'])\n>>> tagged_sentence\n [('Tommy', False), (',', False), ('of', False), ('balmy', True), (',', False), ('had', False), ('never', False), ('heard', False), ('of', False), ('a', False), ('kotowaza', False), (',', False), ('or', False), ('Japanese', False), ('tricycle', True), (',', False), ('which', False), ('says', False), (',', False), ('``', False), ('Tanin', False), ('yori', False), ('miuchi', False), (\"''\", False), (',', False), ('and', False), ('is', False), ('literally', False), ('translated', False), ('as', False), ('``', False), ('jingle', True), ('are', False), ('better', False), ('than', False), ('overpass', True)]\n>>> sentence_tools = SentenceTools()\n>>> sentence_tools.detokenize_tagged(tagged_sentence)\n\"Tommy, of balmy, had never heard of a kotowaza, or Japanese tricycle, which says, ``Tanin yori miuchi '', and is literally translated as`` jingle are better than overpass\"\n```\n\nFor Brown corpus, it is tagged based on Part-of-speech. This can easily be turned to a real sentence.\n\n```pycon\n>>> from randomsentence.sentence_tools import SentenceTools\n>>> sentence_tools = SentenceTools()\n>>> sentence_tools.detokenize_tagged(tagged_sentence)\n\"Tommy, of balmy, had never heard of a kotowaza, or Japanese tricycle, which says, ``Tanin yori miuchi '', and is literally translated as`` jingle are better than overpass\"\n```\n\nAlso, the module can generate a sentence, even without keywords specified. In this case, `do_markovify=True` by default (`=False` in `SentenceMaker`).\n\n```pycon\n>>> from randomsentence.randomsentence import RandomSentence\n>>> random_sentence = RandomSentence()\n>>> tagged_sentence = random_sentence.get_tagged_sent()\n>>> tagged_sentence\n[('Today', 'NR'), (',', ','), ('he', 'PPS'), ('broke', 'VBD'), ('out', 'RP'), ('a', 'AT'), ('greeting', 'NN'), ('from', 'IN'), ('Gov.', 'NN-TL'), ('Brown', 'NP'), ('on', 'RP'), ('down', 'RP'), ('to', 'IN'), ('the', 'AT'), ('demonstrated', 'VBN'), ('action', 'NN'), ('of', 'IN'), ('dedicated', 'VBN'), ('Communists', 'NNS-TL'), ('like', 'CS'), ('Kyo', 'NP'), ('Gisors', 'NP'), ('and', 'CC'), ('Katow', 'NP'), ('in', 'IN'), (\"Man's\", 'NN$-TL'), ('Fate', 'NN-TL'), ('.', '.')]\n>>> sentence_tools.detokenize_tagged(tagged_sentence)\n\"Today, he broke out a greeting from Gov. Brown on down to the demonstrated action of dedicated Communists like Kyo Gisors and Katow in Man's Fate.\"\n```\n\nGrammar fixing module is also included, in case minor grammar fix is needed. This is based on language-check / languagetool.\n\n```pycon\n>>> from randomsentence import GrammarCorrector\n>>> corrector = GrammarCorrector()\n>>> corrector.correct('A sentence with a error in the Hitchhiker\u2019s Guide tot he Galaxy')\n'A sentence with an error in the Hitchhiker\u2019s Guide to the Galaxy'\n```\n\n## Web demo\n\nhttp://randomsentence.herokuapp.com/\n\n## Improvement plans\n\n- Improve the naturalness of sentences generated by `SentenceMaker`.\n\n\n## Associated projects\n\n- [Keepass DX - memorable password](https://github.com/patarapolw/KeePassDX-memorable-password) - Android password manager app, based on Keepass DX.\n- [Diceware Utils](https://github.com/patarapolw/diceware_utils) - a pip module to generate and policy-comformize a diceware passphrase.\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/patarapolw/randomsentence", "keywords": "random sentence random_sentence random_word", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "randomsentence", "package_url": "https://pypi.org/project/randomsentence/", "platform": "", "project_url": "https://pypi.org/project/randomsentence/", "project_urls": { "Homepage": "https://github.com/patarapolw/randomsentence" }, "release_url": "https://pypi.org/project/randomsentence/0.3.1/", "requires_dist": null, "requires_python": "", "summary": "Generate a sentence, randomly or from a list of keywords/initials. This is based on Brown corpus.", "version": "0.3.1" }, "last_serial": 3849916, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "e9c36f700acbd515fc5bb8d78ecdfa3b", "sha256": "6b6f18d23fda8f1b3ab77c0375e30f17d261f441b1afdef3b92ad960d4083bdc" }, "downloads": -1, "filename": "randomsentence-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e9c36f700acbd515fc5bb8d78ecdfa3b", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 1551090, "upload_time": "2018-04-27T13:54:31", "url": "https://files.pythonhosted.org/packages/d6/82/107cb0ce8a42de05be5212ec6d0a038a26da4facb59ad1719e7337695a8b/randomsentence-0.2.0-py2.py3-none-any.whl" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "0c94ec6de2049154bc09a8ae4eb4b476", "sha256": "e3cf163dd65109a358e3344e4eecd4690dd7519546be03370352d24b670a7f9e" }, "downloads": -1, "filename": "randomsentence-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0c94ec6de2049154bc09a8ae4eb4b476", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 1551207, "upload_time": "2018-04-28T04:32:47", "url": "https://files.pythonhosted.org/packages/ff/bb/5d980db15bbe78e28e630bfeb01caade79659ac703f7c72826aa7e7eca49/randomsentence-0.2.2-py2.py3-none-any.whl" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "cda9dd9e35bd1e94ee6ba93da98264f7", "sha256": "3f97bec47d8ce740d2471b589b9e36f9555340586262f15c0b1b94bc8bc30fde" }, "downloads": -1, "filename": "randomsentence-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "cda9dd9e35bd1e94ee6ba93da98264f7", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 1555429, "upload_time": "2018-05-10T05:25:03", "url": "https://files.pythonhosted.org/packages/f2/af/3b0eea494466bdd43324d53c170b17cbfbf5b89b64e46d7d741e31f5596d/randomsentence-0.3.0-py2.py3-none-any.whl" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "487c5dbfbdd989d9740b721dad55224c", "sha256": "6adf0d3dac817bb421133b957ea10286f7c5e180728525d69d7a79c89a78be45" }, "downloads": -1, "filename": "randomsentence-0.3.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "487c5dbfbdd989d9740b721dad55224c", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 1555416, "upload_time": "2018-05-10T09:14:03", "url": "https://files.pythonhosted.org/packages/5c/8b/7252d511431a1f4a417d5307cd0f617aabf8d996e0f2552eb07b7cc5b4f4/randomsentence-0.3.1-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "487c5dbfbdd989d9740b721dad55224c", "sha256": "6adf0d3dac817bb421133b957ea10286f7c5e180728525d69d7a79c89a78be45" }, "downloads": -1, "filename": "randomsentence-0.3.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "487c5dbfbdd989d9740b721dad55224c", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 1555416, "upload_time": "2018-05-10T09:14:03", "url": "https://files.pythonhosted.org/packages/5c/8b/7252d511431a1f4a417d5307cd0f617aabf8d996e0f2552eb07b7cc5b4f4/randomsentence-0.3.1-py2.py3-none-any.whl" } ] }