Fix bugs of optional keys
Browse files- Amazon-Review-2023.py +3 -0
Amazon-Review-2023.py
CHANGED
|
@@ -93,6 +93,9 @@ class AmazonReview2023(datasets.GeneratorBasedBuilder):
|
|
| 93 |
dp['details'] = json.dumps(dp['details'])
|
| 94 |
if 'price' in dp:
|
| 95 |
dp['price'] = str(dp['price'])
|
|
|
|
|
|
|
|
|
|
| 96 |
except:
|
| 97 |
continue
|
| 98 |
else:
|
|
|
|
| 93 |
dp['details'] = json.dumps(dp['details'])
|
| 94 |
if 'price' in dp:
|
| 95 |
dp['price'] = str(dp['price'])
|
| 96 |
+
for optional_key in ['subtitle', 'author']:
|
| 97 |
+
if optional_key not in dp:
|
| 98 |
+
dp[optional_key] = ''
|
| 99 |
except:
|
| 100 |
continue
|
| 101 |
else:
|