From 2fec154d1026a05f66df82be8f5c43f01db2ecb6 Mon Sep 17 00:00:00 2001 From: Laure Thompson <602628+laurejt@users.noreply.github.com> Date: Wed, 25 Sep 2024 16:30:53 -0400 Subject: [PATCH] Updated recipe to (1) allow character-level highlighting, (2) drop the ignore button, and (3) update task routing to limit 2 annotations per task. --- src/corppa/poetry_detection/annotation/recipe.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/corppa/poetry_detection/annotation/recipe.py b/src/corppa/poetry_detection/annotation/recipe.py index a6efc98..53ee97a 100644 --- a/src/corppa/poetry_detection/annotation/recipe.py +++ b/src/corppa/poetry_detection/annotation/recipe.py @@ -24,6 +24,7 @@ #: common prodigy configurations for both recipes; copy and add blocks and labels PRODIGY_COMMON_CONFIG = { + "buttons": ["accept", "reject", "undo"], # remove ignore button "show_flag": True, # show flag button to mark weird/difficult examples "hide_newlines": False, # ensure newlines are shown \n "allow_newline_highlight": True, # allow highlighting of newlines \n @@ -38,6 +39,9 @@ "hide_true_newline_tokens": False, }, "global_css_dir": CURRENT_DIR, + # Task annotation flags, these should be move elsewhere + "feed_overlap": False, + "annotations_per_tasks": 2, } @@ -107,6 +111,7 @@ def annotate_text_and_image( { "blocks": blocks, "labels": label_list, + "ner_manual_highlight_chars": True, "image_manual_spans_key": "image_spans", # limit image selection to rectangle only, no polygon or freehand "image_manual_modes": ["rect"], @@ -151,7 +156,13 @@ def annotate_page_text( ] # copy the common config options and add blocks and labels config = PRODIGY_COMMON_CONFIG.copy() - config.update({"blocks": blocks, "labels": label_list}) + config.update( + { + "blocks": blocks, + "labels": label_list, + "ner_manual_highlight_chars": True, + } + ) return { "dataset": dataset,