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

spans = [
    {"start_token": 3, "end_token": 6, "label": "ORG"},
    {"start_token": 5, "end_token": 6, "label": "GPE"},
]
tokens = ["Welcome", "to", "the", "Bank", "of", "China", "."]

result = ner_span_annotator(tokens=tokens, 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.1.3.tar.gz (841.4 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.1.3-py3-none-any.whl (846.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ner_span_annotator-0.1.3.tar.gz
  • Upload date:
  • Size: 841.4 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.1.3.tar.gz
Algorithm Hash digest
SHA256 a7b0ea589472ffccbceaf8421fd7db5193110f2306f7e1e9d710a0aa681af10b
MD5 2d3a781530fb54ffbef0560d558e3535
BLAKE2b-256 5e14a6b5abaa9fa61f1e4468035b6456dd2ef054193aed7f2b3117227c7c4279

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ner_span_annotator-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fc14614360f4c2c969b6fdda999707e716e7116700323f769d7fe09502ca076f
MD5 2ce04b278be0e0df58856c06cca855e5
BLAKE2b-256 6cd762bb32d17ed0af9fb3440f66095077afe19303513c17887161b00e4ddbed

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