elmadany commited on
Commit
4449839
·
1 Parent(s): c2fa0f7

Update dummy-text.py

Browse files
Files changed (1) hide show
  1. dummy-text.py +6 -10
dummy-text.py CHANGED
@@ -1,4 +1,3 @@
1
-
2
  # coding=utf-8
3
  # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
4
  #
@@ -67,15 +66,12 @@ class Openwebtext(datasets.GeneratorBasedBuilder):
67
  def _generate_examples(self, archive_iterators, iter_archive):
68
  """Yields examples."""
69
  for archive_iterator in archive_iterators:
70
- for xz_filepath, xz_f in archive_iterator:
71
- print(">>>>>", xz_filepath)
72
  # if not xz_filepath.endswith(".xz"):
73
  # continue
74
- for txt_filepath, txt_f in iter_archive(xz_f):
75
- print(">>>>>", txt_filepath)
76
- if not txt_filepath.endswith(".txt"):
77
- continue
78
- idx = f"{xz_filepath}/{txt_filepath}"
79
- print("id = ", id)
80
- yield idx, {"text": re.sub("\n\n\n+", "\n\n", txt_f.read().decode("utf-8")).strip()}
81
 
 
 
1
  # coding=utf-8
2
  # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
  #
 
66
  def _generate_examples(self, archive_iterators, iter_archive):
67
  """Yields examples."""
68
  for archive_iterator in archive_iterators:
69
+ for text_filepath, text_f in archive_iterator:
70
+ print(">>>>>", text_filepath)
71
  # if not xz_filepath.endswith(".xz"):
72
  # continue
73
+ idx = f"{text_filepath}"
74
+ print("id = ", id)
75
+ yield idx, {"text": re.sub("\n\n\n+", "\n\n", text_f.read().decode("utf-8")).strip()}
76
+
 
 
 
77