data loading update
Browse files- README.md +49 -0
- mediomatix-raw.py +0 -84
README.md
CHANGED
|
@@ -2,6 +2,55 @@
|
|
| 2 |
license: cc-by-nc-sa-4.0
|
| 3 |
language:
|
| 4 |
- rm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
| 6 |
|
| 7 |
## General Information
|
|
|
|
| 2 |
license: cc-by-nc-sa-4.0
|
| 3 |
language:
|
| 4 |
- rm
|
| 5 |
+
configs:
|
| 6 |
+
- config_name: rm-surmiran
|
| 7 |
+
data_files:
|
| 8 |
+
- split: train
|
| 9 |
+
path: data/rm-surmiran/train.jsonl
|
| 10 |
+
- split: validation
|
| 11 |
+
path: data/rm-surmiran/validation.jsonl
|
| 12 |
+
- split: test
|
| 13 |
+
path: data/rm-surmiran/test.jsonl
|
| 14 |
+
- config_name: rm-sursilv
|
| 15 |
+
data_files:
|
| 16 |
+
- split: train
|
| 17 |
+
path: data/rm-sursilv/train.jsonl
|
| 18 |
+
- split: validation
|
| 19 |
+
path: data/rm-sursilv/validation.jsonl
|
| 20 |
+
- split: test
|
| 21 |
+
path: data/rm-sursilv/test.jsonl
|
| 22 |
+
- split: no_surmiran
|
| 23 |
+
path: data/rm-sursilv/no_surmiran.jsonl
|
| 24 |
+
- config_name: rm-puter
|
| 25 |
+
data_files:
|
| 26 |
+
- split: train
|
| 27 |
+
path: data/rm-puter/train.jsonl
|
| 28 |
+
- split: validation
|
| 29 |
+
path: data/rm-puter/validation.jsonl
|
| 30 |
+
- split: test
|
| 31 |
+
path: data/rm-puter/test.jsonl
|
| 32 |
+
- split: no_surmiran
|
| 33 |
+
path: data/rm-puter/no_surmiran.jsonl
|
| 34 |
+
- config_name: rm-sutsilv
|
| 35 |
+
data_files:
|
| 36 |
+
- split: train
|
| 37 |
+
path: data/rm-sutsilv/train.jsonl
|
| 38 |
+
- split: validation
|
| 39 |
+
path: data/rm-sutsilv/validation.jsonl
|
| 40 |
+
- split: test
|
| 41 |
+
path: data/rm-sutsilv/test.jsonl
|
| 42 |
+
- split: no_surmiran
|
| 43 |
+
path: data/rm-sutsilv/no_surmiran.jsonl
|
| 44 |
+
- config_name: rm-vallader
|
| 45 |
+
data_files:
|
| 46 |
+
- split: train
|
| 47 |
+
path: data/rm-vallader/train.jsonl
|
| 48 |
+
- split: validation
|
| 49 |
+
path: data/rm-vallader/validation.jsonl
|
| 50 |
+
- split: test
|
| 51 |
+
path: data/rm-vallader/test.jsonl
|
| 52 |
+
- split: no_surmiran
|
| 53 |
+
path: data/rm-vallader/no_surmiran.jsonl
|
| 54 |
---
|
| 55 |
|
| 56 |
## General Information
|
mediomatix-raw.py
DELETED
|
@@ -1,84 +0,0 @@
|
|
| 1 |
-
"""HF loading script for unaligned Mediomatix dataset"""
|
| 2 |
-
|
| 3 |
-
import os
|
| 4 |
-
import datasets
|
| 5 |
-
import json
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
class MediomatixRawConfig(datasets.BuilderConfig):
|
| 9 |
-
def __init__(self, data_dir="data", **kwargs):
|
| 10 |
-
super(MediomatixRawConfig, self).__init__(**kwargs)
|
| 11 |
-
self.data_dir = data_dir
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
class MediomatixRaw(datasets.GeneratorBasedBuilder):
|
| 15 |
-
BUILDER_CONFIG_CLASS = MediomatixRawConfig
|
| 16 |
-
BUILDER_CONFIGS = [
|
| 17 |
-
MediomatixRawConfig(
|
| 18 |
-
name="rm-sursilv", description="Sursilvan subset of Mediomatix"
|
| 19 |
-
),
|
| 20 |
-
MediomatixRawConfig(
|
| 21 |
-
name="rm-sutsilv", description="Sutsilvan subset of Mediomatix"
|
| 22 |
-
),
|
| 23 |
-
MediomatixRawConfig(
|
| 24 |
-
name="rm-surmiran", description="Surmiran subset of Mediomatix"
|
| 25 |
-
),
|
| 26 |
-
MediomatixRawConfig(name="rm-puter", description="Puter subset of Mediomatix"),
|
| 27 |
-
MediomatixRawConfig(
|
| 28 |
-
name="rm-vallader", description="Vallader subset of Mediomatix"
|
| 29 |
-
),
|
| 30 |
-
]
|
| 31 |
-
|
| 32 |
-
def _info(self):
|
| 33 |
-
return datasets.DatasetInfo(
|
| 34 |
-
description="Unaligned Mediomatix dataset",
|
| 35 |
-
features=datasets.Features(
|
| 36 |
-
{
|
| 37 |
-
"segmentID": datasets.Value("string"),
|
| 38 |
-
"text": datasets.Value("string"),
|
| 39 |
-
"html": datasets.Value("string"),
|
| 40 |
-
"chapter": datasets.Value("string"),
|
| 41 |
-
"book": datasets.Value("string"),
|
| 42 |
-
}
|
| 43 |
-
),
|
| 44 |
-
supervised_keys=None,
|
| 45 |
-
)
|
| 46 |
-
|
| 47 |
-
def _split_generators(self, dl_manager):
|
| 48 |
-
# Path to this subdataset’s folder
|
| 49 |
-
data_dir = os.path.join(self.config.data_dir, self.config.name)
|
| 50 |
-
|
| 51 |
-
splits = [
|
| 52 |
-
datasets.SplitGenerator(
|
| 53 |
-
name=datasets.Split.TRAIN,
|
| 54 |
-
gen_kwargs={"filepath": os.path.join(data_dir, "train.jsonl")},
|
| 55 |
-
),
|
| 56 |
-
datasets.SplitGenerator(
|
| 57 |
-
name=datasets.Split.VALIDATION,
|
| 58 |
-
gen_kwargs={"filepath": os.path.join(data_dir, "validation.jsonl")},
|
| 59 |
-
),
|
| 60 |
-
datasets.SplitGenerator(
|
| 61 |
-
name=datasets.Split.TEST,
|
| 62 |
-
gen_kwargs={"filepath": os.path.join(data_dir, "test.jsonl")},
|
| 63 |
-
),
|
| 64 |
-
]
|
| 65 |
-
|
| 66 |
-
# Only add 'no_surmiran' split if not rm-surmiran
|
| 67 |
-
if self.config.name != "rm-surmiran":
|
| 68 |
-
splits.append(
|
| 69 |
-
datasets.SplitGenerator(
|
| 70 |
-
name="no_surmiran",
|
| 71 |
-
gen_kwargs={
|
| 72 |
-
"filepath": os.path.join(data_dir, "no_surmiran.jsonl")
|
| 73 |
-
},
|
| 74 |
-
)
|
| 75 |
-
)
|
| 76 |
-
|
| 77 |
-
return splits
|
| 78 |
-
|
| 79 |
-
def _generate_examples(self, filepath):
|
| 80 |
-
"""Yields (key, example) tuples."""
|
| 81 |
-
with open(filepath, encoding="utf-8") as f:
|
| 82 |
-
for idx, line in enumerate(f):
|
| 83 |
-
data = json.loads(line)
|
| 84 |
-
yield idx, data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|