albertvillanova HF staff commited on
Commit
a64a471
1 Parent(s): 44f6f93

Support streaming (#2)

Browse files

- Update script to use data path (c6bb9b74a5060cb24dabe5b433ea0da00cedb661)

Files changed (1) hide show
  1. caner.py +4 -8
caner.py CHANGED
@@ -42,7 +42,7 @@ _HOMEPAGE = "https://github.com/RamziSalah/Classical-Arabic-Named-Entity-Recogni
42
  # TODO: Add the licence for the dataset here if you can find it
43
  _LICENSE = ""
44
 
45
- _URL = "https://github.com/RamziSalah/Classical-Arabic-Named-Entity-Recognition-Corpus/archive/master.zip"
46
 
47
 
48
  class Caner(datasets.GeneratorBasedBuilder):
@@ -95,23 +95,19 @@ class Caner(datasets.GeneratorBasedBuilder):
95
  def _split_generators(self, dl_manager):
96
  """Returns SplitGenerators."""
97
 
98
- my_urls = _URL
99
- data_dir = dl_manager.download_and_extract(my_urls)
100
 
101
  return [
102
  datasets.SplitGenerator(
103
  name=datasets.Split.TRAIN,
104
  # These kwargs will be passed to _generate_examples
105
  gen_kwargs={
106
- "filepath": os.path.join(
107
- data_dir, "Classical-Arabic-Named-Entity-Recognition-Corpus-master/CANERCorpus.csv"
108
- ),
109
- "split": "train",
110
  },
111
  )
112
  ]
113
 
114
- def _generate_examples(self, filepath, split):
115
  """Yields examples."""
116
 
117
  with open(filepath, encoding="utf-8") as csv_file:
42
  # TODO: Add the licence for the dataset here if you can find it
43
  _LICENSE = ""
44
 
45
+ _URL = "https://raw.githubusercontent.com/RamziSalah/Classical-Arabic-Named-Entity-Recognition-Corpus/master/CANERCorpus.csv"
46
 
47
 
48
  class Caner(datasets.GeneratorBasedBuilder):
95
  def _split_generators(self, dl_manager):
96
  """Returns SplitGenerators."""
97
 
98
+ data_path = dl_manager.download(_URL)
 
99
 
100
  return [
101
  datasets.SplitGenerator(
102
  name=datasets.Split.TRAIN,
103
  # These kwargs will be passed to _generate_examples
104
  gen_kwargs={
105
+ "filepath": data_path,
 
 
 
106
  },
107
  )
108
  ]
109
 
110
+ def _generate_examples(self, filepath):
111
  """Yields examples."""
112
 
113
  with open(filepath, encoding="utf-8") as csv_file: