Skip to main content

CUI-based Tree Visualizer for Universal Dependencies and Immediate Catena Analysis

Project description

Current PyPI packages


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 with your local browser. For Google Colaboratory, port=None visualizes doc directly on the notebook.,RtoL=False) returns raw DOT string for graphviz.Source.

Other usages

Visualization examples






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


Koichi Yasuoka (安岡孝一)


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.

Built Distribution

deplacy-2.0.3-py3-none-any.whl (22.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page