Upload PAIR.py
Browse files
PAIR.py
CHANGED
@@ -91,8 +91,7 @@ class PAIRDataset(datasets.GeneratorBasedBuilder):
|
|
91 |
description="My custom dataset.",
|
92 |
features=datasets.Features(
|
93 |
{
|
94 |
-
|
95 |
-
"EC": datasets.Sequence(datasets.Value("string")),
|
96 |
"sequence": datasets.Value("string"),
|
97 |
"pid": datasets.Value("string"),
|
98 |
}
|
@@ -143,8 +142,8 @@ class PAIRDataset(datasets.GeneratorBasedBuilder):
|
|
143 |
counter = 0
|
144 |
for idx, annotation_type in enumerate(data.keys()):
|
145 |
print(annotation_type, self.annotation_type)
|
146 |
-
|
147 |
-
|
148 |
# Parse your line into the appropriate fields
|
149 |
samples = data[annotation_type]
|
150 |
for idx_2, elem in enumerate(samples):
|
@@ -152,7 +151,7 @@ class PAIRDataset(datasets.GeneratorBasedBuilder):
|
|
152 |
if elem["content"] != [None]:
|
153 |
content = elem["content"][0]
|
154 |
# print(literal_eval(content), "done")
|
155 |
-
yield
|
156 |
"sequence": elem["seq"],
|
157 |
"pid": elem["pid"],
|
158 |
annotation_type: content,
|
|
|
91 |
description="My custom dataset.",
|
92 |
features=datasets.Features(
|
93 |
{
|
94 |
+
self.annotation_type: annotation2type[self.annotation_type],
|
|
|
95 |
"sequence": datasets.Value("string"),
|
96 |
"pid": datasets.Value("string"),
|
97 |
}
|
|
|
142 |
counter = 0
|
143 |
for idx, annotation_type in enumerate(data.keys()):
|
144 |
print(annotation_type, self.annotation_type)
|
145 |
+
if annotation_type != self.annotation_type:
|
146 |
+
continue
|
147 |
# Parse your line into the appropriate fields
|
148 |
samples = data[annotation_type]
|
149 |
for idx_2, elem in enumerate(samples):
|
|
|
151 |
if elem["content"] != [None]:
|
152 |
content = elem["content"][0]
|
153 |
# print(literal_eval(content), "done")
|
154 |
+
yield counter, {
|
155 |
"sequence": elem["seq"],
|
156 |
"pid": elem["pid"],
|
157 |
annotation_type: content,
|