No project description provided
Project description
Overview
The cas_visualizerlibrary can be used to transform a cassis.Cas object into an annotated html string.
Quick start
from self-contained example :
We start out with a cassis.Cas object that contains the following text:
Die Fernuniversität in Hagen (Eigenschreibweise: FernUniversität) ist die erste und einzige staatliche Fernuniversität in Deutschland. Ihr Sitz befindet sich in Hagen in Nordrhein-Westfalen. Nach Angaben des Statistischen Bundesamtes war sie, ohne Berücksichtigung von Akademie- und Weiterbildungsstudierenden, mit über 76.000 Studierenden im Wintersemester 2016/2017[3] die größte deutsche Universität.[4]
and is annotated with a cassis.TypeSystem annotation:
de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity
Let's transform this annotation into a spacy-styled highlighted html string:
from visualizer import SpacySpanVisualiser
spacy_span_vis = SpacySpanVisualiser(cas, [])
annotation = 'de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity'
spacy_span_vis.set_selected_annotations_to_types({'NAMED_ENTITY': annotation})
spacy_span_vis.set_annotations_to_colors({'NAMED_ENTITY': 'lightgreen'})
spacy_span_vis.set_span_type(SpacySpanVisualiser.SPAN_STYLE_HIGHLIGHTING)
html = spacy_span_vis.visualise()
Using streamlit we can then render it.
E.g. st.write(html, unsafe_allow_html=True):
How to publish
- Increase the version number in
pyproject.toml - Run
poetry build - [Optional] If no token is configured:
- Create an API-Token by visiting: https://pypi.org/manage/account/#api-tokens
- Replace
TOKENwith the string of the API-Token and runpoetry config pypi-token.pypi TOKEN
- Run
poetry publish
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cas_visualizer-0.0.8.tar.gz.
File metadata
- Download URL: cas_visualizer-0.0.8.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.9.13 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97aa9a285115e082ecdfa512b91786032e246346c08387d9fe264e32eb34b0d3
|
|
| MD5 |
cdc5b29f31b6f6036b58acb7eb0311fc
|
|
| BLAKE2b-256 |
0261c204b0e1de6a2652a95f37a798352579a2e69cfe832b53067cba85a56aa4
|
File details
Details for the file cas_visualizer-0.0.8-py3-none-any.whl.
File metadata
- Download URL: cas_visualizer-0.0.8-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.9.13 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
547b6a82d22dd96a5060fdf40bfba505b5220d4d7c69fd6f10abb14f00e0590e
|
|
| MD5 |
c619c19234b9ec24716e217d27081bc9
|
|
| BLAKE2b-256 |
58265ac16e56989360136b9d1655d2be917c44a9a5b49cedb10ed1cb5bbc96b4
|