Initial Commit
Browse files
split-test.py → split-train.py
RENAMED
@@ -128,14 +128,13 @@ class SplitTest(datasets.GeneratorBasedBuilder):
|
|
128 |
|
129 |
data_dir = "https://huggingface.co/datasets/shivam/split-test/blob/main/text." + _LANGS[self.config.name]
|
130 |
archive_path = dl_manager.download_and_extract(data_dir)
|
131 |
-
|
132 |
-
print(archive_path)
|
133 |
return [
|
134 |
datasets.SplitGenerator(
|
135 |
name=datasets.Split.TRAIN,
|
136 |
# These kwargs will be passed to _generate_examples
|
137 |
gen_kwargs={
|
138 |
-
"filepath": archive_path,
|
139 |
"split": "train",
|
140 |
},
|
141 |
)
|
@@ -146,8 +145,7 @@ class SplitTest(datasets.GeneratorBasedBuilder):
|
|
146 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
147 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
148 |
|
149 |
-
|
150 |
-
with open(file_path, encoding="utf-8") as f:
|
151 |
for key, row in enumerate(f):
|
152 |
data = json.loads(row)
|
153 |
yield key, {
|
|
|
128 |
|
129 |
data_dir = "https://huggingface.co/datasets/shivam/split-test/blob/main/text." + _LANGS[self.config.name]
|
130 |
archive_path = dl_manager.download_and_extract(data_dir)
|
131 |
+
|
|
|
132 |
return [
|
133 |
datasets.SplitGenerator(
|
134 |
name=datasets.Split.TRAIN,
|
135 |
# These kwargs will be passed to _generate_examples
|
136 |
gen_kwargs={
|
137 |
+
"filepath": os.path.join(archive_path, "text." + _LANGS[self.config.name]),
|
138 |
"split": "train",
|
139 |
},
|
140 |
)
|
|
|
145 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
146 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
147 |
|
148 |
+
with open(filepath, encoding="utf-8") as f:
|
|
|
149 |
for key, row in enumerate(f):
|
150 |
data = json.loads(row)
|
151 |
yield key, {
|