for regex in regex_patterns:
for match in regex.finditer(part.text):
offset = (match.start(), match.end(), part_id, "e_2", doc_id)
matched_text = part.text[match.start():match.end()]
// TODO Refactor into regex instead of check
try:
space_before = part.text[match.start() - 1] == " "
After Change
for regex in regex_patterns:
for match in regex.finditer(part.text):
start = match.start(1)
end = match.end(1)
offset = (start, end, part_id, "e_2", doc_id)
matched_text = part.text[start:end]
if not is_overlapping(offset, existing_predictions):