CUI-based Tree Visualizer for Universal Dependencies and Immediate Catena Analysis
Project description
deplacy
Simple dependency visualizer for spaCy, UniDic2UD, Stanza, NLP-Cube, Trankit, 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,WordRight=False,CatenaAnalysis=True,file=None,Japanese=False)
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
or WordRight=True
may work well. CatenaAnalysis=False
disables Immediate Catena Analysis.
deplacy.serve(doc,port=5000,RtoL=False)
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,RtoL=False)
returns raw DOT string for graphviz.Source
.
Other usages
- Afrikaans
- アイヌイタㇰ
- العربية
- Беларуская
- Български
- Català
- ⲙⲉⲧⲣⲉⲙⲛⲭⲏⲙⲓ
- Čeština
- Cymraeg
- Dansk
- Deutsch
- Ελληνικά
- English
- Español
- Eesti
- Euskara
- فارسی
- Suomi
- Føroyskt
- Français
- Gaeilge
- Gàidhlig
- Galego
- Ἑλληνική
- עברית
- हिन्दी
- Hrvatski
- Magyar
- Հայերեն
- Bahasa Indonesia
- Íslenska
- Italiano
- 日本語
- Қазақша
- 한국어
- Latina
- Lietuvių
- Latviešu
- 漢文/文言文
- Македонски
- Malti
- Norsk(bokmål)
- Nederlands
- Nynorsk
- Polski
- Português
- Română
- Русский
- Slovenčina
- Slovenščina
- Српски
- Srpski
- Svenska
- தமிழ்
- ไทย
- Tagalog
- Türkçe
- Українська
- Tiếng Việt
- Wolof
- 中文(简体)
- 中文(繁體)
Visualization examples
deplacy.render()
deplacy.serve()
deplacy.dot()
Installation
pip install deplacy
You need to install spaCy, UniDic2UD, Stanza, NLP-Cube, or Trankit separately. For Google Colaboratories, please follow (and edit) the templates shown below.
Templates for Google Colaboratory
- Afrikaans
- アイヌイタㇰ
- العربية
- Беларуская
- Български
- Català
- ⲙⲉⲧⲣⲉⲙⲛⲭⲏⲙⲓ
- Čeština
- Cymraeg
- Dansk
- Deutsch
- Ελληνικά
- English
- Español
- Eesti
- Euskara
- فارسی
- Suomi
- Føroyskt
- Français
- Gaeilge
- Gàidhlig
- Galego
- Ἑλληνική
- עברית
- हिन्दी
- Hrvatski
- Magyar
- Հայերեն
- Bahasa Indonesia
- Íslenska
- Italiano
- 日本語
- Қазақша
- 한국어
- Latina
- Lietuvių
- Latviešu
- 漢文/文言文
- Македонски
- Malti
- Norsk(bokmål)
- Nederlands
- Nynorsk
- Polski
- Português
- Română
- Русский
- Slovenčina
- Slovenščina
- Српски
- Srpski
- Svenska
- தமிழ்
- ไทย
- Tagalog
- Türkçe
- Українська
- Tiếng Việt
- Wolof
- 中文(简体)
- 中文(繁體)
Author
Koichi Yasuoka (安岡孝一)
Reference
- Koichi Yasuoka: deplacy: a CUI-based tree visualizer for Universal Dependencies, IPSJ Symposium Series, Vol.2020, No.1 (December 2020), pp.95-100.
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
File details
Details for the file deplacy-2.1.0-py3-none-any.whl
.
File metadata
- Download URL: deplacy-2.1.0-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7db42fbcd9ae95cfdf5a0990302bf28c8374f5e2e7b35eadb94768f436539999 |
|
MD5 | 7c8f21c7139f6c64efd9e8a6cdb204b3 |
|
BLAKE2b-256 | c1fff3a9cf2ee8f5478faccab4ea3f83803556edc37948e2853261bf4c5bed84 |