sebastiaan commited on
Commit
35ec16d
1 Parent(s): bd2e609

Create cefr.py

Browse files
Files changed (1) hide show
  1. cefr.py +89 -0
cefr.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import csv
2
+ import json
3
+ import os
4
+
5
+ import datasets
6
+
7
+ _CITATION = """\
8
+ @InProceedings{huggingface:dataset,
9
+ title = {A great new dataset},
10
+ author={huggingface, Inc.
11
+ },
12
+ year={2020}
13
+ }
14
+ """
15
+
16
+ # You can copy an official description
17
+ _DESCRIPTION = """\
18
+ This new dataset is designed to solve this great NLP task and is crafted with a lot of care.
19
+ """
20
+ _HOMEPAGE = ""
21
+ _LICENSE = ""
22
+
23
+
24
+ _URLS = {
25
+ "train": "train_split.csv",
26
+ "test": "test_split.csv",
27
+ "val": "val_split.csv",
28
+ }
29
+
30
+
31
+ class CefrDataset(datasets.GeneratorBasedBuilder):
32
+
33
+ VERSION = datasets.Version("1.1.0")
34
+
35
+ def _info(self):
36
+ features = datasets.Features(
37
+ {
38
+ "prompt": datasets.Value("string"),
39
+ "label": datasets.Value("string")
40
+ }
41
+ )
42
+
43
+ return datasets.DatasetInfo(
44
+ # This is the description that will appear on the datasets page.
45
+ description=_DESCRIPTION,
46
+ # This defines the different columns of the dataset and their types
47
+ features=features, # Here we define them above because they are different between the two configurations
48
+ # If there's a common (input, target) tuple from the features,
49
+ # specify them here. They'll be used if as_supervised=True in
50
+ # builder.as_dataset.
51
+ supervised_keys=None,
52
+ # Homepage of the dataset for documentation
53
+ homepage=_HOMEPAGE,
54
+ # License for the dataset if available
55
+ license=_LICENSE,
56
+ # Citation for the dataset
57
+ citation=_CITATION,
58
+ )
59
+
60
+ def _split_generators(self, dl_manager):
61
+ """Returns SplitGenerators."""
62
+
63
+
64
+ return [
65
+ datasets.SplitGenerator(
66
+ name=datasets.Split.TRAIN,
67
+ # These kwargs will be passed to _generate_examples
68
+ gen_kwargs={
69
+ "filepath": "train_split.csv",
70
+ "split": "train",
71
+ },
72
+ ),
73
+ datasets.SplitGenerator(
74
+ name=datasets.Split.TEST,
75
+ # These kwargs will be passed to _generate_examples
76
+ gen_kwargs={
77
+ "filepath": "test_split.csv",
78
+ "split": "test"
79
+ },
80
+ ),
81
+ datasets.SplitGenerator(
82
+ name=datasets.Split.VALIDATION,
83
+ # These kwargs will be passed to _generate_examples
84
+ gen_kwargs={
85
+ "filepath": "val_split.csv",
86
+ "split": "val",
87
+ },
88
+ ),
89
+ ]