koutch commited on
Commit
20d5397
·
1 Parent(s): f6d6467

Upload intro_prog.py

Browse files
Files changed (1) hide show
  1. intro_prog.py +51 -18
intro_prog.py CHANGED
@@ -30,10 +30,18 @@ This dataset contains 2442 correct and 1783 buggy program attempts by 361 underg
30
  an introduction to Python programming course at NUS (National University of Singapore).
31
  """
32
 
 
 
 
 
 
 
33
  _DUBLIN_HOMEPAGE = """https://figshare.com/articles/dataset/_5_Million_Python_Bash_Programming_Submissions_for_5_Courses_Grades_for_Computer-Based_Exams_over_3_academic_years_/12610958"""
34
 
35
  _SINGAPORE_HOMEPAGE = """https://github.com/githubhuyang/refactory"""
36
 
 
 
37
  _DUBLIN_CITATION = """
38
  @inproceedings{azcona2019user2code2vec,
39
  title={user2code2vec: Embeddings for Profiling Students Based on Distributional Representations of Source Code},
@@ -72,9 +80,27 @@ _SINGAPORE_CITATION = """
72
  }
73
  """
74
 
75
- _DESCRIPTION = """
76
- Intro Programming. A dataset of open student submissions to programming assignments.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
 
 
78
  """
79
 
80
  _DUBLIN_URLS = {
@@ -104,7 +130,7 @@ _SINGAPORE_URLS = {
104
  }
105
  }
106
 
107
- NEW_CALEDONIA_URLS = {
108
  "metadata": {
109
  "train": "./data/newcaledonia_metadata_train.jsonl",
110
  },
@@ -115,7 +141,8 @@ NEW_CALEDONIA_URLS = {
115
 
116
  _URLS = {
117
  "dublin": _DUBLIN_URLS,
118
- "singapore": _SINGAPORE_URLS
 
119
  }
120
 
121
  class IntroProgConfig(datasets.BuilderConfig):
@@ -145,31 +172,37 @@ class IntroProg(datasets.GeneratorBasedBuilder):
145
 
146
  configurations = list(product(tasks, sources))
147
  configurations.append((tasks[0], "newcaledonia"))
 
148
 
149
  BUILDER_CONFIGS = []
150
  for (task, description), source in configurations:
151
  BUILDER_CONFIGS.append(
152
  IntroProgConfig(
153
  name=f"{source}_{task}",
154
- # description=description, # TODO: map to correct description
155
  version=VERSION,
156
  )
157
  )
158
 
159
-
160
  def _info(self):
161
-
162
- # TODO: could be more conscise
163
 
164
- if self.config.name.split("_")[0] == "dublin":
 
 
165
  description = _DUBLIN_DESCRIPTION
166
  citation = _DUBLIN_CITATION
167
  homepage = _DUBLIN_HOMEPAGE
168
- elif self.config.name.split("_")[0] == "singapore":
169
  description =_SINGAPORE_DESCRIPTION
170
  citation = _SINGAPORE_CITATION
171
  homepage = _SINGAPORE_HOMEPAGE
172
-
 
 
 
 
 
 
 
173
 
174
  main_features = datasets.Features({
175
  "submission_id": datasets.Value("int32"),
@@ -179,18 +212,18 @@ class IntroProg(datasets.GeneratorBasedBuilder):
179
  "func_name": datasets.Value("string"),
180
  "description": datasets.Value(dtype='string'),
181
  "test": datasets.Value(dtype='string'),
182
-
183
  })
184
 
185
- if self.config.name.split("_")[1] == "data":
186
  features = main_features
187
  features["correct"] = datasets.Value(dtype="bool")
188
 
189
- if self.config.name.split("_")[0] == "dublin":
190
  features["user"] = datasets.Value("string")
191
  features["academic_year"] = datasets.Value('int32')
 
192
 
193
- elif self.config.name.split("_")[1] == "metadata":
194
  # metadata information
195
  features = datasets.Features({
196
  "assignment_id": datasets.Value("string"),
@@ -200,10 +233,10 @@ class IntroProg(datasets.GeneratorBasedBuilder):
200
  "test": datasets.Value("string"),
201
  })
202
 
203
- elif self.config.name.split("_")[1] == "repair":
204
  features = main_features
205
  features["annotation"] = datasets.Value("string")
206
- elif self.config.name.split("_")[1] == "bug":
207
  features = main_features
208
  features["comments"] = datasets.Value("string")
209
 
@@ -234,4 +267,4 @@ class IntroProg(datasets.GeneratorBasedBuilder):
234
  for key, line in enumerate(lines):
235
  d = json.loads(line)
236
  d = {k:v for k, v in d.items() if k in self.info.features}
237
- yield key, d
 
30
  an introduction to Python programming course at NUS (National University of Singapore).
31
  """
32
 
33
+ _NEW_CALEDONIA_DESCRIPTION = """
34
+ The NewCaledonia dataset includes the programs submitted in 2020 by a group of 60 students from the University of New Caledonia,
35
+ on a programming training platform. This plateform were developed and made available by the Computer Science department from the Orléans'
36
+ Technological Institute (University of Orléans, France). This release contains a subset of the assignments.
37
+ """
38
+
39
  _DUBLIN_HOMEPAGE = """https://figshare.com/articles/dataset/_5_Million_Python_Bash_Programming_Submissions_for_5_Courses_Grades_for_Computer-Based_Exams_over_3_academic_years_/12610958"""
40
 
41
  _SINGAPORE_HOMEPAGE = """https://github.com/githubhuyang/refactory"""
42
 
43
+ _NEW_CALEDONIA_HOMEPAGE = """https://github.com/GCleuziou/code2aes2vec/tree/master/Datasets"""
44
+
45
  _DUBLIN_CITATION = """
46
  @inproceedings{azcona2019user2code2vec,
47
  title={user2code2vec: Embeddings for Profiling Students Based on Distributional Representations of Source Code},
 
80
  }
81
  """
82
 
83
+ _NEW_CALEDONIA_CITATION = """
84
+ @inproceedings{DBLP:conf/edm/CleuziouF21,
85
+ author = {Guillaume Cleuziou and
86
+ Fr{\'{e}}d{\'{e}}ric Flouvat},
87
+ editor = {Sharon I{-}Han Hsiao and
88
+ Shaghayegh (Sherry) Sahebi and
89
+ Fran{\c{c}}ois Bouchet and
90
+ Jill{-}J{\^{e}}nn Vie},
91
+ title = {Learning student program embeddings using abstract execution traces},
92
+ booktitle = {Proceedings of the 14th International Conference on Educational Data
93
+ Mining, {EDM} 2021, virtual, June 29 - July 2, 2021},
94
+ publisher = {International Educational Data Mining Society},
95
+ year = {2021},
96
+ timestamp = {Wed, 09 Mar 2022 16:47:22 +0100},
97
+ biburl = {https://dblp.org/rec/conf/edm/CleuziouF21.bib},
98
+ bibsource = {dblp computer science bibliography, https://dblp.org}
99
+ }
100
+ """
101
 
102
+ _DESCRIPTION = """
103
+ Intro Programming. A dataset of student submissions to programming assignments.
104
  """
105
 
106
  _DUBLIN_URLS = {
 
130
  }
131
  }
132
 
133
+ _NEW_CALEDONIA_URLS = {
134
  "metadata": {
135
  "train": "./data/newcaledonia_metadata_train.jsonl",
136
  },
 
141
 
142
  _URLS = {
143
  "dublin": _DUBLIN_URLS,
144
+ "singapore": _SINGAPORE_URLS,
145
+ "newcaledonia": _NEW_CALEDONIA_URLS,
146
  }
147
 
148
  class IntroProgConfig(datasets.BuilderConfig):
 
172
 
173
  configurations = list(product(tasks, sources))
174
  configurations.append((tasks[0], "newcaledonia"))
175
+ configurations.append((tasks[1], "newcaledonia"))
176
 
177
  BUILDER_CONFIGS = []
178
  for (task, description), source in configurations:
179
  BUILDER_CONFIGS.append(
180
  IntroProgConfig(
181
  name=f"{source}_{task}",
 
182
  version=VERSION,
183
  )
184
  )
185
 
 
186
  def _info(self):
 
 
187
 
188
+ source, task = self.config.name.split("_")
189
+
190
+ if source == "dublin":
191
  description = _DUBLIN_DESCRIPTION
192
  citation = _DUBLIN_CITATION
193
  homepage = _DUBLIN_HOMEPAGE
194
+ elif source == "singapore":
195
  description =_SINGAPORE_DESCRIPTION
196
  citation = _SINGAPORE_CITATION
197
  homepage = _SINGAPORE_HOMEPAGE
198
+ elif source == "newcaledonia":
199
+ description = _NEW_CALEDONIA_DESCRIPTION
200
+ citation = _NEW_CALEDONIA_CITATION
201
+ homepage = _NEW_CALEDONIA_HOMEPAGE
202
+ else:
203
+ description = ""
204
+ citation = ""
205
+ homepage = ""
206
 
207
  main_features = datasets.Features({
208
  "submission_id": datasets.Value("int32"),
 
212
  "func_name": datasets.Value("string"),
213
  "description": datasets.Value(dtype='string'),
214
  "test": datasets.Value(dtype='string'),
 
215
  })
216
 
217
+ if task == "data":
218
  features = main_features
219
  features["correct"] = datasets.Value(dtype="bool")
220
 
221
+ if source == "dublin":
222
  features["user"] = datasets.Value("string")
223
  features["academic_year"] = datasets.Value('int32')
224
+ features['date']: datasets.Value('timestamp[s]')
225
 
226
+ elif task == "metadata":
227
  # metadata information
228
  features = datasets.Features({
229
  "assignment_id": datasets.Value("string"),
 
233
  "test": datasets.Value("string"),
234
  })
235
 
236
+ elif task == "repair":
237
  features = main_features
238
  features["annotation"] = datasets.Value("string")
239
+ elif task == "bug":
240
  features = main_features
241
  features["comments"] = datasets.Value("string")
242
 
 
267
  for key, line in enumerate(lines):
268
  d = json.loads(line)
269
  d = {k:v for k, v in d.items() if k in self.info.features}
270
+ yield key, d