Datasets:
Tasks:
Text Classification
Sub-tasks:
sentiment-classification
Languages:
English
Size:
1K - 10K
License:
Update etpc.py
Browse files
etpc.py
CHANGED
@@ -87,6 +87,12 @@ class ETPC(datasets.GeneratorBasedBuilder):
|
|
87 |
"sentence2_segment_location": datasets.Sequence(
|
88 |
datasets.Value("int32")
|
89 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
"sentence1_segment_text": datasets.Sequence(
|
91 |
datasets.Value("string")
|
92 |
),
|
@@ -116,7 +122,6 @@ class ETPC(datasets.GeneratorBasedBuilder):
|
|
116 |
]
|
117 |
|
118 |
def _generate_examples(self, file_paths):
|
119 |
-
|
120 |
file_paths = list(file_paths)
|
121 |
text_pairs_path = file_paths[0]
|
122 |
paraphrase_types_path = file_paths[1]
|
@@ -168,6 +173,9 @@ class ETPC(datasets.GeneratorBasedBuilder):
|
|
168 |
len(sentence2_tokenized)
|
169 |
)
|
170 |
|
|
|
|
|
|
|
171 |
for (
|
172 |
sentence1_segment_locations,
|
173 |
sentence2_segment_locations,
|
@@ -180,6 +188,7 @@ class ETPC(datasets.GeneratorBasedBuilder):
|
|
180 |
segment_locations_1 = [
|
181 |
int(i) for i in sentence1_segment_locations.split(",")
|
182 |
]
|
|
|
183 |
sentence1_segment_location_full[segment_locations_1] = [
|
184 |
paraphrase_type_id
|
185 |
] * len(segment_locations_1)
|
@@ -187,6 +196,7 @@ class ETPC(datasets.GeneratorBasedBuilder):
|
|
187 |
segment_locations_2 = [
|
188 |
int(i) for i in sentence2_segment_locations.split(",")
|
189 |
]
|
|
|
190 |
sentence2_segment_location_full[segment_locations_2] = [
|
191 |
paraphrase_type_id
|
192 |
] * len(segment_locations_2)
|
@@ -204,6 +214,8 @@ class ETPC(datasets.GeneratorBasedBuilder):
|
|
204 |
"paraphrase_type_ids": paraphrase_type_ids,
|
205 |
"sentence1_segment_location": sentence1_segment_location_full,
|
206 |
"sentence2_segment_location": sentence2_segment_location_full,
|
|
|
|
|
207 |
"sentence1_segment_text": sentence1_segment_text,
|
208 |
"sentence2_segment_text": sentence2_segment_text,
|
209 |
}
|
|
|
87 |
"sentence2_segment_location": datasets.Sequence(
|
88 |
datasets.Value("int32")
|
89 |
),
|
90 |
+
"sentence1_segment_location_indices": datasets.Sequence(
|
91 |
+
datasets.Sequence(datasets.Value("int32"))
|
92 |
+
),
|
93 |
+
"sentence2_segment_location_indices": datasets.Sequence(
|
94 |
+
datasets.Sequence(datasets.Value("int32"))
|
95 |
+
),
|
96 |
"sentence1_segment_text": datasets.Sequence(
|
97 |
datasets.Value("string")
|
98 |
),
|
|
|
122 |
]
|
123 |
|
124 |
def _generate_examples(self, file_paths):
|
|
|
125 |
file_paths = list(file_paths)
|
126 |
text_pairs_path = file_paths[0]
|
127 |
paraphrase_types_path = file_paths[1]
|
|
|
173 |
len(sentence2_tokenized)
|
174 |
)
|
175 |
|
176 |
+
sentence1_segment_indices = []
|
177 |
+
sentence2_segment_indices = []
|
178 |
+
|
179 |
for (
|
180 |
sentence1_segment_locations,
|
181 |
sentence2_segment_locations,
|
|
|
188 |
segment_locations_1 = [
|
189 |
int(i) for i in sentence1_segment_locations.split(",")
|
190 |
]
|
191 |
+
sentence1_segment_indices.append(segment_locations_1)
|
192 |
sentence1_segment_location_full[segment_locations_1] = [
|
193 |
paraphrase_type_id
|
194 |
] * len(segment_locations_1)
|
|
|
196 |
segment_locations_2 = [
|
197 |
int(i) for i in sentence2_segment_locations.split(",")
|
198 |
]
|
199 |
+
sentence2_segment_indices.append(segment_locations_2)
|
200 |
sentence2_segment_location_full[segment_locations_2] = [
|
201 |
paraphrase_type_id
|
202 |
] * len(segment_locations_2)
|
|
|
214 |
"paraphrase_type_ids": paraphrase_type_ids,
|
215 |
"sentence1_segment_location": sentence1_segment_location_full,
|
216 |
"sentence2_segment_location": sentence2_segment_location_full,
|
217 |
+
"sentence1_segment_location_indices": sentence1_segment_indices,
|
218 |
+
"sentence2_segment_location_indices": sentence2_segment_indices,
|
219 |
"sentence1_segment_text": sentence1_segment_text,
|
220 |
"sentence2_segment_text": sentence2_segment_text,
|
221 |
}
|