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.0.tar.gz (843.1 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.0-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file ner-span-annotator-0.2.0.tar.gz.

File metadata

  • Download URL: ner-span-annotator-0.2.0.tar.gz
  • Upload date:
  • Size: 843.1 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.0.tar.gz
Algorithm Hash digest
SHA256 2f5d1de0d428760a9ad1ac12ef7b12dad01c03522137f383c4535fd0cacda3d0
MD5 3d1ecaa7b32c3849603bd97b7a0fc527
BLAKE2b-256 788ad8749880b0967f0d22d752c4ad308ef83350ee5265764e620e0cd071bf66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ner_span_annotator-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4c8b16662c47a2a49b7ababb06ff4afbe6fa517c6424fdc196a3a6b52ae9193
MD5 258d3ade1cad1e39c3fea0bb5c107877
BLAKE2b-256 fe45a55ea89b9dad0d9096523f83b745cd3abac351409746c13e964441fccb7b

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