Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deplacy

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deplacy

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

  • 2.1.0
  • Source
  • PyPI
  • Socket score

Maintainers
1

Current PyPI packages

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

Visualization examples

deplacy.render()

deplacy.render()

deplacy.serve()

deplacy.serve()

deplacy.dot()

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

Author

Koichi Yasuoka (安岡孝一)

Reference

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc