CUI-based Tree Visualizer for Universal Dependencies and Immediate Catena Analysis
Project description
deplacy
Simple dependency visualizer for spaCy, UniDic2UD, Stanza, NLP-Cube, etc.
Usage with spaCy
>>> import spacy
>>> nlp=spacy.load("en_core_web_sm")
>>> doc=nlp("I saw a horse yesterday which had no name.")
>>> import deplacy
>>> deplacy.render(doc)
I PRON <══════════════╗ nsubj
saw VERB ═══════════╗═╗═╝═╗ ROOT
a DET <════════╗ ║ ║ ║ det
horse NOUN ═══════╗═╝<╝ ║ ║ dobj
yesterday NOUN <══════║═════╝ ║ npadvmod
which DET <════╗ ║ ║ nsubj
had AUX ═══╗═╝<╝ ║ relcl
no DET <╗ ║ ║ det
name NOUN ═╝<╝ ║ dobj
. PUNCT <════════════════╝ punct
deplacy.render(doc,BoxDrawingWidth=1,EnableCR=False,CatenaAnalysis=True,file=None) renders doc on a terminal. For old terminals, whose Box Drawing characters are "fullwidth", BoxDrawingWidth=2 nicely works. For several languages with "proportional" characters, EnableCR=True may work well. CatenaAnalysis=False disables Immediate Catena Analysis.
deplacy.serve(doc,port=5000) invokes a simple web-server to visualize doc with SVG. Try to connect http://127.0.0.1:5000 with your local browser. For Google Colaboratory, port=None visualizes doc directly on the notebook.
deplacy.dot(doc) returns raw DOT string for graphviz.Source.
Other usages
- Català
- Čeština
- Dansk
- Deutsch
- English
- Español
- Eesti
- Suomi
- Français
- Gaeilge
- Galego
- Bahasa Indonesia
- Italiano
- 日本語
- 한국어
- Lietuvių
- 漢文/文言文
- Norsk(bokmål)
- Nederlands
- Nynorsk
- Polski
- Português
- Русский
- Svenska
- Tiếng Việt
- 中文(简体)
- 中文(繁體)
Visualization examples
deplacy.render()
deplacy.serve()
deplacy.dot()
Installation
pip install deplacy
You need to install spaCy, UniDic2UD, Stanza, or NLP-Cube separately. For Google Colaboratories, please follow (and edit) the templates shown below.
Templates for Google Colaboratory
- Català
- Čeština
- Dansk
- Deutsch
- English
- Español
- Eesti
- Suomi
- Français
- Gaeilge
- Galego
- Bahasa Indonesia
- Italiano
- 日本語
- 한국어
- Lietuvių
- 漢文/文言文
- Norsk(bokmål)
- Nederlands
- Nynorsk
- Polski
- Português
- Русский
- Svenska
- Tiếng Việt
- 中文(简体)
- 中文(繁體)
Author
Koichi Yasuoka (安岡孝一)
Reference
- 安岡孝一: Universal Dependenciesの拡張にもとづく古典中国語(漢文)の直接構成鎖解析の試み, 情報処理学会研究報告, Vol.2019-CH-120『人文科学とコンピュータ』, No.1 (2019年5月11日), pp.1-8.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deplacy-1.3.3-py3-none-any.whl.
File metadata
- Download URL: deplacy-1.3.3-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.0.0 requests-toolbelt/0.8.0 tqdm/4.44.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
545baf4953c480139a88140c7fb8cdb1f67217530af5765981673766edab13d6
|
|
| MD5 |
07cd78540de36e61bd1a04043a31f79a
|
|
| BLAKE2b-256 |
3e5a5961432a543e706b89cc6e6fd5d68bc3c700de0566c82b5c5a4e61f73fad
|