Skip to content

Commit 8638f5f

Browse files
committed
Update README
1 parent 9a00647 commit 8638f5f

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
![Build Status](https://github.com/dataqa/jupyter-annotate/actions/workflows/build.yml/badge.svg?branch=main)
44

5-
A Custom Jupyter Widget Library
5+
Inline Text Annotation for Jupyter Notebook/Lab
6+
7+
![Jupyter Annotate](examples/images/Annotate_1.png?raw=true "Jupyter Annotate")
68

79
## Installation
810

@@ -19,6 +21,43 @@ the nbextension:
1921
jupyter nbextension enable --py [--sys-prefix|--user|--system] jupyterannotate
2022
```
2123

24+
## Usage
25+
26+
Within an Jupyter Notebook cell:
27+
28+
```
29+
# Define some labels
30+
LABELS = ["Organization", "Product", "Person", "Country", "Date", "Quantity"]
31+
32+
# Define some documents
33+
DOCUMENTS = [
34+
"Oracle introduced a...",
35+
"Microsoft will delay the ...",
36+
]
37+
38+
# Instantiate widget
39+
annotation_widget = jupyterannotate.AnnotateWidget(
40+
docs=NEWS_HEADLINES,
41+
labels=LABELS
42+
)
43+
44+
# Render
45+
annotation_widget
46+
```
47+
48+
![Apply Label](examples/images/Annotate_1.gif?raw=true "Apply Label")
49+
50+
- Choose label
51+
- Select text within displayed document
52+
- Click on existing span to remove
53+
- Navigate documents using top-right
54+
55+
```
56+
# Access spans - a List containing a List of Spans per document
57+
# e.g. [[{'start': 0, 'end': 6, 'text': 'Oracle', 'label': 'Organization'}], []]
58+
annotation_widget.spans
59+
```
60+
2261
## Development Installation
2362

2463
Create a dev environment:

examples/images/Annotate_1.gif

98.5 KB
Loading

examples/images/Annotate_1.png

171 KB
Loading

0 commit comments

Comments
 (0)