Commit
·
10aa19c
1
Parent(s):
3779e55
fix
Browse files
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 |
-
|
| 92 |
-
|
| 93 |
-
|
| 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: {
|
| 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 |
)
|