Export text annotations

How to export text annotations and sample export formats.

Export JSON annotations

# Set the export params to include/exclude certain fields. export_params= { "attachments": True, "metadata_fields": True, "data_row_details": True, "project_details": True, "label_details": True, "performance_details": True, "interpolated_frames": True } # Note: Filters follow AND logic, so typically using one filter is sufficient. filters= { "last_activity_at": ["2000-01-01 00:00:00", "2050-01-01 00:00:00"], "workflow_status": "<wkf-status>" } export_task = project.export(params=export_params, filters=filters) export_task.wait_till_done() # Stream the export using a callback function def json_stream_handler(output: labelbox.BufferedJsonConverterOutput): print(output.json) export_task.get_buffered_stream(stream_type=labelbox.StreamType.RESULT).start(stream_handler=json_stream_handler) # Collect all exported data into a list export_json = [data_row.json for data_row in export_task.get_buffered_stream()] print("file size: ", export_task.get_total_file_size(stream_type=lb.StreamType.RESULT)) print("line count: ", export_task.get_total_lines(stream_type=lb.StreamType.RESULT))

Annotation export formats

Text entity

{ "feature_id": "clutx70x20onv148pb5ah49lb", "feature_schema_id": "clutx6n1g00r707y110ruh99w", "name": "named_entity", "value": "named_entity", "annotation_kind": "TextEntity", "classifications": [], "location": { "start": 10, "end": 20, "token": "um dolor si" } }

Radio

{ "feature_id": "clutx70x20onw148p7mlgpq90", "feature_schema_id": "clutx6n1h00r907y16s49do9e", "name": "radio_question", "value": "radio_question", "radio_answer": { "feature_id": "clutx70x20onx148px2679qsp", "feature_schema_id": "clutx6n1h00ra07y100njafnj", "name": "first_radio_answer", "value": "first_radio_answer", "classifications": [] } }

Checklist

{ "feature_id": "clutx70x20ony148p6gxk7ec8", "feature_schema_id": "clutx6n1h00rt07y16xe27hhv", "name": "checklist_question", "value": "checklist_question", "checklist_answers": [ { "feature_id": "clutx70x20onz148pjjl5r8m5", "feature_schema_id": "clutx6n1h00ru07y1hgvd3ekt", "name": "first_checklist_answer", "value": "first_checklist_answer", "classifications": [] }, { "feature_id": "clutx70x20oo0148p3w6es43a", "feature_schema_id": "clutx6n1h00rw07y16t1v8tvi", "name": "second_checklist_answer", "value": "second_checklist_answer", "classifications": [] }, { "feature_id": "clutx70x20oo1148ps1lpz6dl", "feature_schema_id": "clutx6n1h00ry07y1fkbk0pde", "name": "third_checklist_answer", "value": "third_checklist_answer", "classifications": [] } ] }

Free-form text

{ "feature_id": "clpsmujyn4z13143s2iw9n15v", "feature_schema_id": "clpsmu6sz003v07zp2vie3zd8", "name": "free_text", "text_answer": { "content": "sample text" } }

Sample project export

{ "data_row": { "id": "clfh5lsju0bd90763h2o22vvq", "global_key": "lorem-ipsum.txt", "row_data": "https://storage.googleapis.com/labelbox-sample-datasets/nlp/lorem-ipsum.txt", "details": { "dataset_id": "clfh5lpul063507x4a16r5j6x", "dataset_name": "text_annotation_import_demo_dataset", "created_at": "2023-03-20T18:22:00.000+00:00", "updated_at": "2023-03-20T18:22:00.000+00:00", "last_activity_at": "2024-04-10T14:43:10.000+00:00", "created_by": "labelbox.public.user@labelbox.com" } }, "media_attributes": { "mime_type": "text/plain" }, "attachments": [ { "type": "TEXT_URL", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/text_attachment.txt", "id": "clfh5lsjv0bdd07638apx7bf5" } ], "metadata_fields": [], "embeddings": [ { "id": "c300000000000000000000000", "name": "Text Embedding V2 (All-MPNet-base-v2)", "dimensions": 768, "is_custom": false, "values": [ { "value": [ 0.04099537059664726, 0.03790362924337387, -0.013698477298021317, 0.038478486239910126, -0.01930154114961624, 0.05670716613531113, 0.02421298250555992 ... ], "projects": { "clutx6nli00ks07x6efh6e1pw": { "name": "Text Annotation Import Demo", "labels": [ { "label_kind": "Default", "version": "1.0.0", "id": "clutx70xi0oob148pgr7sz5v0", "label_details": { "created_at": "2024-04-10T14:43:11.000+00:00", "updated_at": "2024-04-10T14:43:11.000+00:00", "created_by": "aovalle@labelbox.com", "content_last_updated_at": "2024-04-10T14:43:10.580+00:00", "reviews": [] }, "performance_details": { "seconds_to_create": 0, "seconds_to_review": 0, "skipped": false }, "annotations": { "objects": [ { "feature_id": "clutx70x20onv148pb5ah49lb", "feature_schema_id": "clutx6n1g00r707y110ruh99w", "name": "named_entity", "value": "named_entity", "annotation_kind": "TextEntity", "classifications": [], "location": { "start": 10, "end": 20, "token": "um dolor si" } } ], "classifications": [ { "feature_id": "clutx70x20onw148p7mlgpq90", "feature_schema_id": "clutx6n1h00r907y16s49do9e", "name": "radio_question", "value": "radio_question", "radio_answer": { "feature_id": "clutx70x20onx148px2679qsp", "feature_schema_id": "clutx6n1h00ra07y100njafnj", "name": "first_radio_answer", "value": "first_radio_answer", "classifications": [] } }, { "feature_id": "clutx70x20ony148p6gxk7ec8", "feature_schema_id": "clutx6n1h00rt07y16xe27hhv", "name": "checklist_question", "value": "checklist_question", "checklist_answers": [ { "feature_id": "clutx70x20onz148pjjl5r8m5", "feature_schema_id": "clutx6n1h00ru07y1hgvd3ekt", "name": "first_checklist_answer", "value": "first_checklist_answer", "classifications": [] }, { "feature_id": "clutx70x20oo0148p3w6es43a", "feature_schema_id": "clutx6n1h00rw07y16t1v8tvi", "name": "second_checklist_answer", "value": "second_checklist_answer", "classifications": [] }, { "feature_id": "clutx70x20oo1148ps1lpz6dl", "feature_schema_id": "clutx6n1h00ry07y1fkbk0pde", "name": "third_checklist_answer", "value": "third_checklist_answer", "classifications": [] } ] }, { "feature_id": "clutx70x20oo2148pz466o8ep", "feature_schema_id": "clutx6n1i00s107y18bywdwuh", "name": "free_text", "value": "free_text", "text_answer": { "content": "sample text" } }, { "feature_id": "clutx70x20oo3148poaesoyw7", "feature_schema_id": "clutx6n1h00rl07y12xox0uqk", "name": "nested_checklist_question", "value": "nested_checklist_question", "checklist_answers": [ { "feature_id": "clutx70x20oo4148pgxhy7xr3", "feature_schema_id": "clutx6n1h00rm07y15qdj4mms", "name": "first_checklist_answer", "value": "first_checklist_answer", "classifications": [ { "feature_id": "clutx70x20oo5148plvcm1yhy", "feature_schema_id": "clutx6n1h00rn07y13xi0e1au", "name": "sub_checklist_question", "value": "sub_checklist_question", "checklist_answers": [ { "feature_id": "clutx70x20oo6148pcqjahziw", "feature_schema_id": "clutx6n1h00ro07y164ddfda2", "name": "first_sub_checklist_answer", "value": "first_sub_checklist_answer", "classifications": [] } ] } ] } ] }, { "feature_id": "clutx70x20oo7148pkei2ymj3", "feature_schema_id": "clutx6n1h00rd07y188n4hd08", "name": "nested_radio_question", "value": "nested_radio_question", "radio_answer": { "feature_id": "clutx70x20oo8148pjiiobfl5", "feature_schema_id": "clutx6n1h00re07y1b7v1dd8z", "name": "first_radio_answer", "value": "first_radio_answer", "classifications": [ { "feature_id": "clutx70x20oo9148px2xcuanp", "feature_schema_id": "clutx6n1h00rf07y18f8f45nu", "name": "sub_radio_question", "value": "sub_radio_question", "radio_answer": { "feature_id": "clutx70x20ooa148pqhs0hmot", "feature_schema_id": "clutx6n1h00rg07y1fkkjgr7o", "name": "first_sub_radio_answer", "value": "first_sub_radio_answer", "classifications": [] } } ] } } ], "relationships": [] } } ], "project_details": { "ontology_id": "clutx6n0k00r607y1a0a9bkzj", "task_name": "Done", "batch_id": "9f1c1db0-f748-11ee-b74f-f180a0c567c8", "batch_name": "first-batch-text-demo", "workflow_status": "DONE", "priority": 5, "consensus_expected_label_count": 1, "workflow_history": [] }, "project_tags": [] } } }

Sample model run export

{ "data_row": { "id": "clfh5lsju0bd90763h2o22vvq", "global_key": "lorem-ipsum.txt", "row_data": "https://storage.googleapis.com/labelbox-sample-datasets/nlp/lorem-ipsum.txt", "details": { "dataset_id": "clfh5lpul063507x4a16r5j6x", "dataset_name": "text_annotation_import_demo_dataset", "created_at": "2023-03-20T18:22:00.000+00:00", "updated_at": "2023-03-20T18:22:00.000+00:00", "created_by": "labelbox.public.user@labelbox.com" } }, "media_attributes": { "mime_type": "text/plain" }, "attachments": [ { "type": "TEXT_URL", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/text_attachment.txt", "id": "clfh5lsjv0bdd07638apx7bf5" } ], "metadata_fields": [], "experiments": { "a349da10-5d85-0c82-293d-8165aa611e7c": { "name": "text_model_run_8ad83b1f-c9c6-4ea4-83ce-a287393bb917", "runs": { "a349da10-aa0d-0879-711b-11f0cc035b65": { "name": "iteration 1", "run_data_row_id": "e1898158-c2a9-42fb-8c64-2c81beadafed", "labels": [ { "label_kind": "Default", "version": "1.0.0", "id": "clr16pmfw0g4o140zkwys3f7u", "annotations": { "objects": [ { "feature_id": "6d651dde-6567-0669-83e6-7a6677a5acb2", "feature_schema_id": "clr16p71n018r07tuawb18jt6", "name": "named_entity", "value": "named_entity", "annotation_kind": "TextEntity", "classifications": [], "location": { "start": 10, "end": 20 } } ], "classifications": [ { "feature_id": "08a38f86-5cd1-0feb-ae98-5731b2d2d3bf", "feature_schema_id": "clr16p71p019f07tucv4g1cmm", "name": "nested_checklist_question", "value": "nested_checklist_question", "checklist_answers": [ { "feature_id": "3b97e87d-b196-0c21-a236-8b64f3f08086", "feature_schema_id": "clr16p71p019g07tu9sca1dde", "name": "first_checklist_answer", "value": "first_checklist_answer", "classifications": [ { "feature_id": "8301a2fe-e898-044f-bc8b-a75e48b16f45", "feature_schema_id": "clr16p71p019h07tu5j9o7b4o", "name": "sub_checklist_question", "value": "sub_checklist_question", "checklist_answers": [ { "feature_id": "baea7ccd-57a6-0c4f-bc66-1ddc2a8aa2d9", "feature_schema_id": "clr16p71p019i07tu50tq966e", "name": "first_sub_checklist_answer", "value": "first_sub_checklist_answer", "classifications": [] } ] } ] } ] }, { "feature_id": "60fd8cc0-b5a6-013b-b02b-d91adafb45c1", "feature_schema_id": "clr16p71o018t07tubkih92ua", "name": "radio_question", "value": "radio_question", "radio_answer": { "feature_id": "f0211ed1-4139-08ee-8c35-ea2bcad92b79", "feature_schema_id": "clr16p71o018u07tu8bwc76w1", "name": "first_radio_answer", "value": "first_radio_answer", "classifications": [] } }, { "feature_id": "73beac75-7e6c-0805-a148-2f6b7465f468", "feature_schema_id": "clr16p71p019d07tufulw888j", "name": "free_text", "value": "free_text", "text_answer": { "content": "sample text" } }, { "feature_id": "7a87c79e-6213-032c-859b-547e039ceff7", "feature_schema_id": "clr16p71o018x07tuf7sj7c0x", "name": "nested_radio_question", "value": "nested_radio_question", "radio_answer": { "feature_id": "3aead946-dafd-0f41-8609-826d0d702d68", "feature_schema_id": "clr16p71o018y07tu9oevflh8", "name": "first_radio_answer", "value": "first_radio_answer", "classifications": [ { "feature_id": "ab632136-83c1-0f3e-a4af-87da69b86624", "feature_schema_id": "clr16p71o018z07tuas953oef", "name": "sub_radio_question", "value": "sub_radio_question", "radio_answer": { "feature_id": "2823619a-03bf-0b27-a12e-69f869d8e334", "feature_schema_id": "clr16p71o019007tu8htocx3x", "name": "first_sub_radio_answer", "value": "first_sub_radio_answer", "classifications": [] } } ] } }, { "feature_id": "bd11b44d-3c8d-089d-9531-5177047736b7", "feature_schema_id": "clr16p71p019507tu0x8d0vu4", "name": "checklist_question", "value": "checklist_question", "checklist_answers": [ { "feature_id": "360c8a23-3a74-0e75-9553-286b1b152100", "feature_schema_id": "clr16p71p019a07tuetmgfe7c", "name": "third_checklist_answer", "value": "third_checklist_answer", "classifications": [] }, { "feature_id": "4e12f117-9f03-0a51-8b5d-721b88ce4be0", "feature_schema_id": "clr16p71p019607tu4hkkbhxv", "name": "first_checklist_answer", "value": "first_checklist_answer", "classifications": [] }, { "feature_id": "501d328c-c0ea-0142-8809-ecd1b19961eb", "feature_schema_id": "clr16p71p019807tu3ya04d5x", "name": "second_checklist_answer", "value": "second_checklist_answer", "classifications": [] } ] } ], "relationships": [] } } ], "predictions": [ { "label_kind": "Default", "version": "1.0.0", "id": "clr16pmfw0g4o140zkwys3f7u", "annotations": { "objects": [ { "feature_id": "4bafa398-69d8-4bf8-a3f0-834869ab3e5f", "feature_schema_id": "clr16p71n018r07tuawb18jt6", "name": "named_entity", "value": "named_entity", "annotation_kind": "TextEntity", "classifications": [], "location": { "start": 10, "end": 20 } } ], "classifications": [ { "feature_id": "31737a80-4a5c-4c40-8362-8d59ae6c2047", "feature_schema_id": "clr16p71o018x07tuf7sj7c0x", "name": "nested_radio_question", "value": "nested_radio_question", "radio_answer": { "feature_id": "a00eca18-fb50-4130-a33b-d505ba8e3d04", "feature_schema_id": "clr16p71o018y07tu9oevflh8", "name": "first_radio_answer", "value": "first_radio_answer", "classifications": [ { "feature_id": "94b4ee14-2837-4fb5-b097-4e59cb92b07f", "feature_schema_id": "clr16p71o018z07tuas953oef", "name": "sub_radio_question", "value": "sub_radio_question", "radio_answer": { "feature_id": "a5863817-4c81-424a-8c4c-4cdec05508bf", "feature_schema_id": "clr16p71o019007tu8htocx3x", "name": "first_sub_radio_answer", "value": "first_sub_radio_answer", "classifications": [] } } ] } }, { "feature_id": "741288f5-76ab-4cdf-9277-0f97f0e426fd", "feature_schema_id": "clr16p71o018t07tubkih92ua", "name": "radio_question", "value": "radio_question", "radio_answer": { "feature_id": "64065994-7568-46e1-8bfc-bd96d20384cf", "feature_schema_id": "clr16p71o018u07tu8bwc76w1", "name": "first_radio_answer", "value": "first_radio_answer", "classifications": [] } }, { "feature_id": "a66cc378-aa78-4250-bde1-28da1310bedb", "feature_schema_id": "clr16p71p019507tu0x8d0vu4", "name": "checklist_question", "value": "checklist_question", "checklist_answers": [ { "feature_id": "6db15123-a2dd-4722-8253-32a0c0236850", "feature_schema_id": "clr16p71p019607tu4hkkbhxv", "name": "first_checklist_answer", "value": "first_checklist_answer", "classifications": [] }, { "feature_id": "8eb5629e-8ae1-44f1-b369-491c5c61ea02", "feature_schema_id": "clr16p71p019a07tuetmgfe7c", "name": "third_checklist_answer", "value": "third_checklist_answer", "classifications": [] }, { "feature_id": "fdb2574a-fea7-4127-9ee1-b112126f117a", "feature_schema_id": "clr16p71p019807tu3ya04d5x", "name": "second_checklist_answer", "value": "second_checklist_answer", "classifications": [] } ] }, { "feature_id": "a8386f96-ae13-45c0-bb35-033380f86dc5", "feature_schema_id": "clr16p71p019d07tufulw888j", "name": "free_text", "value": "free_text", "text_answer": { "content": "sample text" } }, { "feature_id": "db0150e9-ecb5-4bad-8350-c82446244657", "feature_schema_id": "clr16p71p019f07tucv4g1cmm", "name": "nested_checklist_question", "value": "nested_checklist_question", "checklist_answers": [ { "feature_id": "84f14b81-301f-41fd-a842-6d48594a40fc", "feature_schema_id": "clr16p71p019g07tu9sca1dde", "name": "first_checklist_answer", "value": "first_checklist_answer", "classifications": [ { "feature_id": "8367c018-cba4-40ff-85e5-c06b137773c3", "feature_schema_id": "clr16p71p019h07tu5j9o7b4o", "name": "sub_checklist_question", "value": "sub_checklist_question", "checklist_answers": [ { "feature_id": "c1e2da03-c23d-4ffa-a25c-e6b6c13a1dae", "feature_schema_id": "clr16p71p019i07tu50tq966e", "name": "first_sub_checklist_answer", "value": "first_sub_checklist_answer", "classifications": [] } ] } ] } ] } ], "relationships": [] } } ] } } } }, "models": {}, "embeddings": [ { "id": "c300000000000000000000000", "name": "Text Embedding V2 (All-MPNet-base-v2)", "dimensions": 768, "is_custom": false, "values": [ { "value": [ 0.04099537059664726, 0.03790362924337387, -0.013698477298021317, 0.038478486239910126, -0.01930154114961624, 0.05670716613531113, 0.02421298250555992 ... ] }