tomersagi commited on
Commit
2173d81
·
1 Parent(s): 06f5f78

Made DATA_URL a member

Browse files
Files changed (1) hide show
  1. sefaria.py +12 -10
sefaria.py CHANGED
@@ -28,7 +28,7 @@ _HOMEPAGE = "https://github.com/Sefaria/Sefaria-Export"
28
  _LICENSE = "Each text is licensed separately, so there is no overall license for this repository."
29
 
30
  class Sefaria(datasets.GeneratorBasedBuilder):
31
- VERSION = datasets.Version("1.0.3")
32
 
33
  BUILDER_CONFIGS = [
34
  datasets.BuilderConfig(name="english", version=VERSION, description="This configuration contains only English texts"),
@@ -38,6 +38,12 @@ class Sefaria(datasets.GeneratorBasedBuilder):
38
 
39
  DEFAULT_CONFIG_NAME = "all"
40
 
 
 
 
 
 
 
41
  def _info(self):
42
  features = datasets.Features(
43
  {
@@ -52,21 +58,17 @@ class Sefaria(datasets.GeneratorBasedBuilder):
52
  license=_LICENSE,
53
  citation=_CITATION,
54
  )
55
- data_urls = {
56
- "english": "https://huggingface.co/datasets/mehdie/sefaria/raw/main/data/*_english.parquet",
57
- "hebrew": "https://huggingface.co/datasets/mehdie/sefaria/raw/main/data/*_hebrew.parquet",
58
- "all": "https://huggingface.co/datasets/mehdie/sefaria/raw/main/data/*.parquet"
59
- }
60
 
61
  def _split_generators(self, dl_manager):
62
  # Download and extract the dataset files
63
  if self.config.name in ["english", "hebrew"]:
64
- data_dir = dl_manager.download_and_extract(data_urls[self.config.name])
 
65
  else:
66
- data_dir = dl_manager.download_and_extract(data_urls["all"])
 
67
 
68
- # Find the files in the extracted directory
69
- filepaths = glob.glob(os.path.join(data_dir, "*.parquet"))
70
 
71
  print(f"Filepaths found: {filepaths}") # Add this line to print the filepaths
72
 
 
28
  _LICENSE = "Each text is licensed separately, so there is no overall license for this repository."
29
 
30
  class Sefaria(datasets.GeneratorBasedBuilder):
31
+ VERSION = datasets.Version("1.0.4")
32
 
33
  BUILDER_CONFIGS = [
34
  datasets.BuilderConfig(name="english", version=VERSION, description="This configuration contains only English texts"),
 
38
 
39
  DEFAULT_CONFIG_NAME = "all"
40
 
41
+ DATA_URLS = {
42
+ "english": "https://huggingface.co/datasets/mehdie/sefaria/raw/main/data/*_english.parquet",
43
+ "hebrew": "https://huggingface.co/datasets/mehdie/sefaria/raw/main/data/*_hebrew.parquet",
44
+ "all": "https://huggingface.co/datasets/mehdie/sefaria/raw/main/data/*.parquet"
45
+ }
46
+
47
  def _info(self):
48
  features = datasets.Features(
49
  {
 
58
  license=_LICENSE,
59
  citation=_CITATION,
60
  )
 
 
 
 
 
61
 
62
  def _split_generators(self, dl_manager):
63
  # Download and extract the dataset files
64
  if self.config.name in ["english", "hebrew"]:
65
+ data_dir = dl_manager.download_and_extract(DATA_URLS[self.config.name])
66
+ filepaths = glob.glob(os.path.join(data_dir, "*" + self.config.name + ".parquet"))
67
  else:
68
+ data_dir = dl_manager.download_and_extract(DATA_URLS["all"])
69
+ filepaths = glob.glob(os.path.join(data_dir, "*.parquet"))
70
 
71
+
 
72
 
73
  print(f"Filepaths found: {filepaths}") # Add this line to print the filepaths
74