|
39 | 39 | "* Classification Checklist \n", |
40 | 40 | "* Classification Free Text \n", |
41 | 41 | "* NER\n", |
| 42 | + "* Relationships (only supported for MAL imports)\n", |
42 | 43 | "\n", |
43 | 44 | "**Not** supported annotations\n", |
44 | 45 | "\n", |
|
125 | 126 | ], |
126 | 127 | "cell_type": "markdown" |
127 | 128 | }, |
128 | | - { |
129 | | - "metadata": {}, |
130 | | - "source": [ |
131 | | - "### NDJSON Annotations " |
132 | | - ], |
133 | | - "cell_type": "markdown" |
134 | | - }, |
135 | 129 | { |
136 | 130 | "metadata": {}, |
137 | 131 | "source": [ |
|
302 | 296 | "outputs": [], |
303 | 297 | "execution_count": null |
304 | 298 | }, |
| 299 | + { |
| 300 | + "metadata": {}, |
| 301 | + "source": [ |
| 302 | + "# ############ global nested classifications ###########\n", |
| 303 | + "# Message based\n", |
| 304 | + "nested_checklist_annotation = lb_types.ClassificationAnnotation(\n", |
| 305 | + " name=\"nested_checklist_question\",\n", |
| 306 | + " message_id=\"10\",\n", |
| 307 | + " value=lb_types.Checklist(\n", |
| 308 | + " answer=[lb_types.ClassificationAnswer(\n", |
| 309 | + " name=\"first_checklist_answer\",\n", |
| 310 | + " classifications=[\n", |
| 311 | + " lb_types.ClassificationAnnotation(\n", |
| 312 | + " name=\"sub_checklist_question\",\n", |
| 313 | + " value=lb_types.Checklist(\n", |
| 314 | + " answer=[lb_types.ClassificationAnswer(\n", |
| 315 | + " name=\"first_sub_checklist_answer\",\n", |
| 316 | + "\n", |
| 317 | + " )]\n", |
| 318 | + " ))\n", |
| 319 | + " ]\n", |
| 320 | + " )]\n", |
| 321 | + " )\n", |
| 322 | + ")\n", |
| 323 | + "# Message based\n", |
| 324 | + "nested_checklist_annotation_ndjson = {\n", |
| 325 | + " \"name\": \"nested_checklist_question\",\n", |
| 326 | + " \"messageId\": \"10\",\n", |
| 327 | + " \"answer\": [{\n", |
| 328 | + " \"name\": \"first_checklist_answer\",\n", |
| 329 | + " \"classifications\" : [\n", |
| 330 | + " {\n", |
| 331 | + " \"name\": \"sub_checklist_question\", \n", |
| 332 | + " \"answer\": {\n", |
| 333 | + " \"name\": \"first_sub_checklist_answer\"\n", |
| 334 | + " }\n", |
| 335 | + " } \n", |
| 336 | + " ] \n", |
| 337 | + " }]\n", |
| 338 | + "}\n", |
| 339 | + "# Global\n", |
| 340 | + "nested_radio_annotation = lb_types.ClassificationAnnotation(\n", |
| 341 | + " name=\"nested_radio_question\",\n", |
| 342 | + " value=lb_types.Radio(\n", |
| 343 | + " answer=lb_types.ClassificationAnswer(\n", |
| 344 | + " name=\"first_radio_answer\",\n", |
| 345 | + " classifications=[\n", |
| 346 | + " lb_types.ClassificationAnnotation(\n", |
| 347 | + " name=\"sub_radio_question\",\n", |
| 348 | + " value=lb_types.Radio(\n", |
| 349 | + " answer=lb_types.ClassificationAnswer(\n", |
| 350 | + " name=\"first_sub_radio_answer\"\n", |
| 351 | + " )\n", |
| 352 | + " )\n", |
| 353 | + " )\n", |
| 354 | + " ]\n", |
| 355 | + " )\n", |
| 356 | + " )\n", |
| 357 | + ")\n", |
| 358 | + "\n", |
| 359 | + "# Global\n", |
| 360 | + "nested_radio_annotation_ndjson = {\n", |
| 361 | + " \"name\": \"nested_radio_question\",\n", |
| 362 | + " \"answer\": {\n", |
| 363 | + " \"name\": \"first_radio_answer\",\n", |
| 364 | + " \"classifications\": [{\n", |
| 365 | + " \"name\":\"sub_radio_question\",\n", |
| 366 | + " \"answer\": { \"name\" : \"first_sub_radio_answer\"}\n", |
| 367 | + " }]\n", |
| 368 | + " }\n", |
| 369 | + "}\n", |
| 370 | + "\n" |
| 371 | + ], |
| 372 | + "cell_type": "code", |
| 373 | + "outputs": [], |
| 374 | + "execution_count": null |
| 375 | + }, |
305 | 376 | { |
306 | 377 | "metadata": {}, |
307 | 378 | "source": [ |
|
379 | 450 | " lb.Option(value=\"first_radio_answer\"),\n", |
380 | 451 | " lb.Option(value=\"second_radio_answer\")\n", |
381 | 452 | " ]\n", |
| 453 | + " ),\n", |
| 454 | + " lb.Classification(\n", |
| 455 | + " class_type=lb.Classification.Type.CHECKLIST,\n", |
| 456 | + " name=\"nested_checklist_question\",\n", |
| 457 | + " scope = lb.Classification.Scope.INDEX,\n", |
| 458 | + " options=[\n", |
| 459 | + " lb.Option(\"first_checklist_answer\",\n", |
| 460 | + " options=[\n", |
| 461 | + " lb.Classification(\n", |
| 462 | + " class_type=lb.Classification.Type.CHECKLIST,\n", |
| 463 | + " name=\"sub_checklist_question\", \n", |
| 464 | + " options=[lb.Option(\"first_sub_checklist_answer\")]\n", |
| 465 | + " )\n", |
| 466 | + " ])\n", |
| 467 | + " ]\n", |
| 468 | + " ),\n", |
| 469 | + " lb.Classification(\n", |
| 470 | + " class_type=lb.Classification.Type.RADIO,\n", |
| 471 | + " name=\"nested_radio_question\",\n", |
| 472 | + " scope = lb.Classification.Scope.GLOBAL,\n", |
| 473 | + " options=[\n", |
| 474 | + " lb.Option(\"first_radio_answer\",\n", |
| 475 | + " options=[\n", |
| 476 | + " lb.Classification(\n", |
| 477 | + " class_type=lb.Classification.Type.RADIO,\n", |
| 478 | + " name=\"sub_radio_question\",\n", |
| 479 | + " options=[lb.Option(\"first_sub_radio_answer\")]\n", |
| 480 | + " )\n", |
| 481 | + " ])\n", |
| 482 | + " ]\n", |
382 | 483 | " )\n", |
383 | 484 | " ]\n", |
384 | 485 | ")\n", |
|
402 | 503 | "metadata": {}, |
403 | 504 | "source": [ |
404 | 505 | "# Create Labelbox project\n", |
405 | | - "project = client.create_project(name=\"conversational_project\", \n", |
| 506 | + "project = client.create_project(name=\"Conversational Text Annotation Import Demo\", \n", |
406 | 507 | " media_type=lb.MediaType.Conversational)\n", |
407 | 508 | "\n", |
408 | 509 | "# Setup your ontology \n", |
|
471 | 572 | " radio_annotation,\n", |
472 | 573 | " ner_source,\n", |
473 | 574 | " ner_target,\n", |
474 | | - " ner_relationship\n", |
| 575 | + " ner_relationship,\n", |
| 576 | + " nested_radio_annotation,\n", |
| 577 | + " nested_checklist_annotation\n", |
475 | 578 | " ]\n", |
476 | 579 | " )\n", |
477 | 580 | ")" |
|
500 | 603 | " ner_source_ndjson,\n", |
501 | 604 | " ner_target_ndjson,\n", |
502 | 605 | " ner_relationship_annotation_ndjson,\n", |
| 606 | + " nested_checklist_annotation_ndjson,\n", |
| 607 | + " nested_radio_annotation_ndjson\n", |
503 | 608 | " ]:\n", |
504 | 609 | " annotations.update({\n", |
505 | 610 | " \"dataRow\": {\n", |
|
0 commit comments