Daniel Campos
commited on
Commit
•
3ebbdc1
1
Parent(s):
b219c0e
Update ESCI-product-dataset.py
Browse files- ESCI-product-dataset.py +0 -43
ESCI-product-dataset.py
CHANGED
@@ -38,8 +38,6 @@ _DESCRIPTION = "dataset load script for ESCI-product-dataset recall"
|
|
38 |
|
39 |
_DATASET_URLS = {
|
40 |
'train': "https://huggingface.co/datasets/spacemanidol/ESCI-product-dataset/resolve/main/train.jsonl",
|
41 |
-
#'dev': "https://huggingface.co/datasets/spacemanidol/ESCI-product-dataset/resolve/main/dev.jsonl.gz",
|
42 |
-
#'test': "https://huggingface.co/datasets/resolve/main/nq-test.jsonl.gz",
|
43 |
}
|
44 |
|
45 |
|
@@ -55,37 +53,6 @@ class ESCIproduct(datasets.GeneratorBasedBuilder):
|
|
55 |
features = datasets.Features({
|
56 |
'query_id': datasets.Value('string'),
|
57 |
'query': datasets.Value('string'),
|
58 |
-
'positive_passages': [
|
59 |
-
{'docid': datasets.Value('string'), 'text': datasets.Value('string'),
|
60 |
-
'title': datasets.Value('string'), 'bullet_points': datasets.Value('string'),
|
61 |
-
'color': datasets.Value('string'), 'locale': datasets.Value('string'),
|
62 |
-
'brand': datasets.Value('string'),'contents': datasets.Value('string')}
|
63 |
-
],
|
64 |
-
'positive_passages_substitue': [
|
65 |
-
{'docid': datasets.Value('string'), 'text': datasets.Value('string'),
|
66 |
-
'title': datasets.Value('string'), 'bullet_points': datasets.Value('string'),
|
67 |
-
'color': datasets.Value('string'), 'locale': datasets.Value('string'),
|
68 |
-
'brand': datasets.Value('string'),'contents': datasets.Value('string')}
|
69 |
-
|
70 |
-
],
|
71 |
-
'negative_passages': [
|
72 |
-
{'docid': datasets.Value('string'), 'text': datasets.Value('string'),
|
73 |
-
'title': datasets.Value('string'), 'bullet_points': datasets.Value('string'),
|
74 |
-
'color': datasets.Value('string'), 'locale': datasets.Value('string'),
|
75 |
-
'brand': datasets.Value('string'),'contents': datasets.Value('string')}
|
76 |
-
],
|
77 |
-
'negative_passages_true': [
|
78 |
-
{'docid': datasets.Value('string'), 'text': datasets.Value('string'),
|
79 |
-
'title': datasets.Value('string'), 'bullet_points': datasets.Value('string'),
|
80 |
-
'color': datasets.Value('string'), 'locale': datasets.Value('string'),
|
81 |
-
'brand': datasets.Value('string'),'contents': datasets.Value('string')}
|
82 |
-
],
|
83 |
-
'negative_passages_complement': [
|
84 |
-
{'docid': datasets.Value('string'), 'text': datasets.Value('string'),
|
85 |
-
'title': datasets.Value('string'), 'bullet_points': datasets.Value('string'),
|
86 |
-
'color': datasets.Value('string'), 'locale': datasets.Value('string'),
|
87 |
-
'brand': datasets.Value('string'),'contents': datasets.Value('string')}
|
88 |
-
],
|
89 |
'query-inject-det': datasets.Value('string'),
|
90 |
'query-stem': datasets.Value('string'),
|
91 |
'query-synonym': datasets.Value('string'),
|
@@ -133,16 +100,6 @@ class ESCIproduct(datasets.GeneratorBasedBuilder):
|
|
133 |
with open(filepath, encoding="utf-8") as f:
|
134 |
for line in f:
|
135 |
data = json.loads(line)
|
136 |
-
if data.get('negative_passages') is None:
|
137 |
-
data['negative_passages'] = []
|
138 |
-
if data.get('negative_passages_true') is None:
|
139 |
-
data['negative_passages_true'] = []
|
140 |
-
if data.get('negative_passages_complement') is None:
|
141 |
-
data['negative_passages_complement'] = []
|
142 |
-
if data.get('positive_passages') is None:
|
143 |
-
data['positive_passages'] = []
|
144 |
-
if data.get('positive_passages_substitute') is None:
|
145 |
-
data['positive_passages_substitute'] = []
|
146 |
if data.get('query-stem') is None:
|
147 |
data['query-stem'] = data['query']
|
148 |
if data.get('query-lemmatize') is None:
|
|
|
38 |
|
39 |
_DATASET_URLS = {
|
40 |
'train': "https://huggingface.co/datasets/spacemanidol/ESCI-product-dataset/resolve/main/train.jsonl",
|
|
|
|
|
41 |
}
|
42 |
|
43 |
|
|
|
53 |
features = datasets.Features({
|
54 |
'query_id': datasets.Value('string'),
|
55 |
'query': datasets.Value('string'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
'query-inject-det': datasets.Value('string'),
|
57 |
'query-stem': datasets.Value('string'),
|
58 |
'query-synonym': datasets.Value('string'),
|
|
|
100 |
with open(filepath, encoding="utf-8") as f:
|
101 |
for line in f:
|
102 |
data = json.loads(line)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
if data.get('query-stem') is None:
|
104 |
data['query-stem'] = data['query']
|
105 |
if data.get('query-lemmatize') is None:
|