dmahata commited on
Commit
b20f326
1 Parent(s): 317f555

Update inspec.py

Browse files
Files changed (1) hide show
  1. inspec.py +4 -29
inspec.py CHANGED
@@ -1,4 +1,4 @@
1
- import jsonlines
2
  import datasets
3
 
4
  # _SPLIT = ['train', 'test', 'valid']
@@ -120,34 +120,9 @@ class Inspec(datasets.GeneratorBasedBuilder):
120
 
121
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
122
  def _generate_examples(self, filepath, split):
123
- # with open(filepath, encoding="utf-8") as f:
124
- # for key, row in enumerate(f):
125
- # data = json.loads(row)
126
- # if self.config.name == "extraction":
127
- # # Yields examples as (key, example) tuples
128
- # yield key, {
129
- # "id": data['paper_id'],
130
- # "document": data["document"],
131
- # "doc_bio_tags": data.get("doc_bio_tags")
132
- # }
133
- # elif self.config.name == "generation":
134
- # yield key, {
135
- # "id": data['paper_id'],
136
- # "document": data["document"],
137
- # "extractive_keyphrases": data.get("extractive_keyphrases"),
138
- # "abstractive_keyphrases": data.get("abstractive_keyphrases")
139
- # }
140
- # else:
141
- # yield key, {
142
- # "id": data['paper_id'],
143
- # "document": data["document"],
144
- # "doc_bio_tags": data.get("doc_bio_tags"),
145
- # "extractive_keyphrases": data.get("extractive_keyphrases"),
146
- # "abstractive_keyphrases": data.get("abstractive_keyphrases"),
147
- # "other_metadata": data["other_metadata"]
148
- # }
149
- with jsonlines.open(filepath) as reader:
150
- for key, data in enumerate(reader):
151
  if self.config.name == "extraction":
152
  # Yields examples as (key, example) tuples
153
  yield key, {
 
1
+ import json
2
  import datasets
3
 
4
  # _SPLIT = ['train', 'test', 'valid']
 
120
 
121
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
122
  def _generate_examples(self, filepath, split):
123
+ with open(filepath, encoding="utf-8") as f:
124
+ for key, row in enumerate(f):
125
+ data = json.loads(row)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  if self.config.name == "extraction":
127
  # Yields examples as (key, example) tuples
128
  yield key, {