paniniDot commited on
Commit
dadae2a
1 Parent(s): 3ce8d64

Update sci_lay.py

Browse files
Files changed (1) hide show
  1. sci_lay.py +7 -6
sci_lay.py CHANGED
@@ -125,7 +125,7 @@ class SciLay(datasets.GeneratorBasedBuilder):
125
  dl_paths = dl_manager.download(urls)
126
  paths = {
127
  split: [
128
- os.path.join(dl_paths[split], split_name, code) for code in self.config.codes
129
  ]
130
  for split, split_name in _SPLIT_NAMES.items()
131
  }
@@ -139,16 +139,17 @@ class SciLay(datasets.GeneratorBasedBuilder):
139
 
140
  def _generate_examples(self, paths=None):
141
  """Yields examples."""
142
- for paths_per_code in paths:
143
- for path in paths_per_code:
144
- with open(path, "r", encoding="utf-8") as fin:
145
  for row in fin:
146
  json_obj = json.loads(row)
147
  yield json_obj["publication_number"], {
148
  _DOI: json_obj[_DOI],
 
149
  _SUMMARY: json_obj[_SUMMARY],
150
  _ABSTRACT: json_obj[_ABSTRACT],
151
  _JOURNAL: json_obj[_JOURNAL],
 
152
  _KEYWORDS: json_obj[_KEYWORDS]
153
- }
154
-
 
125
  dl_paths = dl_manager.download(urls)
126
  paths = {
127
  split: [
128
+ os.path.join(dl_paths[split], split_name, journal) for journal in self.config.journal
129
  ]
130
  for split, split_name in _SPLIT_NAMES.items()
131
  }
 
139
 
140
  def _generate_examples(self, paths=None):
141
  """Yields examples."""
142
+ for paths_per_journal in paths:
143
+ for path in paths_per_journal:
144
+ with open(path, "r", encoding="unicode") as fin:
145
  for row in fin:
146
  json_obj = json.loads(row)
147
  yield json_obj["publication_number"], {
148
  _DOI: json_obj[_DOI],
149
+ _PMCID: json_obj[_PMCID],
150
  _SUMMARY: json_obj[_SUMMARY],
151
  _ABSTRACT: json_obj[_ABSTRACT],
152
  _JOURNAL: json_obj[_JOURNAL],
153
+ _TOPICS: json_obj[_TOPICS],
154
  _KEYWORDS: json_obj[_KEYWORDS]
155
+ }