hyp1231 commited on
Commit
33090b3
1 Parent(s): 42126c7

Fix bugs of optional keys

Browse files
Files changed (1) hide show
  1. 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: