Update sci_lay.py
Browse files- sci_lay.py +9 -16
sci_lay.py
CHANGED
|
@@ -140,24 +140,17 @@ class SciLay(datasets.GeneratorBasedBuilder):
|
|
| 140 |
|
| 141 |
def _generate_examples(self, paths=None):
|
| 142 |
"""Yields examples."""
|
| 143 |
-
unique_dois = set() # To keep track of unique DOIs
|
| 144 |
for paths_per_journal in paths:
|
| 145 |
for path in paths_per_journal:
|
| 146 |
with open(path, "rb") as fin:
|
| 147 |
for row in fin:
|
| 148 |
json_obj = json.loads(row)
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
_TOPICS: json_obj[_TOPICS],
|
| 159 |
-
_KEYWORDS: json_obj[_KEYWORDS]
|
| 160 |
-
}
|
| 161 |
-
yield doi, example
|
| 162 |
-
|
| 163 |
-
|
|
|
|
| 140 |
|
| 141 |
def _generate_examples(self, paths=None):
|
| 142 |
"""Yields examples."""
|
|
|
|
| 143 |
for paths_per_journal in paths:
|
| 144 |
for path in paths_per_journal:
|
| 145 |
with open(path, "rb") as fin:
|
| 146 |
for row in fin:
|
| 147 |
json_obj = json.loads(row)
|
| 148 |
+
yield {
|
| 149 |
+
_DOI: json_obj[_DOI],
|
| 150 |
+
_PMCID: json_obj[_PMCID],
|
| 151 |
+
_SUMMARY: json_obj[_SUMMARY],
|
| 152 |
+
_ABSTRACT: json_obj[_ABSTRACT],
|
| 153 |
+
_JOURNAL: json_obj[_JOURNAL],
|
| 154 |
+
_TOPICS: json_obj[_TOPICS],
|
| 155 |
+
_KEYWORDS: json_obj[_KEYWORDS]
|
| 156 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|