explosion / spacy-streamlit

👑 spaCy building blocks and visualizers for Streamlit apps
https://share.streamlit.io/ines/spacy-streamlit-demo/master/app.py
MIT License
794 stars 114 forks source link

`visualize_spans` function + `manual` argument + docstrings #37

Closed pmbaumgartner closed 2 years ago

pmbaumgartner commented 2 years ago

Adds a visualize_spans function for using the span visualization in displaCy.

I made a few choices that may need justification:

Extra:

Open questions:

pmbaumgartner commented 2 years ago

I've added a few more updates, so the name of this branch is a bit of misnomer now.

I've updated visualize_parser and visualize_spans to take an argument manual so that they can all take data in the format described here: https://spacy.io/usage/visualizers#manual-usage

I've also updated the docstrings to include this argument, as well as added the args to the docstrings for visualize_parser.

pmbaumgartner commented 2 years ago

Some smaller updates after testing out locally a bit more:

1️⃣ Added a very simple example app.

image

2️⃣ Added an exception catch if they have a version of spaCy before spans were supported in displaCy.

ValueError: 'visualize_spans' requires spacy>=3.3.0

3️⃣ Updated the README with a visualize_spans example and documentation.