Interactive Text Annotation for Jupyter Notebook/Lab

Overview

Build Status


Interactive Text Annotation for Jupyter Notebook/Lab

Jupyter Annotate

  • Perform entity extraction inline without leaving your notebook.
  • Iteratively label and train a model in the same environment.
  • Iterate over the label schema faster.
  • Quickly inspect the quality of pre-annotation tools such as skweak or spacy.

Installation

You can install using pip:

pip install jupyterannotate

If you are using Jupyter Notebook 5.2 or earlier, you may also need to enable the nbextension:

jupyter nbextension enable --py [--sys-prefix|--user|--system] jupyterannotate

Usage

See Example

Within an Jupyter Notebook cell:

# Define some labels
LABELS = ["Organization", "Product", "Person", "Country", "Date", "Quantity"]

# Define some documents
DOCUMENTS = [
    "Oracle introduced a...",
    "Microsoft will delay the ...",
]

# Instantiate widget
# Optionally specify a list of spans to prepopulate
annotation_widget = jupyterannotate.AnnotateWidget(
    docs=NEWS_HEADLINES,
    labels=LABELS,
    spans=[
      [
        {'start': 0, 'end': 6, 'text': 'Oracle', 'label': 'Organization'},
      ],
      []
    ]
)

# Render
annotation_widget

Apply Label

  • Choose label
  • Select text within displayed document
  • Click on existing span to remove
  • Navigate documents using top-right
# Access spans - a List containing a List of Spans per document
# e.g. [[{'start': 0, 'end': 6, 'text': 'Oracle', 'label': 'Organization'}], []]
annotation_widget.spans


# See updates in real-time
annotation_widget.spans = [
    [
        {'start': 0, 'end': 6, 'text': 'Oracle', 'label': 'Organization'},
        {'start': 69, 'end': 72, 'text': '10g', 'label': 'Quantity'}
    ],
    []
]

Update Python

Development Installation

Create a dev environment:

conda create -n jupyterannotate-dev -c conda-forge nodejs yarn python jupyterlab
conda activate jupyterannotate-dev

Install the python. This will also build the TS package.

pip install -e ".[test, examples]"

When developing your extensions, you need to manually enable your extensions with the notebook / lab frontend. For lab, this is done by the command:

jupyter labextension develop --overwrite .
yarn run build

For classic notebook, you need to run:

jupyter nbextension install --sys-prefix --symlink --overwrite --py jupyterannotate
jupyter nbextension enable --sys-prefix --py jupyterannotate

Note that the --symlink flag doesn't work on Windows, so you will here have to run the install command every time that you rebuild your extension. For certain installations you might also need another flag instead of --sys-prefix, but we won't cover the meaning of those flags here.

How to see your changes

Typescript:

If you use JupyterLab to develop then you can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the widget.

# Watch the source directory in one terminal, automatically rebuilding when needed
yarn run watch
# Run JupyterLab in another terminal
jupyter lab

After a change wait for the build to finish and then refresh your browser and the changes should take effect.

Python:

If you make a change to the python code then you will need to restart the notebook kernel to have it take effect.

You might also like...

A GitHub action to run Dart analyzer with annotation support.

A GitHub action to run Dart analyzer with annotation support.

⚒️ GitHub Action for Dart Analyzer A GitHub action to run Dart analyzer with annotation support. License Usage name: "analyze" on: # rebuild any PRs a

Dec 28, 2022

Um bot de suporte feito usando threads para o Discord, 100% customizável, feito em JavaScript e inspirado no Rio Helper do servidor Elixir Lab e na Loritta Helper do serivdor de suporte da Loritta.

Ticket Bot Um bot de suporte feito usando threads para o Discord, 100% customizável, feito em JavaScript e inspirado no Rio Helper do servidor Elixir

Dec 21, 2022

An obsidian plugin that allows code blocks executed interactively in sandbox like jupyter notebooks. Supported language rust、kotlin、python、Javascript、TypeScript etc.

An obsidian plugin that allows  code blocks executed interactively in sandbox like jupyter notebooks. Supported language rust、kotlin、python、Javascript、TypeScript etc.

Obsidian Code Emitter This plugin allows code blocks executed interactively like jupyter notebooks. Currently, support languages: Rust Kotlin JavaScri

Dec 28, 2022

Тестовое задание для RDX-lab

NestJs Api Для начала нужно переименовать файл .env.template в .env и заполнить его данными, которых не хватает Далее выполняем: docker-compose -f doc

Nov 3, 2022

Experience Lab is a set of utilities that assist in creating instances of Microsoft Energy Data Services, performing data loads, and performing basic management operations.

Experience Lab - Microsoft Energy Data Services Build Status About Experience Lab is an automated, end-to-end deployment accelerator for Microsoft Ene

Dec 14, 2022

Uniform, Unlimited, Universal and Unbelievable Annotation Toolbox

特性 📝 本项目包含@label-u/annotation、@label-u/components、@label-u/utils及@label-u/web等4个工程。 📝 采用rollup esbuild插件及vite编译,让开发者上高速,开发效率更高 📝 采用lerna进行多工程管理。 📝

Dec 23, 2022

Projeto desenvolvido durante o ignite lab 3 da Rocketseat.

Projeto desenvolvido durante o ignite lab 3 da Rocketseat.

🚀 Tecnologias Esse projeto foi desenvolvido com as seguintes tecnologias: Vite React Typescript Tailwindcss Radix UI Phosphor Icons Figma Storybook ?

Oct 19, 2022

A Virtual Interactive Keyboard which replicates every key you press and a Text-Area in which everything is written and can be copied to the clipboard with a click of a button.

A Virtual Interactive Keyboard which replicates every key you press and a Text-Area in which everything is written and can be copied to the clipboard with a click of a button.

Mar 1, 2021

Twitter Text Libraries. This code is used at Twitter to tokenize and parse text to meet the expectations for what can be used on the platform.

twitter-text This repository is a collection of libraries and conformance tests to standardize parsing of Tweet text. It synchronizes development, tes

Jan 8, 2023
Releases(v0.1.3)
Owner
null
MySQL meets Jupyter notebooks. Grasp provides a new way to learn and write SQL, by providing a coding-notebook style with runnable blocks, markdown documentation, and shareable notebooks. ✨

A New Way to Write & Learn SQL Report Bug · Request Feature Table of Contents About The Project Built With Getting Started Prerequisites Installation

Lakshya 7 Sep 1, 2022
Annotation tools for the web. Select text, images, or (nearly) anything else, and add your notes.

Annotator Annotator is a JavaScript library for building annotation applications in browsers. It provides a set of interoperable tools for annotating

Open Annotation 2.6k Dec 23, 2022
Text annotation solution for websites. TypeScript and vanilla JavaScript version.

Simple Text Annotations Use this small library when you need to add annotations to your website. Features show up / hide annotation on a element click

Jacek Jarczok 1 May 9, 2021
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Mercury: easily convert Python notebook to web app and share with others

Mercury Share your Python notebooks with others Easily convert your Python notebooks into interactive web apps by adding parameters in YAML. Simply ad

MLJAR 2.2k Dec 30, 2022
Ilse Langnar's Notebook is an implementation of the Vitruvian Brain framework

Ilse Langnar's Notebook is an implementation of the Vitruvian Brain framework. It works as a cross-platform note-taking application, reference, bibliography, spaced repetition(no format lock-in) and other features.

Ilse Langnar 48 Jan 3, 2023
Hands-on lab for Power Platform Tools for Visual Studio Code

Power Platform Tools for Visual Studio Code Lab This repository contains the lab instructions and content on how to experience the Power Platform Tool

Microsoft 8 Dec 1, 2022
Create testable, reproduceable documentation with Jupyter notebooks

Create Testable, Reproduceable Docs and Blogs With Notebooks Never copy and paste code into documentation again! ?? See a live example of a post made

Outerbounds 29 Dec 8, 2022