Upload dataset_loader with huggingface_hub
Browse files- dataset_loader +11 -10
dataset_loader
CHANGED
|
@@ -1,18 +1,19 @@
|
|
| 1 |
-
from datasets import DatasetInfo, GeneratorBasedBuilder, SplitGenerator, Split
|
| 2 |
|
| 3 |
-
class
|
| 4 |
def _info(self):
|
| 5 |
return DatasetInfo(
|
| 6 |
-
features=Features({
|
| 7 |
-
"romansh_text": Value("string"),
|
| 8 |
-
"german_text": Value("string"),
|
| 9 |
-
"similarity": Value("float32"),
|
| 10 |
-
"original_similarity": Value("float32"),
|
| 11 |
-
})
|
| 12 |
-
supervised_keys=None,
|
| 13 |
description="Best Matched Parallel Data",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
)
|
| 15 |
|
|
|
|
| 16 |
def _split_generators(self, dl_manager):
|
| 17 |
data_path = dl_manager.download_and_extract("parallel_data/matched_0.60_0.005.jsonl")
|
| 18 |
return [SplitGenerator(name=Split.TRAIN, gen_kwargs={"filepath": data_path})]
|
|
@@ -21,4 +22,4 @@ class RomanshGermanDataset(GeneratorBasedBuilder):
|
|
| 21 |
import json
|
| 22 |
with open(filepath, encoding="utf-8") as f:
|
| 23 |
for idx, line in enumerate(f):
|
| 24 |
-
yield idx, json.loads(line)
|
|
|
|
| 1 |
+
from datasets import DatasetInfo, GeneratorBasedBuilder, SplitGenerator, Split, Features, Value
|
| 2 |
|
| 3 |
+
class RomanshGerman(GeneratorBasedBuilder):
|
| 4 |
def _info(self):
|
| 5 |
return DatasetInfo(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
description="Best Matched Parallel Data",
|
| 7 |
+
features=Features({
|
| 8 |
+
"romansh_text": Value("string"),
|
| 9 |
+
"german_text": Value("string"),
|
| 10 |
+
"similarity": Value("float32"),
|
| 11 |
+
"original_similarity": Value("float32"),
|
| 12 |
+
}),
|
| 13 |
+
supervised_keys=None,
|
| 14 |
)
|
| 15 |
|
| 16 |
+
|
| 17 |
def _split_generators(self, dl_manager):
|
| 18 |
data_path = dl_manager.download_and_extract("parallel_data/matched_0.60_0.005.jsonl")
|
| 19 |
return [SplitGenerator(name=Split.TRAIN, gen_kwargs={"filepath": data_path})]
|
|
|
|
| 22 |
import json
|
| 23 |
with open(filepath, encoding="utf-8") as f:
|
| 24 |
for idx, line in enumerate(f):
|
| 25 |
+
yield idx, json.loads(line)
|