clampert commited on
Commit
3e8b8ff
·
verified ·
1 Parent(s): 801e0b8

Delete loading script

Browse files
Files changed (1) hide show
  1. Amazon-Reviews-2023.py +0 -557
Amazon-Reviews-2023.py DELETED
@@ -1,557 +0,0 @@
1
- import json
2
-
3
- import datasets
4
-
5
-
6
- _AMAZON_REVIEW_2023_DESCRIPTION = """\
7
- Amazon Review 2023 is an updated version of the Amazon Review 2018 dataset.
8
- This dataset mainly includes reviews (ratings, text) and item metadata (desc-
9
- riptions, category information, price, brand, and images). Compared to the pre-
10
- vious versions, the 2023 version features larger size, newer reviews (up to Sep
11
- 2023), richer and cleaner meta data, and finer-grained timestamps (from day to
12
- milli-second).
13
-
14
- """
15
-
16
-
17
- class RawMetaAmazonReview2023Config(datasets.BuilderConfig):
18
- def __init__(self, **kwargs):
19
- super(RawMetaAmazonReview2023Config, self).__init__(**kwargs)
20
-
21
- self.suffix = 'jsonl'
22
- self.domain = self.name[len(f'raw_meta_'):]
23
- self.description = f'This is a subset for items in domain: {self.domain}.'
24
- self.data_dir = f'raw/meta_categories/meta_{self.domain}.jsonl'
25
-
26
-
27
- class RawReviewAmazonReview2023Config(datasets.BuilderConfig):
28
- def __init__(self, **kwargs):
29
- super(RawReviewAmazonReview2023Config, self).__init__(**kwargs)
30
-
31
- self.suffix = 'jsonl'
32
- self.domain = self.name[len(f'raw_review_'):]
33
- self.description = f'This is a subset for reviews in domain: {self.domain}.'
34
- self.data_dir = f'raw/review_categories/{self.domain}.jsonl'
35
-
36
-
37
- class RatingOnlyAmazonReview2023Config(datasets.BuilderConfig):
38
- def __init__(self, **kwargs):
39
- super(RatingOnlyAmazonReview2023Config, self).__init__(**kwargs)
40
-
41
- self.suffix = 'csv'
42
- self.kcore = self.name[:len('0core')]
43
- self.domain = self.name[len(f'0core_rating_only_'):]
44
- self.description = \
45
- f'This is the preprocessed file that only contains <user, item, rating, timestamp> in domain: {self.domain}.\n' \
46
- f'The preprocessing includes {self.kcore} filtering and <user, item> interaction deduplication'
47
- self.data_dir = f'benchmark/{self.kcore}/rating_only/{self.domain}.csv'
48
-
49
-
50
- class BenchmarkAmazonReview2023Config(datasets.BuilderConfig):
51
- def __init__(self, **kwargs):
52
- super(BenchmarkAmazonReview2023Config, self).__init__(**kwargs)
53
-
54
- self.suffix = 'csv'
55
- self.split = None
56
- for potential_split in ['last_out_w_his', 'timestamp_w_his', 'last_out', 'timestamp']:
57
- if potential_split in self.name:
58
- self.split = potential_split
59
- break
60
- if self.split is None:
61
- ValueError(f'Cannot find valid split for {self.name}')
62
- self.kcore = self.name[:len('0core')]
63
- self.domain = self.name[len(f'0core_{self.split}_'):]
64
- self.description = \
65
- f'This is the preprocessed benchmark in domain: {self.domain}.' \
66
- f'The preprocessing includes {self.kcore} filtering, <user, item> interaction deduplication, ' \
67
- f'as well as split by {self.split}.'
68
- self.data_dir = {
69
- 'train': f'benchmark/{self.kcore}/{self.split}/{self.domain}.train.csv',
70
- 'valid': f'benchmark/{self.kcore}/{self.split}/{self.domain}.valid.csv',
71
- 'test': f'benchmark/{self.kcore}/{self.split}/{self.domain}.test.csv'
72
- }
73
-
74
-
75
- class AmazonReview2023(datasets.GeneratorBasedBuilder):
76
- BUILDER_CONFIGS = [
77
- # Raw item metadata
78
- RawMetaAmazonReview2023Config(name='raw_meta_All_Beauty'),
79
- RawMetaAmazonReview2023Config(name='raw_meta_Toys_and_Games'),
80
- RawMetaAmazonReview2023Config(name='raw_meta_Cell_Phones_and_Accessories'),
81
- RawMetaAmazonReview2023Config(name='raw_meta_Industrial_and_Scientific'),
82
- RawMetaAmazonReview2023Config(name='raw_meta_Gift_Cards'),
83
- RawMetaAmazonReview2023Config(name='raw_meta_Musical_Instruments'),
84
- RawMetaAmazonReview2023Config(name='raw_meta_Electronics'),
85
- RawMetaAmazonReview2023Config(name='raw_meta_Handmade_Products'),
86
- RawMetaAmazonReview2023Config(name='raw_meta_Arts_Crafts_and_Sewing'),
87
- RawMetaAmazonReview2023Config(name='raw_meta_Baby_Products'),
88
- RawMetaAmazonReview2023Config(name='raw_meta_Health_and_Household'),
89
- RawMetaAmazonReview2023Config(name='raw_meta_Office_Products'),
90
- RawMetaAmazonReview2023Config(name='raw_meta_Digital_Music'),
91
- RawMetaAmazonReview2023Config(name='raw_meta_Grocery_and_Gourmet_Food'),
92
- RawMetaAmazonReview2023Config(name='raw_meta_Sports_and_Outdoors'),
93
- RawMetaAmazonReview2023Config(name='raw_meta_Home_and_Kitchen'),
94
- RawMetaAmazonReview2023Config(name='raw_meta_Subscription_Boxes'),
95
- RawMetaAmazonReview2023Config(name='raw_meta_Tools_and_Home_Improvement'),
96
- RawMetaAmazonReview2023Config(name='raw_meta_Pet_Supplies'),
97
- RawMetaAmazonReview2023Config(name='raw_meta_Video_Games'),
98
- RawMetaAmazonReview2023Config(name='raw_meta_Kindle_Store'),
99
- RawMetaAmazonReview2023Config(name='raw_meta_Clothing_Shoes_and_Jewelry'),
100
- RawMetaAmazonReview2023Config(name='raw_meta_Patio_Lawn_and_Garden'),
101
- RawMetaAmazonReview2023Config(name='raw_meta_Unknown'),
102
- RawMetaAmazonReview2023Config(name='raw_meta_Books'),
103
- RawMetaAmazonReview2023Config(name='raw_meta_Automotive'),
104
- RawMetaAmazonReview2023Config(name='raw_meta_CDs_and_Vinyl'),
105
- RawMetaAmazonReview2023Config(name='raw_meta_Beauty_and_Personal_Care'),
106
- RawMetaAmazonReview2023Config(name='raw_meta_Amazon_Fashion'),
107
- RawMetaAmazonReview2023Config(name='raw_meta_Magazine_Subscriptions'),
108
- RawMetaAmazonReview2023Config(name='raw_meta_Software'),
109
- RawMetaAmazonReview2023Config(name='raw_meta_Health_and_Personal_Care'),
110
- RawMetaAmazonReview2023Config(name='raw_meta_Appliances'),
111
- RawMetaAmazonReview2023Config(name='raw_meta_Movies_and_TV'),
112
- # Raw review
113
- RawReviewAmazonReview2023Config(name='raw_review_All_Beauty'),
114
- RawReviewAmazonReview2023Config(name='raw_review_Toys_and_Games'),
115
- RawReviewAmazonReview2023Config(name='raw_review_Cell_Phones_and_Accessories'),
116
- RawReviewAmazonReview2023Config(name='raw_review_Industrial_and_Scientific'),
117
- RawReviewAmazonReview2023Config(name='raw_review_Gift_Cards'),
118
- RawReviewAmazonReview2023Config(name='raw_review_Musical_Instruments'),
119
- RawReviewAmazonReview2023Config(name='raw_review_Electronics'),
120
- RawReviewAmazonReview2023Config(name='raw_review_Handmade_Products'),
121
- RawReviewAmazonReview2023Config(name='raw_review_Arts_Crafts_and_Sewing'),
122
- RawReviewAmazonReview2023Config(name='raw_review_Baby_Products'),
123
- RawReviewAmazonReview2023Config(name='raw_review_Health_and_Household'),
124
- RawReviewAmazonReview2023Config(name='raw_review_Office_Products'),
125
- RawReviewAmazonReview2023Config(name='raw_review_Digital_Music'),
126
- RawReviewAmazonReview2023Config(name='raw_review_Grocery_and_Gourmet_Food'),
127
- RawReviewAmazonReview2023Config(name='raw_review_Sports_and_Outdoors'),
128
- RawReviewAmazonReview2023Config(name='raw_review_Home_and_Kitchen'),
129
- RawReviewAmazonReview2023Config(name='raw_review_Subscription_Boxes'),
130
- RawReviewAmazonReview2023Config(name='raw_review_Tools_and_Home_Improvement'),
131
- RawReviewAmazonReview2023Config(name='raw_review_Pet_Supplies'),
132
- RawReviewAmazonReview2023Config(name='raw_review_Video_Games'),
133
- RawReviewAmazonReview2023Config(name='raw_review_Kindle_Store'),
134
- RawReviewAmazonReview2023Config(name='raw_review_Clothing_Shoes_and_Jewelry'),
135
- RawReviewAmazonReview2023Config(name='raw_review_Patio_Lawn_and_Garden'),
136
- RawReviewAmazonReview2023Config(name='raw_review_Unknown'),
137
- RawReviewAmazonReview2023Config(name='raw_review_Books'),
138
- RawReviewAmazonReview2023Config(name='raw_review_Automotive'),
139
- RawReviewAmazonReview2023Config(name='raw_review_CDs_and_Vinyl'),
140
- RawReviewAmazonReview2023Config(name='raw_review_Beauty_and_Personal_Care'),
141
- RawReviewAmazonReview2023Config(name='raw_review_Amazon_Fashion'),
142
- RawReviewAmazonReview2023Config(name='raw_review_Magazine_Subscriptions'),
143
- RawReviewAmazonReview2023Config(name='raw_review_Software'),
144
- RawReviewAmazonReview2023Config(name='raw_review_Health_and_Personal_Care'),
145
- RawReviewAmazonReview2023Config(name='raw_review_Appliances'),
146
- RawReviewAmazonReview2023Config(name='raw_review_Movies_and_TV'),
147
- # Rating only - 0core
148
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_All_Beauty'),
149
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Toys_and_Games'),
150
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Cell_Phones_and_Accessories'),
151
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Industrial_and_Scientific'),
152
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Gift_Cards'),
153
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Musical_Instruments'),
154
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Electronics'),
155
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Handmade_Products'),
156
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Arts_Crafts_and_Sewing'),
157
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Baby_Products'),
158
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Health_and_Household'),
159
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Office_Products'),
160
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Digital_Music'),
161
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Grocery_and_Gourmet_Food'),
162
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Sports_and_Outdoors'),
163
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Home_and_Kitchen'),
164
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Subscription_Boxes'),
165
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Tools_and_Home_Improvement'),
166
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Pet_Supplies'),
167
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Video_Games'),
168
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Kindle_Store'),
169
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Clothing_Shoes_and_Jewelry'),
170
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Patio_Lawn_and_Garden'),
171
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Unknown'),
172
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Books'),
173
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Automotive'),
174
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_CDs_and_Vinyl'),
175
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Beauty_and_Personal_Care'),
176
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Amazon_Fashion'),
177
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Magazine_Subscriptions'),
178
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Software'),
179
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Health_and_Personal_Care'),
180
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Appliances'),
181
- RatingOnlyAmazonReview2023Config(name='0core_rating_only_Movies_and_TV'),
182
- # Rating only - 5core
183
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_All_Beauty'),
184
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Toys_and_Games'),
185
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Cell_Phones_and_Accessories'),
186
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Industrial_and_Scientific'),
187
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Gift_Cards'),
188
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Musical_Instruments'),
189
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Electronics'),
190
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Arts_Crafts_and_Sewing'),
191
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Baby_Products'),
192
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Health_and_Household'),
193
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Office_Products'),
194
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Grocery_and_Gourmet_Food'),
195
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Sports_and_Outdoors'),
196
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Home_and_Kitchen'),
197
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Tools_and_Home_Improvement'),
198
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Pet_Supplies'),
199
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Video_Games'),
200
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Kindle_Store'),
201
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Clothing_Shoes_and_Jewelry'),
202
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Patio_Lawn_and_Garden'),
203
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Unknown'),
204
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Books'),
205
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Automotive'),
206
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_CDs_and_Vinyl'),
207
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Beauty_and_Personal_Care'),
208
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Magazine_Subscriptions'),
209
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Software'),
210
- RatingOnlyAmazonReview2023Config(name='5core_rating_only_Movies_and_TV'),
211
- # Benchmark - last_out - 0core
212
- BenchmarkAmazonReview2023Config(name='0core_last_out_All_Beauty'),
213
- BenchmarkAmazonReview2023Config(name='0core_last_out_Toys_and_Games'),
214
- BenchmarkAmazonReview2023Config(name='0core_last_out_Cell_Phones_and_Accessories'),
215
- BenchmarkAmazonReview2023Config(name='0core_last_out_Industrial_and_Scientific'),
216
- BenchmarkAmazonReview2023Config(name='0core_last_out_Gift_Cards'),
217
- BenchmarkAmazonReview2023Config(name='0core_last_out_Musical_Instruments'),
218
- BenchmarkAmazonReview2023Config(name='0core_last_out_Electronics'),
219
- BenchmarkAmazonReview2023Config(name='0core_last_out_Handmade_Products'),
220
- BenchmarkAmazonReview2023Config(name='0core_last_out_Arts_Crafts_and_Sewing'),
221
- BenchmarkAmazonReview2023Config(name='0core_last_out_Baby_Products'),
222
- BenchmarkAmazonReview2023Config(name='0core_last_out_Health_and_Household'),
223
- BenchmarkAmazonReview2023Config(name='0core_last_out_Office_Products'),
224
- BenchmarkAmazonReview2023Config(name='0core_last_out_Digital_Music'),
225
- BenchmarkAmazonReview2023Config(name='0core_last_out_Grocery_and_Gourmet_Food'),
226
- BenchmarkAmazonReview2023Config(name='0core_last_out_Sports_and_Outdoors'),
227
- BenchmarkAmazonReview2023Config(name='0core_last_out_Home_and_Kitchen'),
228
- BenchmarkAmazonReview2023Config(name='0core_last_out_Subscription_Boxes'),
229
- BenchmarkAmazonReview2023Config(name='0core_last_out_Tools_and_Home_Improvement'),
230
- BenchmarkAmazonReview2023Config(name='0core_last_out_Pet_Supplies'),
231
- BenchmarkAmazonReview2023Config(name='0core_last_out_Video_Games'),
232
- BenchmarkAmazonReview2023Config(name='0core_last_out_Kindle_Store'),
233
- BenchmarkAmazonReview2023Config(name='0core_last_out_Clothing_Shoes_and_Jewelry'),
234
- BenchmarkAmazonReview2023Config(name='0core_last_out_Patio_Lawn_and_Garden'),
235
- BenchmarkAmazonReview2023Config(name='0core_last_out_Unknown'),
236
- BenchmarkAmazonReview2023Config(name='0core_last_out_Books'),
237
- BenchmarkAmazonReview2023Config(name='0core_last_out_Automotive'),
238
- BenchmarkAmazonReview2023Config(name='0core_last_out_CDs_and_Vinyl'),
239
- BenchmarkAmazonReview2023Config(name='0core_last_out_Beauty_and_Personal_Care'),
240
- BenchmarkAmazonReview2023Config(name='0core_last_out_Amazon_Fashion'),
241
- BenchmarkAmazonReview2023Config(name='0core_last_out_Magazine_Subscriptions'),
242
- BenchmarkAmazonReview2023Config(name='0core_last_out_Software'),
243
- BenchmarkAmazonReview2023Config(name='0core_last_out_Health_and_Personal_Care'),
244
- BenchmarkAmazonReview2023Config(name='0core_last_out_Appliances'),
245
- BenchmarkAmazonReview2023Config(name='0core_last_out_Movies_and_TV'),
246
- # Benchmark - last_out - 5core
247
- BenchmarkAmazonReview2023Config(name='5core_last_out_All_Beauty'),
248
- BenchmarkAmazonReview2023Config(name='5core_last_out_Toys_and_Games'),
249
- BenchmarkAmazonReview2023Config(name='5core_last_out_Cell_Phones_and_Accessories'),
250
- BenchmarkAmazonReview2023Config(name='5core_last_out_Industrial_and_Scientific'),
251
- BenchmarkAmazonReview2023Config(name='5core_last_out_Gift_Cards'),
252
- BenchmarkAmazonReview2023Config(name='5core_last_out_Musical_Instruments'),
253
- BenchmarkAmazonReview2023Config(name='5core_last_out_Electronics'),
254
- BenchmarkAmazonReview2023Config(name='5core_last_out_Arts_Crafts_and_Sewing'),
255
- BenchmarkAmazonReview2023Config(name='5core_last_out_Baby_Products'),
256
- BenchmarkAmazonReview2023Config(name='5core_last_out_Health_and_Household'),
257
- BenchmarkAmazonReview2023Config(name='5core_last_out_Office_Products'),
258
- BenchmarkAmazonReview2023Config(name='5core_last_out_Grocery_and_Gourmet_Food'),
259
- BenchmarkAmazonReview2023Config(name='5core_last_out_Sports_and_Outdoors'),
260
- BenchmarkAmazonReview2023Config(name='5core_last_out_Home_and_Kitchen'),
261
- BenchmarkAmazonReview2023Config(name='5core_last_out_Tools_and_Home_Improvement'),
262
- BenchmarkAmazonReview2023Config(name='5core_last_out_Pet_Supplies'),
263
- BenchmarkAmazonReview2023Config(name='5core_last_out_Video_Games'),
264
- BenchmarkAmazonReview2023Config(name='5core_last_out_Kindle_Store'),
265
- BenchmarkAmazonReview2023Config(name='5core_last_out_Clothing_Shoes_and_Jewelry'),
266
- BenchmarkAmazonReview2023Config(name='5core_last_out_Patio_Lawn_and_Garden'),
267
- BenchmarkAmazonReview2023Config(name='5core_last_out_Unknown'),
268
- BenchmarkAmazonReview2023Config(name='5core_last_out_Books'),
269
- BenchmarkAmazonReview2023Config(name='5core_last_out_Automotive'),
270
- BenchmarkAmazonReview2023Config(name='5core_last_out_CDs_and_Vinyl'),
271
- BenchmarkAmazonReview2023Config(name='5core_last_out_Beauty_and_Personal_Care'),
272
- BenchmarkAmazonReview2023Config(name='5core_last_out_Magazine_Subscriptions'),
273
- BenchmarkAmazonReview2023Config(name='5core_last_out_Software'),
274
- BenchmarkAmazonReview2023Config(name='5core_last_out_Movies_and_TV'),
275
- # Benchmark - last_out_w_his - 0core
276
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_All_Beauty'),
277
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Toys_and_Games'),
278
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Cell_Phones_and_Accessories'),
279
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Industrial_and_Scientific'),
280
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Gift_Cards'),
281
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Musical_Instruments'),
282
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Electronics'),
283
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Handmade_Products'),
284
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Arts_Crafts_and_Sewing'),
285
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Baby_Products'),
286
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Health_and_Household'),
287
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Office_Products'),
288
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Digital_Music'),
289
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Grocery_and_Gourmet_Food'),
290
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Sports_and_Outdoors'),
291
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Home_and_Kitchen'),
292
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Subscription_Boxes'),
293
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Tools_and_Home_Improvement'),
294
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Pet_Supplies'),
295
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Video_Games'),
296
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Kindle_Store'),
297
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Clothing_Shoes_and_Jewelry'),
298
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Patio_Lawn_and_Garden'),
299
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Unknown'),
300
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Books'),
301
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Automotive'),
302
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_CDs_and_Vinyl'),
303
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Beauty_and_Personal_Care'),
304
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Amazon_Fashion'),
305
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Magazine_Subscriptions'),
306
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Software'),
307
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Health_and_Personal_Care'),
308
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Appliances'),
309
- BenchmarkAmazonReview2023Config(name='0core_last_out_w_his_Movies_and_TV'),
310
- # Benchmark - last_out_w_his - 5core
311
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_All_Beauty'),
312
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Toys_and_Games'),
313
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Cell_Phones_and_Accessories'),
314
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Industrial_and_Scientific'),
315
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Gift_Cards'),
316
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Musical_Instruments'),
317
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Electronics'),
318
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Arts_Crafts_and_Sewing'),
319
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Baby_Products'),
320
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Health_and_Household'),
321
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Office_Products'),
322
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Grocery_and_Gourmet_Food'),
323
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Sports_and_Outdoors'),
324
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Home_and_Kitchen'),
325
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Tools_and_Home_Improvement'),
326
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Pet_Supplies'),
327
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Video_Games'),
328
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Kindle_Store'),
329
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Clothing_Shoes_and_Jewelry'),
330
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Patio_Lawn_and_Garden'),
331
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Unknown'),
332
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Books'),
333
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Automotive'),
334
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_CDs_and_Vinyl'),
335
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Beauty_and_Personal_Care'),
336
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Magazine_Subscriptions'),
337
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Software'),
338
- BenchmarkAmazonReview2023Config(name='5core_last_out_w_his_Movies_and_TV'),
339
- # Benchmark - timestamp - 0core
340
- BenchmarkAmazonReview2023Config(name='0core_timestamp_All_Beauty'),
341
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Toys_and_Games'),
342
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Cell_Phones_and_Accessories'),
343
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Industrial_and_Scientific'),
344
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Gift_Cards'),
345
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Musical_Instruments'),
346
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Electronics'),
347
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Handmade_Products'),
348
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Arts_Crafts_and_Sewing'),
349
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Baby_Products'),
350
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Health_and_Household'),
351
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Office_Products'),
352
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Digital_Music'),
353
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Grocery_and_Gourmet_Food'),
354
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Sports_and_Outdoors'),
355
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Home_and_Kitchen'),
356
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Subscription_Boxes'),
357
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Tools_and_Home_Improvement'),
358
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Pet_Supplies'),
359
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Video_Games'),
360
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Kindle_Store'),
361
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Clothing_Shoes_and_Jewelry'),
362
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Patio_Lawn_and_Garden'),
363
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Unknown'),
364
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Books'),
365
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Automotive'),
366
- BenchmarkAmazonReview2023Config(name='0core_timestamp_CDs_and_Vinyl'),
367
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Beauty_and_Personal_Care'),
368
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Amazon_Fashion'),
369
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Magazine_Subscriptions'),
370
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Software'),
371
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Health_and_Personal_Care'),
372
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Appliances'),
373
- BenchmarkAmazonReview2023Config(name='0core_timestamp_Movies_and_TV'),
374
- # Benchmark - timestamp - 5core
375
- BenchmarkAmazonReview2023Config(name='5core_timestamp_All_Beauty'),
376
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Toys_and_Games'),
377
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Cell_Phones_and_Accessories'),
378
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Industrial_and_Scientific'),
379
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Gift_Cards'),
380
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Musical_Instruments'),
381
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Electronics'),
382
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Arts_Crafts_and_Sewing'),
383
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Baby_Products'),
384
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Health_and_Household'),
385
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Office_Products'),
386
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Grocery_and_Gourmet_Food'),
387
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Sports_and_Outdoors'),
388
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Home_and_Kitchen'),
389
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Tools_and_Home_Improvement'),
390
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Pet_Supplies'),
391
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Video_Games'),
392
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Kindle_Store'),
393
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Clothing_Shoes_and_Jewelry'),
394
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Patio_Lawn_and_Garden'),
395
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Unknown'),
396
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Books'),
397
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Automotive'),
398
- BenchmarkAmazonReview2023Config(name='5core_timestamp_CDs_and_Vinyl'),
399
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Beauty_and_Personal_Care'),
400
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Magazine_Subscriptions'),
401
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Software'),
402
- BenchmarkAmazonReview2023Config(name='5core_timestamp_Movies_and_TV'),
403
- # Benchmark - timestamp_w_his - 0core
404
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_All_Beauty'),
405
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Toys_and_Games'),
406
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Cell_Phones_and_Accessories'),
407
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Industrial_and_Scientific'),
408
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Gift_Cards'),
409
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Musical_Instruments'),
410
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Electronics'),
411
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Handmade_Products'),
412
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Arts_Crafts_and_Sewing'),
413
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Baby_Products'),
414
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Health_and_Household'),
415
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Office_Products'),
416
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Digital_Music'),
417
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Grocery_and_Gourmet_Food'),
418
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Sports_and_Outdoors'),
419
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Home_and_Kitchen'),
420
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Subscription_Boxes'),
421
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Tools_and_Home_Improvement'),
422
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Pet_Supplies'),
423
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Video_Games'),
424
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Kindle_Store'),
425
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Clothing_Shoes_and_Jewelry'),
426
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Patio_Lawn_and_Garden'),
427
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Unknown'),
428
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Books'),
429
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Automotive'),
430
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_CDs_and_Vinyl'),
431
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Beauty_and_Personal_Care'),
432
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Amazon_Fashion'),
433
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Magazine_Subscriptions'),
434
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Software'),
435
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Health_and_Personal_Care'),
436
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Appliances'),
437
- BenchmarkAmazonReview2023Config(name='0core_timestamp_w_his_Movies_and_TV'),
438
- # Benchmark - timestamp_w_his - 5core
439
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_All_Beauty'),
440
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Toys_and_Games'),
441
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Cell_Phones_and_Accessories'),
442
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Industrial_and_Scientific'),
443
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Gift_Cards'),
444
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Musical_Instruments'),
445
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Electronics'),
446
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Arts_Crafts_and_Sewing'),
447
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Baby_Products'),
448
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Health_and_Household'),
449
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Office_Products'),
450
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Grocery_and_Gourmet_Food'),
451
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Sports_and_Outdoors'),
452
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Home_and_Kitchen'),
453
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Tools_and_Home_Improvement'),
454
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Pet_Supplies'),
455
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Video_Games'),
456
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Kindle_Store'),
457
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Clothing_Shoes_and_Jewelry'),
458
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Patio_Lawn_and_Garden'),
459
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Unknown'),
460
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Books'),
461
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Automotive'),
462
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_CDs_and_Vinyl'),
463
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Beauty_and_Personal_Care'),
464
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Magazine_Subscriptions'),
465
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Software'),
466
- BenchmarkAmazonReview2023Config(name='5core_timestamp_w_his_Movies_and_TV'),
467
- ]
468
-
469
- def _info(self):
470
- features = None
471
- if isinstance(self.config, RawMetaAmazonReview2023Config):
472
- features = datasets.Features({
473
- 'main_category': datasets.Value('string'),
474
- 'title': datasets.Value('string'),
475
- 'average_rating': datasets.Value(dtype='float64'),
476
- 'rating_number': datasets.Value(dtype='int64'),
477
- 'features': datasets.Sequence(datasets.Value('string')),
478
- 'description': datasets.Sequence(datasets.Value('string')),
479
- 'price': datasets.Value('string'),
480
- 'images': datasets.Sequence({
481
- 'hi_res': datasets.Value('string'),
482
- 'large': datasets.Value('string'),
483
- 'thumb': datasets.Value('string'),
484
- 'variant': datasets.Value('string')
485
- }),
486
- 'videos': datasets.Sequence({
487
- 'title': datasets.Value('string'),
488
- 'url': datasets.Value('string'),
489
- 'user_id': datasets.Value('string')
490
- }),
491
- 'store': datasets.Value('string'),
492
- 'categories': datasets.Sequence(datasets.Value('string')),
493
- 'details': datasets.Value('string'),
494
- 'parent_asin': datasets.Value('string'),
495
- 'bought_together': datasets.Value('string'), # TODO: Check this type
496
- 'subtitle': datasets.Value('string'),
497
- 'author': datasets.Value('string')
498
- })
499
- elif isinstance(self.config, RawReviewAmazonReview2023Config):
500
- # TODO: Check review features
501
- pass
502
-
503
- return datasets.DatasetInfo(
504
- description=_AMAZON_REVIEW_2023_DESCRIPTION + self.config.description,
505
- features=features
506
- )
507
-
508
- def _split_generators(self, dl_manager):
509
- dl_dir = dl_manager.download_and_extract(self.config.data_dir)
510
- if isinstance(self.config, BenchmarkAmazonReview2023Config):
511
- return [
512
- datasets.SplitGenerator(name='train', gen_kwargs={"filepath": dl_dir['train']}),
513
- datasets.SplitGenerator(name='valid', gen_kwargs={"filepath": dl_dir['valid']}),
514
- datasets.SplitGenerator(name='test', gen_kwargs={"filepath": dl_dir['test']}),
515
- ]
516
- else:
517
- return [
518
- datasets.SplitGenerator(name='full', gen_kwargs={"filepath": dl_dir})
519
- ]
520
-
521
- def _generate_examples(self, filepath):
522
- with open(filepath, 'r', encoding='utf-8') as file:
523
- if self.config.suffix == 'csv':
524
- colnames = file.readline().strip().split(',')
525
- for idx, line in enumerate(file):
526
- if self.config.suffix == 'jsonl':
527
- try:
528
- dp = json.loads(line)
529
- """
530
- For item metadata, 'details' is free-form structured data
531
- Here we dump it to string to make huggingface datasets easy
532
- to store.
533
- """
534
- if isinstance(self.config, RawMetaAmazonReview2023Config):
535
- if 'details' in dp:
536
- dp['details'] = json.dumps(dp['details'])
537
- if 'price' in dp:
538
- dp['price'] = str(dp['price'])
539
- for optional_key in ['subtitle', 'author']:
540
- if optional_key not in dp:
541
- dp[optional_key] = None
542
- for i in range(len(dp['images'])):
543
- for k in ['hi_res', 'large', 'thumb', 'variant']:
544
- if k not in dp['images'][i]:
545
- dp['images'][i][k] = None
546
- for i in range(len(dp['videos'])):
547
- for k in ['title', 'url', 'user_id']:
548
- if k not in dp['videos'][i]:
549
- dp['videos'][i][k] = None
550
- except:
551
- continue
552
- elif self.config.suffix == 'csv':
553
- line = line.strip().split(',')
554
- dp = {k: v for k, v in zip(colnames, line)}
555
- else:
556
- raise ValueError(f'Unknown suffix {self.config.suffix}.')
557
- yield idx, dp