{ "info": { "author": "Nicholas Morley", "author_email": "nick.morley111@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# visualise-spacy-tree\n\nAn alternative to [SpaCy's](https://spacy.io) [visualizer](https://spacy.io/usage/visualizers#dep), built on [GraphViz](https://graphviz.gitlab.io/). \n\n![Custom plot image](https://github.com/cyclecycle/visualise-spacy-tree/blob/master/example_plots/custom_plot.png)\n\n## Prerequisites\n\n- You need [GraphViz](https://graphviz.gitlab.io/download/) installed.\n\n## Installation\n\nWith pip:\n\n```bash\npip install visualise-spacy-tree\n```\n\nOr from source:\n\n```bash\ngit clone https://github.com/cyclecycle/visualise-spacy-tree.git visualise_spacy_tree\ncd visualise_spacy_tree\npython setup.py install\n```\n\n## Usage\n\n```python\n\n# Parse a string to create SpaCy Doc object\nimport en_core_web_sm\n\ntext = 'Forging involves the shaping of metal using localized compressive forces.'\n\nnlp = en_core_web_sm.load()\ndoc = nlp(text)\n\n# Create the plot\nimport visualise_spacy_tree\nplot = visualise_spacy_tree.plot(doc)\n\n# Write it to a file (it's png format)\nwith open('parse_tree.png', 'wb') as f:\n f.write(plot)\n\n# If you're using Jupyter notebook, you can render it inline\nfrom IPython.display import Image, display\ndisplay(Image(plot))\n\n# Override node attributes like so\nfrom spacy.tokens import Token\nToken.set_extension('plot', default={}) # Create a token underscore extension\nfor token in doc:\n node_text = '{0} [{1}])'.format(token.orth_, token.i)\n token._.plot['text'] = node_text\n if token.dep_ == 'ROOT':\n token._.plot['color'] = 'green'\n\n'''\nYou can set any valid GraphViz dot attribute in 'plot'.\nSee GraphViz docs for reference of possible node attributes:\nhttps://graphviz.gitlab.io/_pages/doc/info/attrs.html\n'''\n\n```\n\n## Running the tests\n\n```bash\npytest\n```\n\n## Acknowledgements\n\nUses:\n\n- [pydot](https://github.com/pydot/pydot)\n\n## Contributions\n\nAre welcome :)\n\n", "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/cyclecycle/visualise-spacy-tree", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "visualise-spacy-tree-0.0.1", "package_url": "https://pypi.org/project/visualise-spacy-tree-0.0.1/", "platform": "", "project_url": "https://pypi.org/project/visualise-spacy-tree-0.0.1/", "project_urls": { "Homepage": "https://github.com/cyclecycle/visualise-spacy-tree" }, "release_url": "https://pypi.org/project/visualise-spacy-tree-0.0.1/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "Create dependency tree plots from SpaCy Doc objects", "version": "0.0.1" }, "last_serial": 5309446, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "3ad308f1f61fde40c7030ffcfbc0ca48", "sha256": "6d4a3a7ccf0327211d4dfe6db671403369aeda168fbca4b19f841426c1d5a8d8" }, "downloads": -1, "filename": "visualise_spacy_tree_0.0.1-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "3ad308f1f61fde40c7030ffcfbc0ca48", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3763, "upload_time": "2019-05-23T20:53:50", "url": "https://files.pythonhosted.org/packages/a0/cd/2e94f6bf4b4db74c240350d618fac98a240948ff2c56c8dad6cef490178d/visualise_spacy_tree_0.0.1-0.0.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3ad308f1f61fde40c7030ffcfbc0ca48", "sha256": "6d4a3a7ccf0327211d4dfe6db671403369aeda168fbca4b19f841426c1d5a8d8" }, "downloads": -1, "filename": "visualise_spacy_tree_0.0.1-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "3ad308f1f61fde40c7030ffcfbc0ca48", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3763, "upload_time": "2019-05-23T20:53:50", "url": "https://files.pythonhosted.org/packages/a0/cd/2e94f6bf4b4db74c240350d618fac98a240948ff2c56c8dad6cef490178d/visualise_spacy_tree_0.0.1-0.0.1-py3-none-any.whl" } ] }