yuansui commited on
Commit
a54064d
·
1 Parent(s): 2030b8f

Update GitTables.py

Browse files
Files changed (1) hide show
  1. GitTables.py +4 -9
GitTables.py CHANGED
@@ -25,7 +25,7 @@ _LICENSE = ""
25
 
26
  # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
27
  # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
28
- _URL = "https://huggingface.co/datasets/yuansui/GitTables/blob/main/"
29
  _URLS = {
30
  "dbpedia": {
31
  "train": _URL + "dbpedia" + "_train.jsonl",
@@ -152,14 +152,9 @@ class GitTables(datasets.GeneratorBasedBuilder):
152
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
153
  def _generate_examples(self, filepath, split):
154
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
155
- with open(filepath, encoding="utf-8") as f:
156
- _list = [i for i in f.read().split("\n") if len(i) > 0]
157
- print(_list)
158
- for key, i in enumerate(_list):
159
- data = json.loads(i)
160
- #with jsonlines.open(filepath, mode="r") as reader:
161
- # for key, row in enumerate(reader):
162
- # data = json.loads(row)
163
  if self.config.name == "dbpedia":
164
  # Yields examples as (key, example) tuples
165
  yield key, {
 
25
 
26
  # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
27
  # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
28
+ _URL = "https://huggingface.co/datasets/yuansui/GitTables/resolve/main/"
29
  _URLS = {
30
  "dbpedia": {
31
  "train": _URL + "dbpedia" + "_train.jsonl",
 
152
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
153
  def _generate_examples(self, filepath, split):
154
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
155
+ with jsonlines.open(filepath, mode="r") as reader:
156
+ for key, row in enumerate(reader):
157
+ data = json.loads(row)
 
 
 
 
 
158
  if self.config.name == "dbpedia":
159
  # Yields examples as (key, example) tuples
160
  yield key, {