NERNA (NER & Text Classification for Notebooks)
Follow the official repository: NER-Notebook-Annotation - GitHub
NERNA is a lightweight package designed for Named Entity Recognition (NER) annotation and Text Classification directly within Python notebooks.
Originally intended as a Streamlit-based interface, it has been reworked to run natively inside notebook environments (such as Jupyter, Google Colab, Databricks, etc.). This makes it easier to use without requiring deployment of web applications or cloud server contracts.
Key Features
- ✅ Lightweight, interactive JavaScript interface embedded in notebooks
- ✅ Compatible with local notebooks and cloud platforms (e.g., Colab, Databricks)
- ✅ Supports both Span-level NER Annotation and Document-level Classification
- ✅ No need for external servers or deployments
- ⚠️ Annotations are made using JavaScript, so they cannot be accessed directly as Python variables. However, the input to the tool must be a Python list of strings (or a list of
[id, text]tuples).
1. NER Annotation
from nerna import NERAnnotator
# List of texts to annotate
texts = [
'Brazil won the 2002 World Cup.',
'The planet’s drinking water is running out.'
]
# Initialize annotation (optionally customize labels)
annotator = NERAnnotator(texts, labels=['Location', 'Date', 'Event'])
# Render the interactive annotation interface
annotator.render(variable_name="annotator")
After annotating in the UI, click "🐍 Export to Python" and access your data:
print(annotator.annotations)
2. Text Classification
The TextClassifier provides a fast way to label entire documents with a single click.
from nerna import TextClassifier
# Using tuples to preserve document IDs
data = [
["doc_01", "The new smartphone has a great battery life but the camera is sub-par."],
["doc_02", "I love the design, very sleek and modern!"]
]
labels = ["Positive", "Negative", "Neutral"]
# Initialize the classifier
classifier = TextClassifier(texts=data, labels=labels)
# Render the UI
classifier.render(variable_name="classifier")
After classifying in the UI, click "🐍 Export to Python" and retrieve:
print(classifier.classifications)
# Output format: {"doc_01": "Negative", "doc_02": "Positive"}
Notes
Retrieving Data
There are two ways to retrieve the annotated data back into Python:
Option A: Export to Python Variable (Recommended for Colab/Jupyter)
Pass the name of your variable to the render method:
annotator.render(variable_name="annotator")
# or for classification:
# classifier.render(variable_name="classifier")
- In the UI, click the "🐍 Export to Python" button.
- Access the data in Python via
.annotationsor.classifications.
Option B: Load from JSON (Fallback)
- Click "📥 Download JSON" in the UI to save a
.jsonfile. - Load it manually in Python.
- Ideal for manual review, small-scale labeling tasks, or quick experimentation in NLP workflows.
Metadata
Release files for nerna 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nerna-0.2.2.tar.gz | 11.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nerna-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.4 kB
Release files / nerna-0.2.2.tar.gz
| Download URL | nerna-0.2.2.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
32352e35015aa056a50af1c350cd76b1f1a00dd6c562df09bee2646834165bef
|
|
BLAKE2b-256 checksum How to use checksums |
d785e555d91c3dbcf3ae060de7b56bdc91ee454a59a64a4470f4854e8186c134
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / nerna-0.2.2-py3-none-any.whl
| Download URL | nerna-0.2.2-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d672972e04b6766b98fc5d748b56e0c12268521a50c66454dff1c0baa8bc4fb
|
|
BLAKE2b-256 checksum How to use checksums |
476281ed4fff38e9c904a0f54f444e59ddc71f8e008e8343ec8ed19dd94533ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|