draj commited on
Commit
8208b20
1 Parent(s): 46a577d

Initial data commit

Browse files
Files changed (3) hide show
  1. MorisienMT.py +89 -0
  2. data/en-cr.zip +3 -0
  3. data/fr-cr.zip +3 -0
MorisienMT.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+
4
+ import datasets
5
+
6
+ _CITATION = """\
7
+ Not Yet
8
+ """
9
+
10
+ _DESCRIPTION = """\
11
+ This is the MorisienMT dataset for Muritian Creole Machine translation, English-Creole and French-Creole machine translation to be specific. See readme/datacard for details.
12
+ """
13
+ _HOMEPAGE = ""
14
+
15
+ _LICENSE = "Creative Commons Attribution-NonCommercial 4.0 International Public License"
16
+
17
+ _URL = "https://huggingface.co/datasets/prajdabre/MorisienMT/resolve/main/data/{}.zip"
18
+
19
+
20
+ _LANGUAGE_PAIRS = [
21
+ "en-cr",
22
+ "fr-cr",
23
+ ]
24
+
25
+
26
+ class MorisienMT(datasets.GeneratorBasedBuilder):
27
+ VERSION = datasets.Version("1.0.0")
28
+
29
+ BUILDER_CONFIGS = [
30
+ datasets.BuilderConfig(
31
+ name="{}".format(lang),
32
+ version=datasets.Version("1.0.0")
33
+ )
34
+ for lang in _LANGUAGE_PAIRS
35
+ ]
36
+
37
+ def _info(self):
38
+ return datasets.DatasetInfo(
39
+ description=_DESCRIPTION,
40
+ features=datasets.Features(
41
+ {
42
+ "input": datasets.Value("string"),
43
+ "target": datasets.Value("string"),
44
+ }
45
+ ),
46
+ supervised_keys=None,
47
+ homepage=_HOMEPAGE,
48
+ citation=_CITATION,
49
+ license=_LICENSE,
50
+ version=self.VERSION,
51
+ )
52
+
53
+ def _split_generators(self, dl_manager):
54
+ """Returns SplitGenerators."""
55
+ lang = str(self.config.name)
56
+ url = _URL.format(lang)
57
+
58
+ data_dir = dl_manager.download_and_extract(url)
59
+ return [
60
+ datasets.SplitGenerator(
61
+ name=datasets.Split.TRAIN,
62
+ gen_kwargs={
63
+ "filepath": os.path.join(data_dir, lang + "_train.jsonl"),
64
+ },
65
+ ),
66
+ datasets.SplitGenerator(
67
+ name=datasets.Split.TEST,
68
+ gen_kwargs={
69
+ "filepath": os.path.join(data_dir, lang + "_test.jsonl"),
70
+ },
71
+ ),
72
+ datasets.SplitGenerator(
73
+ name=datasets.Split.VALIDATION,
74
+ gen_kwargs={
75
+ "filepath": os.path.join(data_dir, lang + "_dev.jsonl"),
76
+ },
77
+ ),
78
+ ]
79
+
80
+ def _generate_examples(self, filepath):
81
+ """Yields examples as (key, example) tuples."""
82
+ with open(filepath, encoding="utf-8") as f:
83
+ for idx_, row in enumerate(f):
84
+ data = json.loads(row)
85
+ yield idx_, {
86
+ "input": data["input"],
87
+ "target": data["target"],
88
+
89
+ }
data/en-cr.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e336b367ad54079c1f236e564b2a36874db36c4f3292901e1a432f7dbe83adf
3
+ size 729468
data/fr-cr.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aa9dff668ca65ce5febd7f414e84e2f07d6dd8975e757d72a54e84c4dbdf875c
3
+ size 327680