From 499884aff6929866ffbee01f22ae09c3378769b1 Mon Sep 17 00:00:00 2001 From: Aman Tiwari Date: Wed, 23 Jun 2021 18:20:09 +0530 Subject: [PATCH] Add: Remove word boundary from regex --- label_studio/tasks/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/label_studio/tasks/api.py b/label_studio/tasks/api.py index cbd10c75a4fd..8580eb16cdea 100644 --- a/label_studio/tasks/api.py +++ b/label_studio/tasks/api.py @@ -209,13 +209,13 @@ def fetch_diff(list1, list2): change = fetch_diff(added, new_added) for i in change: new_draft.remove(i) - added=new_added + added = new_added for annotation in tqdm(added): annotated_text = annotation['value']['text'] label = annotation['value']['labels'][0] # ToDo Add inclusion list original_start = annotation['value']['start'] original_end = annotation['value']['end'] - pattern = re.compile(r'\b' + re.escape(annotated_text) + r'\b') + pattern = re.compile(re.escape(annotated_text)) for found in pattern.finditer(text): start = found.span()[0] end = found.span()[1]