Commit
·
3779e55
1
Parent(s):
ba8921f
fix previous commit
Browse files
brat.py
CHANGED
|
@@ -89,11 +89,12 @@ def example_to_document(
|
|
| 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 |
-
|
| 93 |
-
if
|
|
|
|
| 94 |
logger.warning(
|
| 95 |
f"document '{doc.id}' contains a non-contiguous span (will be merged into a single span): "
|
| 96 |
-
f"newly covered text parts: {
|
| 97 |
f"merged span text: '{doc.text[starts[0]:ends[-1]]}', "
|
| 98 |
f"annotation: {span_dict}"
|
| 99 |
)
|
|
|
|
| 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 |
)
|