Merge branch 'main' of https://huggingface.co/datasets/spacemanidol/ESCI-product-dataset
Browse files- ESCI-product-dataset.py +27 -4
ESCI-product-dataset.py
CHANGED
@@ -54,7 +54,7 @@ class ESCIproduct(datasets.GeneratorBasedBuilder):
|
|
54 |
|
55 |
def _info(self):
|
56 |
features = datasets.Features({
|
57 |
-
'query_id': datasets.Value('
|
58 |
'query': datasets.Value('string'),
|
59 |
'positive_passages': [
|
60 |
{'docid': datasets.Value('string'), 'text': datasets.Value('string'),
|
@@ -97,7 +97,6 @@ class ESCIproduct(datasets.GeneratorBasedBuilder):
|
|
97 |
'query-backtranslation': datasets.Value('string'),
|
98 |
'query-char-delete': datasets.Value('string'),
|
99 |
'query-lemmatize': datasets.Value('string')
|
100 |
-
|
101 |
})
|
102 |
|
103 |
return datasets.DatasetInfo(
|
@@ -137,8 +136,32 @@ class ESCIproduct(datasets.GeneratorBasedBuilder):
|
|
137 |
data = json.loads(line)
|
138 |
if data.get('negative_passages') is None:
|
139 |
data['negative_passages'] = []
|
|
|
|
|
|
|
|
|
140 |
if data.get('positive_passages') is None:
|
141 |
data['positive_passages'] = []
|
142 |
-
if data.get('
|
143 |
-
data['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
yield data['query_id'], data
|
|
|
54 |
|
55 |
def _info(self):
|
56 |
features = datasets.Features({
|
57 |
+
'query_id': datasets.Value('string'),
|
58 |
'query': datasets.Value('string'),
|
59 |
'positive_passages': [
|
60 |
{'docid': datasets.Value('string'), 'text': datasets.Value('string'),
|
|
|
97 |
'query-backtranslation': datasets.Value('string'),
|
98 |
'query-char-delete': datasets.Value('string'),
|
99 |
'query-lemmatize': datasets.Value('string')
|
|
|
100 |
})
|
101 |
|
102 |
return datasets.DatasetInfo(
|
|
|
136 |
data = json.loads(line)
|
137 |
if data.get('negative_passages') is None:
|
138 |
data['negative_passages'] = []
|
139 |
+
if data.get('negative_passages_true') is None:
|
140 |
+
data['negative_passages_true'] = []
|
141 |
+
if data.get('negative_passages_complement') is None:
|
142 |
+
data['negative_passages_complement'] = []
|
143 |
if data.get('positive_passages') is None:
|
144 |
data['positive_passages'] = []
|
145 |
+
if data.get('positive_passages_substitute') is None:
|
146 |
+
data['positive_passages_substitute'] = []
|
147 |
+
if data.get('query-stem') is None:
|
148 |
+
data['query-stem'] = data['query']
|
149 |
+
if data.get('query-lemmatize') is None:
|
150 |
+
data['query-lemmatize'] = data['query']
|
151 |
+
if data.get('query-char-delete') is None:
|
152 |
+
data['query-char-delete'] = data['query']
|
153 |
+
if data.get('query-char-keyboard') is None:
|
154 |
+
data['query-random-char-swap'] = data['query']
|
155 |
+
if data.get('query-inject-det') is None:
|
156 |
+
data['query-inject-det'] = data['query']
|
157 |
+
if data.get('query-synonym') is None:
|
158 |
+
data['query-synonym'] = data['query']
|
159 |
+
if data.get('query-char-keyboard') is None:
|
160 |
+
data['query-char-keyboard'] = data['query']
|
161 |
+
if data.get('query-paraphrase') is None:
|
162 |
+
data['query-paraphrase'] = data['query']
|
163 |
+
if data.get('query-reorder-words') is None:
|
164 |
+
data['query-reorder-words'] = data['query']
|
165 |
+
if data.get('query-backtranslation') is None:
|
166 |
+
data['query-backtranslation'] = data['query']
|
167 |
yield data['query_id'], data
|