affahrizain commited on
Commit
dcb41cf
1 Parent(s): 1cd71f7

update working url file

Browse files
Files changed (1) hide show
  1. id-review-gen.py +7 -12
id-review-gen.py CHANGED
@@ -30,7 +30,7 @@ _HOMEPAGE = "https://github.com/jakartaresearch"
30
  # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
31
  # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
32
  _TRAIN_URL = (
33
- "https://huggingface.co/datasets/jakartaresearch/id-review-gen/raw/main/data.csv"
34
  )
35
 
36
 
@@ -60,14 +60,9 @@ class ReviewGen(datasets.GeneratorBasedBuilder):
60
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
61
  def _generate_examples(self, filepath):
62
  """Generate examples."""
63
- df = pd.read_csv(filepath, encoding="utf-8")
64
- for item in df.itertuples():
65
- print(item)
66
- yield item.Index, {"text": item.text, "label": item.label}
67
-
68
- # with open(filepath, encoding="utf-8") as csv_file:
69
- # csv_reader = csv.reader(csv_file, delimiter=",")
70
- # next(csv_reader)
71
- # for id_, row in enumerate(csv_reader):
72
- # text, label = row
73
- # yield id_, {"text": text, "label": label}
 
30
  # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
31
  # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
32
  _TRAIN_URL = (
33
+ "https://huggingface.co/datasets/jakartaresearch/id-review-gen/resolve/main/data.csv"
34
  )
35
 
36
 
 
60
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
61
  def _generate_examples(self, filepath):
62
  """Generate examples."""
63
+ with open(filepath, encoding="utf-8") as csv_file:
64
+ csv_reader = csv.reader(csv_file, delimiter=",")
65
+ next(csv_reader)
66
+ for id_, row in enumerate(csv_reader):
67
+ text, label = row
68
+ yield id_, {"text": text, "label": label}