lrana commited on
Commit
dfc2c9f
·
verified ·
1 Parent(s): 80a5180

Update msvamp_it.py

Browse files
Files changed (1) hide show
  1. msvamp_it.py +23 -17
msvamp_it.py CHANGED
@@ -1,9 +1,6 @@
1
  import csv
2
  import datasets
3
 
4
-
5
-
6
-
7
  _DESCRIPTION = """\
8
  Multilingual Simple Variations on Arithmetic Math word Problems (MSVAMP).
9
 
@@ -16,10 +13,19 @@ _HOMEPAGE = "https://github.com/lranaldii/italian_arithmetic_reasoning"
16
 
17
  _LICENSE = "CC BY SA 4.0"
18
 
19
- _BASE_URL = "msvamp_{lang}.csv"
 
20
 
21
- _LANG = ["it","en"]
22
 
 
 
 
 
 
 
 
 
23
 
24
  class MSVAMP(datasets.GeneratorBasedBuilder):
25
  """MSVAMP"""
@@ -27,7 +33,7 @@ class MSVAMP(datasets.GeneratorBasedBuilder):
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
@@ -66,14 +72,14 @@ class MSVAMP(datasets.GeneratorBasedBuilder):
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": row[1]
79
- }
 
1
  import csv
2
  import datasets
3
 
 
 
 
4
  _DESCRIPTION = """\
5
  Multilingual Simple Variations on Arithmetic Math word Problems (MSVAMP).
6
 
 
13
 
14
  _LICENSE = "CC BY SA 4.0"
15
 
16
+ # Update with actual URLs of the raw CSV files
17
+ _BASE_URL = "https://raw.githubusercontent.com/lranaldii/italian_arithmetic_reasoning/main/msvamp_{lang}.csv"
18
 
19
+ _LANG = ["it", "en"]
20
 
21
+ _CITATION = """\
22
+ @article{author2023msvamp,
23
+ title={MSVAMP: Multilingual Simple Variations on Arithmetic Math word Problems},
24
+ author={Author, A.},
25
+ journal={arXiv preprint arXiv:2310.20246},
26
+ year={2023}
27
+ }
28
+ """
29
 
30
  class MSVAMP(datasets.GeneratorBasedBuilder):
31
  """MSVAMP"""
 
33
  BUILDER_CONFIGS = [
34
  datasets.BuilderConfig(
35
  name=lang,
36
+ description=f"MSVAMP {lang} set",
37
  version=datasets.Version("1.0.0"),
38
  )
39
  for lang in _LANG
 
72
  ]
73
 
74
  def _generate_examples(self, filepath):
75
+ with open(filepath, encoding="utf-8") as csv_file:
76
+ csv_reader = csv.reader(
77
+ csv_file,
78
+ quotechar='"',
79
+ delimiter=",", # Change to comma if files are comma-separated
80
+ )
81
+ for key, row in enumerate(csv_reader):
82
+ yield key, {
83
+ "question": row[0],
84
+ "answer_number": int(row[1]), # Ensure conversion to int
85
+ }