KurtMica commited on
Commit
2839b87
1 Parent(s): 23053c8

Shuffled data script & metadata.

Browse files
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"shuffled": {"description": "General Corpora for the Maltese language.\n", "citation": "", "homepage": "https://mlrs.research.um.edu.mt/", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "korpus_malti", "config_name": "shuffled", "version": {"version_str": "4.0.0", "description": null, "major": 4, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2317766701, "num_examples": 17643958, "dataset_name": "korpus_malti"}, "validation": {"name": "validation", "num_bytes": 409158405, "num_examples": 3113712, "dataset_name": "korpus_malti"}, "test": {"name": "test", "num_bytes": 56490, "num_examples": 415, "dataset_name": "korpus_malti"}}, "download_checksums": {"data/shuffled/train.txt": {"num_bytes": 2247190869, "checksum": "0f2eccc5a2878883a6d291057029bd1fa10b731293dfddbe12a651990658671f"}, "data/shuffled/validation.txt": {"num_bytes": 396703557, "checksum": "7fb04796af7cd477c1ba95e5f45a5a6f2a49ea6045aea4c4025bc5caa231e596"}, "data/shuffled/test.txt": {"num_bytes": 54830, "checksum": "db9ba10ed74660c540d19319452d8c31ecb116ce72b59f5fb64ffad5c3c1d09a"}}, "download_size": 2643949256, "post_processing_size": null, "dataset_size": 2726981596, "size_in_bytes": 5370930852}}
dummy/shuffled/4.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2827781be2fbd0afcb58c6cb929684da8aadd778426881b4b9a11db56c2eb727
3
+ size 1719
korpus_malti.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ import datasets
4
+
5
+ _DESCRIPTION = """\
6
+ General Corpora for the Maltese language.
7
+ """
8
+
9
+ _HOMEPAGE = "https://mlrs.research.um.edu.mt/"
10
+
11
+ _URL = "data/"
12
+ _SHUFFLED_URL = {
13
+ "train": os.path.join(_URL, "shuffled/train.txt"),
14
+ "validation": os.path.join(_URL, "shuffled/validation.txt"),
15
+ "test": os.path.join(_URL, "shuffled/test.txt"),
16
+ }
17
+
18
+
19
+ class KorpusMalti(datasets.GeneratorBasedBuilder):
20
+ """Korpus Malti: General Corpora for the Maltese Language"""
21
+
22
+ VERSION = datasets.Version("4.0.0")
23
+
24
+ DEFAULT_CONFIG_NAME = "shuffled"
25
+
26
+ BUILDER_CONFIGS = [
27
+ datasets.BuilderConfig(name=DEFAULT_CONFIG_NAME,
28
+ version=VERSION,
29
+ description="The shuffled data from all subsets.",
30
+ ),
31
+ ]
32
+
33
+ def _info(self):
34
+ if self.config.name == self.DEFAULT_CONFIG_NAME:
35
+ features = {
36
+ "text": datasets.Value("string"),
37
+ }
38
+
39
+ return datasets.DatasetInfo(
40
+ description=_DESCRIPTION,
41
+ features=datasets.Features(features),
42
+ homepage=_HOMEPAGE,
43
+ )
44
+
45
+ def _split_generators(self, dl_manager):
46
+ if self.config.name == self.DEFAULT_CONFIG_NAME:
47
+ data_files = dl_manager.download_and_extract(_SHUFFLED_URL)
48
+ data_split = [
49
+ datasets.SplitGenerator(
50
+ name=datasets.Split.TRAIN,
51
+ gen_kwargs={
52
+ "filepath": data_files["train"],
53
+ },
54
+ ),
55
+ datasets.SplitGenerator(
56
+ name=datasets.Split.VALIDATION,
57
+ gen_kwargs={
58
+ "filepath": data_files["validation"],
59
+ },
60
+ ),
61
+ datasets.SplitGenerator(
62
+ name=datasets.Split.TEST,
63
+ gen_kwargs={
64
+ "filepath": data_files["test"],
65
+ },
66
+ ),
67
+ ]
68
+
69
+ return data_split
70
+
71
+ def _generate_examples(self, filepath):
72
+ if self.config.name == self.DEFAULT_CONFIG_NAME:
73
+ with open(filepath, encoding="utf-8") as file:
74
+ for key, line in enumerate(file):
75
+ if len(line) > 0:
76
+ yield key, {
77
+ "text": line,
78
+ }