Daniel Campos commited on
Commit
280fae1
·
1 Parent(s): c2c3c6f

Update ESCI-product-dataset-corpus-jp.py

Browse files
Files changed (1) hide show
  1. ESCI-product-dataset-corpus-jp.py +16 -2
ESCI-product-dataset-corpus-jp.py CHANGED
@@ -51,8 +51,8 @@ class ProductSearchCorpus(datasets.GeneratorBasedBuilder):
51
  {'docid': datasets.Value('string'), 'text': datasets.Value('string'),
52
  'title': datasets.Value('string'), 'bullet_points': datasets.Value('string'),
53
  'brand': datasets.Value('string'), 'color': datasets.Value('string'),
54
- 'locale': datasets.Value('string'), 'contents': datasets.value('string')
55
- },
56
  )
57
  return datasets.DatasetInfo(
58
  # This is the description that will appear on the datasets page.
@@ -85,4 +85,18 @@ class ProductSearchCorpus(datasets.GeneratorBasedBuilder):
85
  with open(filepath, encoding="utf-8") as f:
86
  for line in f:
87
  data = json.loads(line)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  yield data['docid'], data
 
51
  {'docid': datasets.Value('string'), 'text': datasets.Value('string'),
52
  'title': datasets.Value('string'), 'bullet_points': datasets.Value('string'),
53
  'brand': datasets.Value('string'), 'color': datasets.Value('string'),
54
+ 'locale': datasets.Value('string'), 'contents': datasets.Value('string')
55
+ }
56
  )
57
  return datasets.DatasetInfo(
58
  # This is the description that will appear on the datasets page.
 
85
  with open(filepath, encoding="utf-8") as f:
86
  for line in f:
87
  data = json.loads(line)
88
+ if data.get('locale') is None:
89
+ data['locale'] = "jp"
90
+ if data.get('title') is None:
91
+ data['title'] = ''
92
+ if data.get('text') is None:
93
+ data['text'] = ''
94
+ if data.get('brand') is None:
95
+ data['brand'] = ''
96
+ if data.get('color') is None:
97
+ data['color'] = ''
98
+ if data.get('contents') is None:
99
+ data['contents'] = ''
100
+ if data.get('bullet_points') is None:
101
+ data['bullet_points'] = ''
102
  yield data['docid'], data