from https://github.com/ArneBinder/pie-datasets/pull/159
Browse files
sciarg.py
CHANGED
@@ -7,13 +7,13 @@ from pie_modules.document.processing import (
|
|
7 |
SpansViaRelationMerger,
|
8 |
TextSpanTrimmer,
|
9 |
)
|
10 |
-
from
|
|
|
11 |
TextDocumentWithLabeledMultiSpansAndBinaryRelations,
|
12 |
TextDocumentWithLabeledMultiSpansBinaryRelationsAndLabeledPartitions,
|
13 |
TextDocumentWithLabeledSpansAndBinaryRelations,
|
14 |
TextDocumentWithLabeledSpansBinaryRelationsAndLabeledPartitions,
|
15 |
)
|
16 |
-
from pytorch_ie.core import Document
|
17 |
|
18 |
from pie_datasets.builders import BratBuilder, BratConfig
|
19 |
from pie_datasets.builders.brat import BratDocument, BratDocumentWithMergedSpans
|
@@ -123,7 +123,8 @@ class SciArg(BratBuilder):
|
|
123 |
def document_converters(self) -> DocumentConvertersType:
|
124 |
regex_partitioner = RegexPartitioner(
|
125 |
partition_layer_name="labeled_partitions",
|
126 |
-
|
|
|
127 |
label_group_id=1,
|
128 |
label_whitelist=["Title", "Abstract", "H1"],
|
129 |
skip_initial_partition=True,
|
|
|
7 |
SpansViaRelationMerger,
|
8 |
TextSpanTrimmer,
|
9 |
)
|
10 |
+
from pytorch_ie.core import Document
|
11 |
+
from pytorch_ie.documents import (
|
12 |
TextDocumentWithLabeledMultiSpansAndBinaryRelations,
|
13 |
TextDocumentWithLabeledMultiSpansBinaryRelationsAndLabeledPartitions,
|
14 |
TextDocumentWithLabeledSpansAndBinaryRelations,
|
15 |
TextDocumentWithLabeledSpansBinaryRelationsAndLabeledPartitions,
|
16 |
)
|
|
|
17 |
|
18 |
from pie_datasets.builders import BratBuilder, BratConfig
|
19 |
from pie_datasets.builders.brat import BratDocument, BratDocumentWithMergedSpans
|
|
|
123 |
def document_converters(self) -> DocumentConvertersType:
|
124 |
regex_partitioner = RegexPartitioner(
|
125 |
partition_layer_name="labeled_partitions",
|
126 |
+
# find matching tags, allow newlines in between (s flag) and capture the tag name
|
127 |
+
pattern="<([^>/]+)>(?s:.)*?</\\1>",
|
128 |
label_group_id=1,
|
129 |
label_whitelist=["Title", "Abstract", "H1"],
|
130 |
skip_initial_partition=True,
|