Skip to main content

Streamlit component that allows you to visualize and modify NER annotations

Project description

NER Span Annotator

A Streamlit component for visualizing and modifying Named Entity Recognition (NER) annotations in the spaCy displacy span style. This tool is particularly useful for handling overlapping NER classes.

Key Features:

  • Visualization: Displays NER annotations in a clear and intuitive span style.
  • Interactivity: Allows you to modify NER annotations directly in the interface.

The implementation leverages code partially ported from Python to React, inspired by the spaCy repository. For more details about the spaCy span component, visit this page.

Installation instructions

pip install ner_span_annotator

Usage instructions

import streamlit as st

from ner_span_annotator import ner_span_annotator

text = "Welcome to the Bank of China."
spans = [
    {"start_token": 15, "end_token": 28, "label": "ORG"},
    {"start_token": 23, "end_token": 28, "label": "GPE"},
]

result = ner_span_annotator(
    text=text,
    spans=spans,
    labels=["ORG", "GPE"]
)

st.json(result)

Development

To set up and run the development environment, follow these steps:

Navigate to the ner_span_annotator/frontend directory and run:

npm install    # Initialize the project and install npm dependencies
npm run start  # Start the Webpack dev server

Then go to the project root and run the example app:

pip install -e . # install template as editable package
streamlit run ner_span_annotator/example.py # run the example

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ner_span_annotator-0.2.1.tar.gz (843.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ner_span_annotator-0.2.1-py3-none-any.whl (2.5 MB view details)

Uploaded Python 3

File details

Details for the file ner_span_annotator-0.2.1.tar.gz.

File metadata

  • Download URL: ner_span_annotator-0.2.1.tar.gz
  • Upload date:
  • Size: 843.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for ner_span_annotator-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1d8b9a9d0308b40793477e25174d3134e37eb570ff30295e1c966e9f48300878
MD5 8a535e57f1ad1c2fbf43310148e7dbd3
BLAKE2b-256 cd62a7ec5eb5cdcc91ebc9e6d915cdd36edc28e4a75cbd74db165e96b23dbc2a

See more details on using hashes here.

File details

Details for the file ner_span_annotator-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ner_span_annotator-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f0637e48fc1fb14c054a20f7ff9e33084a74bdd8fa917787ba5e5abc91ed614b
MD5 470a8c881252ad3835b795dd504e334d
BLAKE2b-256 dc71e21cd25d81cebccc04e57959f09c4cb4e9af385bfe9ca4775dcae9332023

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page