{ "info": { "author": "Saad Sahibjan", "author_email": "saad.sahibjan@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2" ], "description": "treetojson\n==========\n\n.. image:: https://travis-ci.org/saadsahibjan/treetojson.svg?branch=master\n :target: https://travis-ci.org/saadsahibjan/treetojson\n \n- Simple Library to map a tree structure to a valid JSON object.\n- This treetojson module is `published on the Python Package\n Index `__\n\nSummary\n=======\n\ntreetojson is a helpful in converting a given tree structure into a\nvalid JSON. Using this a tree strcuture can be easily interpreted to a\nvalid JSON. Further explaination on how the input should be given and\nthe output are explained under Basic Usage. This is pure Python code\nwith a single dependency of `NLTK `__. This can\nalso be used along with `NLTK\nRegexpParser `__.\n\nThis was a mainly developed due to a problem faced during a project on\nPart-of-Speech (POS) tagger which is a part of Natural Language\nProcessing. When a tree structure is created with specific tags of it\nusing the NLTK module, the tree structure was not able to map\naccordingly to a JSON object using the existing libraries. The problem\noccurred due to the existence of repetitive 'key' since tags are fixed\nfor languages. Because of such a problem this was initially developed to\ncome out of this problem and was later decided to publish as an open\nsource Python module.\n\nFurther treetojson maintains the order provided. It does'nt mix up the\norder. The output given will be a readable sentence as its given in to\ntreetojson. The output given by treetojson can be a respond to a HTTP\nrequest, and can be used, manipulated and display appropriately in the\nfront-end.\n\nInstallation\n============\n\nThe treetojson module is `published on the Python Package\nIndex `__, so you can install\nit using ``pip`` or ``easy_install``.\n\n::\n\n pip install treetojson\n\nor\n\n::\n\n easy_install treetojson\n\nThat should be all you need to go.\n\nBasic Usage\n===========\n\nExample1\n--------\n\nWhen a list containing words and it's appropriate tags are provided as\nfollow:\n\n::\n\n >>> import treetojson\n >>> sentence = [('Everyone', 'NN'), ('knows', 'VBZ'), ('an', 'DT'), ('Elephant', 'NN'), ('is', 'VBZ'), ('larger', 'JJR'),\n ('than', 'IN'), ('a', 'DT'), ('Dog', 'NN')]\n >>> print treetojson.get_json(data=sentence)\n {u'SENTENCE': [{u'NN': u'Everyone'}, {u'VBZ': u'knows'}, {u'DT': u'an'}, {u'NN': u'Elephant'}, {u'VBZ': u'is'}, \n {u'JJR': u'larger'}, {u'IN': u'than'}, {u'DT': u'a'}, {u'NN': u'Dog'}]}\n\nExample2\n--------\n\nWhen a list containing words with appropriate tags along with a grammar\nis provided:\n\n::\n\n >>> import treetojson\n >>> sentence = [('Everyone', 'NN'), ('knows', 'VBZ'), ('an', 'DT'), ('Elephant', 'NN'), ('is', 'VBZ'), ('larger', 'JJR'), \n ('than', 'IN'), ('a', 'DT'), ('Dog', 'NN')]\n >>> grammar = \"\"\"\n NP: {?*+}\n CP: {}\n VERB: {}\n THAN: {}\n COMP: {
??
?
?}\n \"\"\"\n >>> print treetojson.get_json(data=sentence, grammar=grammar)\n {u'SENTENCE': [{u'NP': [{u'NN': u'Everyone'}]}, {u'VERB': [{u'VBZ': u'knows'}]}, {u'COMP': [{u'DT': u'an'}, \n {u'NP': [{u'NN': u'Elephant'}]}, {u'VERB': [{u'VBZ': u'is'}]}, {u'CP': [{u'JJR': u'larger'}]}, \n {u'THAN': [{u'IN': u'than'}]}, {u'DT': u'a'}, {u'NP': [{u'NN': u'Dog'}]}]}]}\n\nExample3\n--------\n\nWhen words and labels or tags are seperately provided:\n\n::\n\n >>> import treetojson\n >>> words = ['Everyone', 'knows', 'an', 'Elephant', 'is', 'larger', 'than', 'a', 'Dog']\n >>> labels = ['NN', 'VBZ', 'DT', 'NN', 'VBZ', 'JJR', 'IN', 'DT', 'NN']\n >>> print treetojson.get_json(words=words, label=labels)\n {u'SENTENCE': [{u'NN': u'Everyone'}, {u'VBZ': u'knows'}, {u'DT': u'an'}, {u'NN': u'Elephant'}, {u'VBZ': u'is'}, \n {u'JJR': u'larger'}, {u'IN': u'than'}, {u'DT': u'a'}, {u'NN': u'Dog'}]}\n\nExample4\n--------\n\nWhen words and labels or tags seperately along with a grammar is\nprovided:\n\n::\n\n >>> import treetojson\n >>> words = ['Everyone', 'knows', 'an', 'Elephant', 'is', 'larger', 'than', 'a', 'Dog']\n >>> labels = ['NN', 'VBZ', 'DT', 'NN', 'VBZ', 'JJR', 'IN', 'DT', 'NN']\n >>> grammar = \"\"\"\n NP: {?*+}\n CP: {}\n VERB: {}\n THAN: {}\n COMP: {
??
?
?}\n \"\"\"\n >>> print treetojson.get_json(words=words, label=labels, grammar=grammar)\n {u'SENTENCE': [{u'NP': [{u'NN': u'Everyone'}]}, {u'VERB': [{u'VBZ': u'knows'}]}, {u'COMP': [{u'DT': u'an'}, \n {u'NP': [{u'NN': u'Elephant'}]}, {u'VERB': [{u'VBZ': u'is'}]}, {u'CP': [{u'JJR': u'larger'}]}, \n {u'THAN': [{u'IN': u'than'}]}, {u'DT': u'a'}, {u'NP': [{u'NN': u'Dog'}]}]}]}\n\nDebugging\n=========\n\nYou can enable debugging information.\n\n::\n\n >>> import treetojson\n >>> treetojson.set_debug()\n Debug mode is on. Events are logged at: treetojson.log\n\nTo turn debug mode off, call ``set_debug`` with an argument of\n``False``:\n\n::\n\n >>> treetojson.set_debug(False)\n Debug mode is off.\n\nIf you encounter any errors in the code, please file an issue on github:\nhttps://github.com/saadsahibjan/treetojson/issues\n\nContributing guide\n==================\n\nUse guidelines provided in\n`CONTRIBUTING.md `__\n\nLicense\n=======\n\n`MIT `__\n\nAuthor\n======\n\n- Author: Saad Sahibjan\n- Email: saadsahibjan@gmail.com\n- Repository: https://github.com/saadsahibjan/treetojson", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/saadsahibjan/treetojson", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "treetojson", "package_url": "https://pypi.org/project/treetojson/", "platform": "Cross-platform", "project_url": "https://pypi.org/project/treetojson/", "project_urls": { "Homepage": "https://github.com/saadsahibjan/treetojson" }, "release_url": "https://pypi.org/project/treetojson/0.9.1/", "requires_dist": null, "requires_python": "", "summary": "Converts a tree structure into a valid JSON", "version": "0.9.1" }, "last_serial": 3412586, "releases": { "0.0.1": [], "0.0.10": [ { "comment_text": "", "digests": { "md5": "56f426ecb6b554060f592be389a84a42", "sha256": "1fa27beb97c7896143f90d2e5ddefb88a6099632751c4f899adf913e116224ff" }, "downloads": -1, "filename": "treetojson-0.0.10.tar.gz", "has_sig": false, "md5_digest": "56f426ecb6b554060f592be389a84a42", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4518, "upload_time": "2017-01-25T19:39:31", "url": "https://files.pythonhosted.org/packages/fa/6b/dad8f2952f27bbe93e4b5dde523a849a6be5ccf1aaf55647e191ce0baecc/treetojson-0.0.10.tar.gz" } ], "0.0.11": [ { "comment_text": "", "digests": { "md5": "c0b1651f2aba7bb175dbfbe73152c59d", "sha256": "d673915f2c600185955c849a95742e31f75cf9ec40728d1ce090d8a569d53912" }, "downloads": -1, "filename": "treetojson-0.0.11.tar.gz", "has_sig": false, "md5_digest": "c0b1651f2aba7bb175dbfbe73152c59d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4555, "upload_time": "2017-01-25T19:42:08", "url": "https://files.pythonhosted.org/packages/1d/6d/e395dfee0ec29ffb9133819f2b68405bf294d661c61c06aac2bf8fa8caf4/treetojson-0.0.11.tar.gz" } ], "0.0.12": [ { "comment_text": "", "digests": { "md5": "956b9704710fda1be92df8707c481959", "sha256": "126445b8b93b160014b6e9d49842d1551f5c0d48c18c7921270b4da614cca8ad" }, "downloads": -1, "filename": "treetojson-0.0.12.tar.gz", "has_sig": false, "md5_digest": "956b9704710fda1be92df8707c481959", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4557, "upload_time": "2017-01-25T19:42:56", "url": "https://files.pythonhosted.org/packages/1a/a8/44c1c2a34dede5c7c7f3da7301c5b045dc6735d3d0d481e8b9925411c510/treetojson-0.0.12.tar.gz" } ], "0.0.13": [ { "comment_text": "", "digests": { "md5": "05a1a8238ef2735fd314c2902bede6d0", "sha256": "3ad573cdc1378027f307bed9d2641cf5aa99192f6aff2567041fbb2340fc3d54" }, "downloads": -1, "filename": "treetojson-0.0.13.tar.gz", "has_sig": false, "md5_digest": "05a1a8238ef2735fd314c2902bede6d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4564, "upload_time": "2017-01-25T19:48:52", "url": "https://files.pythonhosted.org/packages/f6/e6/b4238476e688fe2f2df0bc209aab43f3eb948acf63ac680841127f6d02dc/treetojson-0.0.13.tar.gz" } ], "0.0.14": [ { "comment_text": "", "digests": { "md5": "ac105c10f7107a7651cf876a17aadccb", "sha256": "c00507d30333632f286feda97aec1c34ebdd30e56bf33838612168691f28b2cb" }, "downloads": -1, "filename": "treetojson-0.0.14.tar.gz", "has_sig": false, "md5_digest": "ac105c10f7107a7651cf876a17aadccb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4537, "upload_time": "2017-01-25T19:53:39", "url": "https://files.pythonhosted.org/packages/6e/06/3ebe818c4148c543643c0e0230d1d1cd63e13eb1f608e3b919dc6df176d4/treetojson-0.0.14.tar.gz" } ], "0.0.15": [ { "comment_text": "", "digests": { "md5": "720358f3339001599169fc3ea02ebe0b", "sha256": "8e3751937f1c68c40f6f53cdfda52bc40a16729d03d1c20704c6503694e98d3c" }, "downloads": -1, "filename": "treetojson-0.0.15.tar.gz", "has_sig": false, "md5_digest": "720358f3339001599169fc3ea02ebe0b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4831, "upload_time": "2017-01-26T09:24:16", "url": "https://files.pythonhosted.org/packages/ff/a6/df41c913cab27ddad6bf153253755b496ba41003a281f3b694436164bb5d/treetojson-0.0.15.tar.gz" } ], "0.0.16": [ { "comment_text": "", "digests": { "md5": "60c27d3ea226a43d76f57abecfc283e5", "sha256": "4bfead5e0e27cd6cd7fbbb508acaef5c71a47f1ac68883a975ffe58b4135f90f" }, "downloads": -1, "filename": "treetojson-0.0.16.tar.gz", "has_sig": false, "md5_digest": "60c27d3ea226a43d76f57abecfc283e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4917, "upload_time": "2017-01-26T09:25:22", "url": "https://files.pythonhosted.org/packages/b6/c0/bfc47606e4df5ddef3f3403c7bc442b935dc6f17453ad92e649b972f8ecd/treetojson-0.0.16.tar.gz" } ], "0.0.17": [ { "comment_text": "", "digests": { "md5": "fc1533c2d77aa1946876aade156caba2", "sha256": "8618669732e319098e75aac0f38244d494a62545e4b7e92df37b086b207204c4" }, "downloads": -1, "filename": "treetojson-0.0.17.tar.gz", "has_sig": false, "md5_digest": "fc1533c2d77aa1946876aade156caba2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4951, "upload_time": "2017-01-26T09:40:41", "url": "https://files.pythonhosted.org/packages/16/45/b642cdf59d8efbd825baaaa6c0f3487f0f4e7b37d60bf2f81fe5848d4767/treetojson-0.0.17.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "9dd777674aadbe6cf6113a37ee39e5bd", "sha256": "bd1709086d0a9c3a6630e773e25859649288c9ec63bf6862630227c6a83908ce" }, "downloads": -1, "filename": "treetojson-0.0.2.tar.gz", "has_sig": false, "md5_digest": "9dd777674aadbe6cf6113a37ee39e5bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1874, "upload_time": "2017-01-25T12:14:44", "url": "https://files.pythonhosted.org/packages/d4/37/20d630424f574ddbad7ff33615abe06e4d6a8c69b81ec308c0253705ffce/treetojson-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "6fd48492f5323151a65849b51113a7f3", "sha256": "d0d0b9475511d0fd17b9a08b8b2284f55e5d53b259a041dcf1c2ef4dac1d90d5" }, "downloads": -1, "filename": "treetojson-0.0.3.tar.gz", "has_sig": false, "md5_digest": "6fd48492f5323151a65849b51113a7f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1849, "upload_time": "2017-01-25T12:19:08", "url": "https://files.pythonhosted.org/packages/86/62/d069e88c4a1110bcdbdbe931ad16ae40b08c47dda9a27fd3e6669b97ae6e/treetojson-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "1f72b75a2477ee5434d8c50f5f3ae3e7", "sha256": "0ae1acf5a53cc43ddfb6b2f2c2cd376b7a0bb8be4750ee688b24e8e63c5207a9" }, "downloads": -1, "filename": "treetojson-0.0.4.tar.gz", "has_sig": false, "md5_digest": "1f72b75a2477ee5434d8c50f5f3ae3e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4105, "upload_time": "2017-01-25T18:39:52", "url": "https://files.pythonhosted.org/packages/fc/cb/4b071b93b898ecd00193f595ce8827b07cb1e3140ceab8491697a616044f/treetojson-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "63f4454fe8dd2b48e4292056b09311c3", "sha256": "0e808f7b607ac22b6769118d60ef3f1e043736b6b2d3d294847bbc0e82ca0dd2" }, "downloads": -1, "filename": "treetojson-0.0.5.tar.gz", "has_sig": false, "md5_digest": "63f4454fe8dd2b48e4292056b09311c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4380, "upload_time": "2017-01-25T18:53:40", "url": "https://files.pythonhosted.org/packages/12/44/0cef92b903731a3e2789844a0c7474d596676d2bf379db20b819b6e2726a/treetojson-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "ec14f06b074734e507f90c67b7123e74", "sha256": "cd4f44a6a0bab16b33e42556d3f1408577c69a2188abdb36aff8339cd150e3ec" }, "downloads": -1, "filename": "treetojson-0.0.6.tar.gz", "has_sig": false, "md5_digest": "ec14f06b074734e507f90c67b7123e74", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4382, "upload_time": "2017-01-25T18:54:49", "url": "https://files.pythonhosted.org/packages/c9/17/ea275df127013a1e5b01ad2fca941916322fb835c992162051d3f1dd190b/treetojson-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "5ad3a72bc20ce9a4f0507818f1ec10fc", "sha256": "54b26e325649c756cc8144c430f7d421dcafaac46dceae5353af0f0435414115" }, "downloads": -1, "filename": "treetojson-0.0.7.tar.gz", "has_sig": false, "md5_digest": "5ad3a72bc20ce9a4f0507818f1ec10fc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4561, "upload_time": "2017-01-25T19:18:06", "url": "https://files.pythonhosted.org/packages/46/ad/f673b98acc0188ed853e37020a105c56b539c6acb56800044ba0fa621a2f/treetojson-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "c1cb64365896dda3cbaaba5359224a16", "sha256": "14ab339ca269266f605dce430761983ed333394ccd4899d26601da96e4b091f1" }, "downloads": -1, "filename": "treetojson-0.0.8.tar.gz", "has_sig": false, "md5_digest": "c1cb64365896dda3cbaaba5359224a16", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4212, "upload_time": "2017-01-25T19:20:35", "url": "https://files.pythonhosted.org/packages/1b/90/ee576aeb64131dda230152680012c2b1463e03a411ef199bb02d17f3677d/treetojson-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "3990df8950fa49563a75d7f7a5797a11", "sha256": "adf1bfa8d10badac90be1d5d6f95cf9ca645c9192fbbe5e0e751cb4ff30e1bee" }, "downloads": -1, "filename": "treetojson-0.0.9.tar.gz", "has_sig": false, "md5_digest": "3990df8950fa49563a75d7f7a5797a11", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4572, "upload_time": "2017-01-25T19:21:59", "url": "https://files.pythonhosted.org/packages/94/fb/71561078ac8257623fcb1541d269186ba213920b628f10111bfe19561ff1/treetojson-0.0.9.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "f3f028d6885239359762db0d35f7b147", "sha256": "2de544160ab5c8294f567abfae52cd6f27308c99be302e13b104783ac8771a5f" }, "downloads": -1, "filename": "treetojson-0.9.1.tar.gz", "has_sig": false, "md5_digest": "f3f028d6885239359762db0d35f7b147", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4973, "upload_time": "2017-12-13T08:41:09", "url": "https://files.pythonhosted.org/packages/90/1f/727f54818a1dce2c95a0a044abd132044f7d7abc612f08b5dc1b15293558/treetojson-0.9.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f3f028d6885239359762db0d35f7b147", "sha256": "2de544160ab5c8294f567abfae52cd6f27308c99be302e13b104783ac8771a5f" }, "downloads": -1, "filename": "treetojson-0.9.1.tar.gz", "has_sig": false, "md5_digest": "f3f028d6885239359762db0d35f7b147", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4973, "upload_time": "2017-12-13T08:41:09", "url": "https://files.pythonhosted.org/packages/90/1f/727f54818a1dce2c95a0a044abd132044f7d7abc612f08b5dc1b15293558/treetojson-0.9.1.tar.gz" } ] }