ArneBinder commited on
Commit
10aa19c
·
1 Parent(s): 3779e55
Files changed (1) hide show
  1. brat.py +5 -6
brat.py CHANGED
@@ -88,13 +88,12 @@ def example_to_document(
88
  if merge_non_contiguous_spans:
89
  if len(starts) > 1:
90
  # check if the text in between the fragments holds only space
91
- merged_content_spans = list(zip(ends[:-1],starts[1:]))
92
- merged_content_texts = [doc.text[strart:end] for starte, end in merged_content_spans]
93
- merged_content_texts_filtered = [text.trim() for text in merged_content_texts if text.trim() != ""]
94
- if len(merged_content_texts_filtered) > 0:
95
  logger.warning(
96
- f"document '{doc.id}' contains a non-contiguous span (will be merged into a single span): "
97
- f"newly covered text parts: {merged_content_texts_filtered}, "
98
  f"merged span text: '{doc.text[starts[0]:ends[-1]]}', "
99
  f"annotation: {span_dict}"
100
  )
 
88
  if merge_non_contiguous_spans:
89
  if len(starts) > 1:
90
  # check if the text in between the fragments holds only space
91
+ merged_content_texts = [doc.text[start:end] for start, end in zip(ends[:-1],starts[1:])]
92
+ merged_content_texts_not_empty = [text.trim() for text in merged_content_texts if text.trim() != ""]
93
+ if len(merged_content_texts_not_empty) > 0:
 
94
  logger.warning(
95
+ f"document '{doc.id}' contains a non-contiguous span with text content in between (will be merged into a single span): "
96
+ f"newly covered text parts: {merged_content_texts_not_empty}, "
97
  f"merged span text: '{doc.text[starts[0]:ends[-1]]}', "
98
  f"annotation: {span_dict}"
99
  )