|
86 | 86 | }, |
87 | 87 | { |
88 | 88 | "cell_type": "code", |
89 | | - "execution_count": null, |
| 89 | + "execution_count": 36, |
90 | 90 | "id": "4d63074b-2379-48af-b9d6-2a66190f03c4", |
91 | 91 | "metadata": { |
92 | | - "id": "4d63074b-2379-48af-b9d6-2a66190f03c4", |
93 | | - "colab": { |
94 | | - "base_uri": "https://localhost:8080/" |
95 | | - }, |
96 | | - "outputId": "0b4547c9-e534-441d-9bf6-7588ee50c8a2" |
| 92 | + "id": "4d63074b-2379-48af-b9d6-2a66190f03c4" |
97 | 93 | }, |
98 | | - "outputs": [ |
99 | | - { |
100 | | - "output_type": "stream", |
101 | | - "name": "stdout", |
102 | | - "text": [ |
103 | | - "\u001b[K |████████████████████████████████| 184 kB 5.2 MB/s \n", |
104 | | - "\u001b[K |████████████████████████████████| 7.8 MB 45.4 MB/s \n", |
105 | | - "\u001b[?25h Building wheel for pygeotile (setup.py) ... \u001b[?25l\u001b[?25hdone\n" |
106 | | - ] |
107 | | - } |
108 | | - ], |
| 94 | + "outputs": [], |
109 | 95 | "source": [ |
110 | 96 | "!pip install -q 'labelbox[data]'" |
111 | 97 | ] |
112 | 98 | }, |
113 | 99 | { |
114 | 100 | "cell_type": "code", |
115 | | - "execution_count": null, |
| 101 | + "execution_count": 37, |
116 | 102 | "id": "01fca8c9-0680-4a9c-a11e-1b49f31e9121", |
117 | 103 | "metadata": { |
118 | 104 | "id": "01fca8c9-0680-4a9c-a11e-1b49f31e9121" |
|
144 | 130 | }, |
145 | 131 | { |
146 | 132 | "cell_type": "code", |
147 | | - "execution_count": null, |
| 133 | + "execution_count": 38, |
148 | 134 | "id": "86003724-4807-4281-95c1-5284a6f9609f", |
149 | 135 | "metadata": { |
150 | 136 | "id": "86003724-4807-4281-95c1-5284a6f9609f" |
|
199 | 185 | "id": "Z5ORHD1pZKt1" |
200 | 186 | }, |
201 | 187 | "id": "Z5ORHD1pZKt1", |
202 | | - "execution_count": null, |
| 188 | + "execution_count": 39, |
203 | 189 | "outputs": [] |
204 | 190 | }, |
205 | 191 | { |
|
226 | 212 | "id": "mrPJ1Ko0ZMdl" |
227 | 213 | }, |
228 | 214 | "id": "mrPJ1Ko0ZMdl", |
229 | | - "execution_count": null, |
| 215 | + "execution_count": 40, |
230 | 216 | "outputs": [] |
231 | 217 | }, |
232 | 218 | { |
233 | 219 | "cell_type": "code", |
234 | 220 | "source": [ |
235 | | - "########## Classification - Radio (with subclassifcations) ##########\n", |
236 | | - "\n", |
237 | | - "# Python annotation\n", |
238 | | - "radio_annotation_nested = ClassificationAnnotation(\n", |
239 | | - " name=\"radio_question_sub\", \n", |
240 | | - " value=Radio(answer = ClassificationAnswer(name = \"first_radio_answer\")),\n", |
241 | | - " classifications=[\n", |
242 | | - " \tClassificationAnnotation(\n", |
243 | | - " \tname=\"sub_radio_question\",\n", |
244 | | - " \t\tvalue=Radio(answer=ClassificationAnswer(name=\"first_sub_radio_answer\"))\n", |
245 | | - " )\n", |
246 | | - " ]\n", |
247 | | - ")\n", |
248 | | - "\n", |
| 221 | + "########## Classification - Radio (with subclassifcations) is only suppported with NDJSON tools ##########\n", |
249 | 222 | "\n", |
250 | 223 | "# NDJSON\n", |
251 | 224 | "radio_annotation_ndjson_with_subclass = {\n", |
|
263 | 236 | "id": "vt7QvfV7ZPAF" |
264 | 237 | }, |
265 | 238 | "id": "vt7QvfV7ZPAF", |
266 | | - "execution_count": null, |
| 239 | + "execution_count": 41, |
267 | 240 | "outputs": [] |
268 | 241 | }, |
269 | 242 | { |
|
296 | 269 | "id": "45BDh768ZYsH" |
297 | 270 | }, |
298 | 271 | "id": "45BDh768ZYsH", |
299 | | - "execution_count": null, |
| 272 | + "execution_count": 42, |
300 | 273 | "outputs": [] |
301 | 274 | }, |
302 | 275 | { |
303 | 276 | "cell_type": "code", |
304 | | - "execution_count": null, |
| 277 | + "execution_count": 43, |
305 | 278 | "id": "f9f9287c-aad7-4914-bc87-1453fb8bce81", |
306 | 279 | "metadata": { |
307 | 280 | "id": "f9f9287c-aad7-4914-bc87-1453fb8bce81" |
|
364 | 337 | "base_uri": "https://localhost:8080/" |
365 | 338 | }, |
366 | 339 | "id": "Ak-jnABK3OPH", |
367 | | - "outputId": "ff481cce-af08-4748-e8ac-a959085e07de" |
| 340 | + "outputId": "0f80ba52-adde-4d97-d04a-fcdbe4d1a414" |
368 | 341 | }, |
369 | 342 | "id": "Ak-jnABK3OPH", |
370 | | - "execution_count": null, |
| 343 | + "execution_count": 44, |
371 | 344 | "outputs": [ |
372 | 345 | { |
373 | 346 | "output_type": "stream", |
374 | 347 | "name": "stdout", |
375 | 348 | "text": [ |
376 | 349 | "<DataRow {\n", |
377 | | - " \"created_at\": \"2022-12-22 20:59:28+00:00\",\n", |
| 350 | + " \"created_at\": \"2023-01-30 18:06:23+00:00\",\n", |
378 | 351 | " \"external_id\": null,\n", |
379 | | - " \"global_key\": \"TEST-ID-190217471490724126308456269288159181446d\",\n", |
| 352 | + " \"global_key\": \"TEST-ID-321668750509639104503407808903937477958d\",\n", |
380 | 353 | " \"media_attributes\": {},\n", |
381 | 354 | " \"metadata\": [],\n", |
382 | 355 | " \"metadata_fields\": [],\n", |
383 | 356 | " \"row_data\": \"https://storage.googleapis.com/labelbox-sample-datasets/nlp/lorem-ipsum.txt\",\n", |
384 | | - " \"uid\": \"clbzkhbxy18ws07ysdumbbgnq\",\n", |
385 | | - " \"updated_at\": \"2022-12-22 20:59:28+00:00\"\n", |
| 357 | + " \"uid\": \"cldj4gyf60fy207xh3z1y2g1h\",\n", |
| 358 | + " \"updated_at\": \"2023-01-30 18:06:23+00:00\"\n", |
386 | 359 | "}>\n", |
387 | | - "clbzkhbxy18ws07ysdumbbgnq\n" |
| 360 | + "cldj4gyf60fy207xh3z1y2g1h\n" |
388 | 361 | ] |
389 | 362 | } |
390 | 363 | ] |
|
395 | 368 | "### Step 2: Create/select an ontology\n", |
396 | 369 | "Your project should have the correct ontology setup with all the tools and classifications supported for your annotations, and the tool names and classification instructions should match the `name`/`instructions` fields in your annotations to ensure the correct feature schemas are matched.\n", |
397 | 370 | "\n", |
398 | | - "For example, when we create the checklist annotation [above](https://colab.research.google.com/drive/1mXfgydXxVR2OMAjJo1nj2EU9QQyVhW90#scrollTo=45BDh768ZYsH&line=1&uniqifier=1), we provided the `name` as `checklist_question`. Now, when we setup our ontology, we must ensure that the name of my classification tool is also `checklist_question`. The same alignment must hold true for the other tools and classifications we create in our ontology.\n", |
| 371 | + "For example, when we create the checklist annotation above, we provided the `name` as `checklist_question`. Now, when we setup our ontology, we must ensure that the name of my classification tool is also `checklist_question`. The same alignment must hold true for the other tools and classifications we create in our ontology.\n", |
399 | 372 | "\n", |
400 | 373 | "[Documentation for reference ](https://docs.labelbox.com/reference/import-text-annotations)" |
401 | 374 | ], |
|
459 | 432 | "id": "_wWxYFoDTsar" |
460 | 433 | }, |
461 | 434 | "id": "_wWxYFoDTsar", |
462 | | - "execution_count": null, |
| 435 | + "execution_count": 45, |
463 | 436 | "outputs": [] |
464 | 437 | }, |
465 | 438 | { |
|
475 | 448 | }, |
476 | 449 | { |
477 | 450 | "cell_type": "code", |
478 | | - "execution_count": null, |
| 451 | + "execution_count": 46, |
479 | 452 | "id": "044e9194-d21d-403e-b64c-047c1063b0fe", |
480 | 453 | "metadata": { |
481 | 454 | "id": "044e9194-d21d-403e-b64c-047c1063b0fe" |
|
537 | 510 | "colab": { |
538 | 511 | "base_uri": "https://localhost:8080/" |
539 | 512 | }, |
540 | | - "outputId": "153857ae-455d-4c7c-fb36-40fc16dc0819" |
| 513 | + "outputId": "6eb66aad-477d-490e-ea91-53de995f1f65" |
541 | 514 | }, |
542 | 515 | "id": "DbwheC8RzI-0", |
543 | | - "execution_count": null, |
| 516 | + "execution_count": 47, |
544 | 517 | "outputs": [ |
545 | 518 | { |
546 | 519 | "output_type": "stream", |
547 | 520 | "name": "stdout", |
548 | 521 | "text": [ |
549 | 522 | "Batch: <Batch {\n", |
550 | 523 | " \"consensus_settings_json\": \"{\\\"numberOfLabels\\\":1,\\\"coveragePercentage\\\":0}\",\n", |
551 | | - " \"created_at\": \"2022-12-22 20:59:51+00:00\",\n", |
| 524 | + " \"created_at\": \"2023-01-30 18:06:28+00:00\",\n", |
552 | 525 | " \"name\": \"first-batch-text-demo\",\n", |
553 | 526 | " \"size\": 1,\n", |
554 | | - " \"uid\": \"94297660-823b-11ed-8039-c1b641c04d88\",\n", |
555 | | - " \"updated_at\": \"2022-12-22 20:59:51+00:00\"\n", |
| 527 | + " \"uid\": \"d14be9f0-a0c8-11ed-a7e5-f9da6146996d\",\n", |
| 528 | + " \"updated_at\": \"2023-01-30 18:06:28+00:00\"\n", |
556 | 529 | "}>\n" |
557 | 530 | ] |
558 | 531 | } |
|
575 | 548 | { |
576 | 549 | "cell_type": "markdown", |
577 | 550 | "source": [ |
578 | | - "#### Python Annotations" |
| 551 | + "#### Python annotations" |
579 | 552 | ], |
580 | 553 | "metadata": { |
581 | 554 | "id": "7IgSl5SxcO4R" |
|
584 | 557 | }, |
585 | 558 | { |
586 | 559 | "cell_type": "code", |
587 | | - "execution_count": null, |
| 560 | + "execution_count": 48, |
588 | 561 | "id": "53aaf87b-114f-4b56-a417-8c7cddc1f532", |
589 | 562 | "metadata": { |
590 | 563 | "id": "53aaf87b-114f-4b56-a417-8c7cddc1f532" |
|
599 | 572 | " named_entitity_annotation, \n", |
600 | 573 | " radio_annotation, \n", |
601 | 574 | " checklist_annotation, \n", |
602 | | - " text_annotation, \n", |
603 | | - " radio_annotation_nested \n", |
| 575 | + " text_annotation\n", |
604 | 576 | " ]\n", |
605 | 577 | ")\n", |
606 | 578 | "\n", |
|
628 | 600 | }, |
629 | 601 | { |
630 | 602 | "cell_type": "code", |
631 | | - "execution_count": null, |
| 603 | + "execution_count": 49, |
632 | 604 | "id": "c66672c7-33e8-4d5d-b79d-2ac76d830341", |
633 | 605 | "metadata": { |
634 | 606 | "id": "c66672c7-33e8-4d5d-b79d-2ac76d830341" |
|
693 | 665 | "base_uri": "https://localhost:8080/" |
694 | 666 | }, |
695 | 667 | "id": "izli4zhEfi75", |
696 | | - "outputId": "b1cdc2d0-9541-4df2-d922-be0a7ce80499" |
| 668 | + "outputId": "4eb1b790-4e60-4cc6-9224-de6a9ed339bf" |
697 | 669 | }, |
698 | 670 | "id": "izli4zhEfi75", |
699 | | - "execution_count": null, |
| 671 | + "execution_count": 50, |
700 | 672 | "outputs": [ |
701 | 673 | { |
702 | 674 | "output_type": "stream", |
|
720 | 692 | }, |
721 | 693 | { |
722 | 694 | "cell_type": "code", |
723 | | - "execution_count": null, |
| 695 | + "execution_count": 51, |
724 | 696 | "id": "e8d4e99b-ad7e-48b9-8073-afb764d7c5b4", |
725 | 697 | "metadata": { |
726 | 698 | "id": "e8d4e99b-ad7e-48b9-8073-afb764d7c5b4", |
727 | 699 | "colab": { |
728 | 700 | "base_uri": "https://localhost:8080/" |
729 | 701 | }, |
730 | | - "outputId": "be9df775-f18c-44ed-e02e-82b3c2a3691f" |
| 702 | + "outputId": "1e52b23b-cefc-439b-f374-2e8b886280f4" |
731 | 703 | }, |
732 | 704 | "outputs": [ |
733 | 705 | { |
|
770 | 742 | "id": "ubbraAmo2_fe" |
771 | 743 | }, |
772 | 744 | "id": "ubbraAmo2_fe", |
773 | | - "execution_count": null, |
| 745 | + "execution_count": 52, |
774 | 746 | "outputs": [] |
775 | 747 | } |
776 | 748 | ], |
|
0 commit comments