Basic entity span highlighting in text for visualization in notebooks
Project description
Simple entity span visualization in text
This is a simple widget, adapted from the code in Spacy visualizers, that can be used for simple visualization of text spans in Jupyter notebooks.
To install:
$ pip install entityrender
Example code:
from IPython.core.display import HTML
from entityrender.entityrender import EntityRenderer
text = """When Sebastian Thrun started working on self-driving cars at Google in 2007,
few people outside of the company took him seriously."""
spans = [{"start": 5, "end": 20, "label": "Person"},
{"start": 61, "end": 67, "label": "Company"},
{"start": 71, "end": 75, "label": "Date"}]
er = EntityRenderer(labels=["Person", "Company", "Date"])
output = er.render_ents(text, spans)
HTML(output)
Result:
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 Distribution
entityrender-0.2.0.tar.gz
(2.3 kB
view details)
File details
Details for the file entityrender-0.2.0.tar.gz.
File metadata
- Download URL: entityrender-0.2.0.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f6ec3218d9b1bf5b99af58c59a9cd39c9f276658f72b3b7d436e9aba35da588
|
|
| MD5 |
240545a17cea79a0d3062a3a3a35f697
|
|
| BLAKE2b-256 |
e38be4733a4b9cbcd109b7ca05d9995de4e63d443ebd3c76ca8e9a734b40f2de
|