Visualization with displaCy

Let's see how we can use spaCy to visualize the relationships in our text.

We'll cover the following

Overview

Visualization is an important tool that should be in every data scientist's toolbox. Visualization is the easiest way to explain some concepts to our colleagues, our boss, and any technical or nontechnical audience. Visualization of language data is specifically useful and allows us to identify patterns in our data at a glance.

There are many Python libraries and plugins, such as Matplotlib, seaborn, TensorBoard, and so on. Being an industrial library, spaCy comes with its own visualizer—displaCy.

In this section, we'll learn how to spin up a displaCy server on our machine, in a Jupyter notebook, and in a web application. We'll also learn how to export the graphics we created as an image file, customize our visualizations, and make manual annotations without creating a Doc object. We'll start by exploring the easiest way—using displaCy's interactive demo.

Visualizing within Python

With the introduction of the latest version of spaCy, the displaCy visualizers are integrated into the core library. This means that we can start using displaCy immediately after installing spaCy. Let's go through an example.

Get hands-on with 1400+ tech skills courses.