lrana commited on
Commit
be2464b
·
verified ·
1 Parent(s): 00d7849

Rename dataset.yaml to msvamp_it.py

Browse files
Files changed (2) hide show
  1. dataset.yaml +0 -8
  2. msvamp_it.py +79 -0
dataset.yaml DELETED
@@ -1,8 +0,0 @@
1
- - name: msvamp_en
2
- type: csv
3
- args:
4
- path: msvamp_en.csv
5
- - name: msvamp_it
6
- type: csv
7
- args:
8
- path: msvamp_it.csv
 
 
 
 
 
 
 
 
 
msvamp_it.py ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import csv
2
+ import datasets
3
+
4
+
5
+
6
+
7
+ _DESCRIPTION = """\
8
+ Multilingual Simple Variations on Arithmetic Math word Problems (MSVAMP).
9
+
10
+ The same 1000 problems from [MSVAMP](https://arxiv.org/pdf/2310.20246) are each translated via human annotators in Italian.
11
+
12
+ You can find the input and targets in Italian and English as `.csv` files.
13
+ """
14
+
15
+ _HOMEPAGE = "https://github.com/lranaldii/italian_arithmetic_reasoning"
16
+
17
+ _LICENSE = "CC BY SA 4.0"
18
+
19
+ _BASE_URL = "msvamp_{lang}.tsv"
20
+
21
+ _LANG = ["it","en"]
22
+
23
+
24
+ class MSVAMP(datasets.GeneratorBasedBuilder):
25
+ """MSVAMP"""
26
+
27
+ BUILDER_CONFIGS = [
28
+ datasets.BuilderConfig(
29
+ name=lang,
30
+ description="MSVAMP {lang} set",
31
+ version=datasets.Version("1.0.0"),
32
+ )
33
+ for lang in _LANG
34
+ ]
35
+
36
+ def _info(self):
37
+ features = datasets.Features(
38
+ {
39
+ "question": datasets.Value("string"),
40
+ "answer_number": datasets.Value("int32"),
41
+ }
42
+ )
43
+ return datasets.DatasetInfo(
44
+ description=_DESCRIPTION,
45
+ features=features,
46
+ homepage=_HOMEPAGE,
47
+ license=_LICENSE,
48
+ citation=_CITATION,
49
+ )
50
+
51
+ def _split_generators(self, dl_manager):
52
+ name = self.config.name
53
+
54
+ filepaths = dl_manager.download_and_extract(
55
+ {
56
+ datasets.Split.TEST: _BASE_URL.format(lang=name),
57
+ }
58
+ )
59
+
60
+ return [
61
+ datasets.SplitGenerator(
62
+ name=split,
63
+ gen_kwargs={"filepath": path},
64
+ )
65
+ for split, path in filepaths.items()
66
+ ]
67
+
68
+ def _generate_examples(self, filepath):
69
+ with open(filepath, encoding="utf-8") as csv_file:
70
+ csv_reader = csv.reader(
71
+ csv_file,
72
+ quotechar='"',
73
+ delimiter="\t",
74
+ )
75
+ for key, row in enumerate(csv_reader):
76
+ yield key, {
77
+ "question": row[0],
78
+ "answer_number": int(row[1].replace(",", "")),
79
+ }