Datasets:
Size:
1M<n<10M
ArXiv:
Tags:
programming-language
code
program-synthesis
automatic-code-repair
code-retrieval
code-translation
License:
Add file_name feature
Browse files- xCodeEval.py +10 -0
xCodeEval.py
CHANGED
|
@@ -209,6 +209,7 @@ _PROB_DESC_TEXT_FEATURES = {
|
|
| 209 |
|
| 210 |
_TEXT_FEATURES = {
|
| 211 |
"apr": {
|
|
|
|
| 212 |
"similarity_score",
|
| 213 |
"equal_cnt",
|
| 214 |
"replace_cnt",
|
|
@@ -230,6 +231,7 @@ _TEXT_FEATURES = {
|
|
| 230 |
"lang_cluster",
|
| 231 |
},
|
| 232 |
"code_translation": {
|
|
|
|
| 233 |
"lang",
|
| 234 |
"source_code",
|
| 235 |
"code_uid",
|
|
@@ -238,6 +240,7 @@ _TEXT_FEATURES = {
|
|
| 238 |
"exec_outcome",
|
| 239 |
},
|
| 240 |
"program_synthesis": {
|
|
|
|
| 241 |
"lang",
|
| 242 |
"source_code",
|
| 243 |
"tags",
|
|
@@ -248,22 +251,26 @@ _TEXT_FEATURES = {
|
|
| 248 |
"exec_outcome"
|
| 249 |
},
|
| 250 |
"retrieval_code_code": {
|
|
|
|
| 251 |
"positive_code",
|
| 252 |
"negative_code",
|
| 253 |
"src_uid",
|
| 254 |
"source_code",
|
| 255 |
},
|
| 256 |
"retrieval_nl_code": {
|
|
|
|
| 257 |
"nl",
|
| 258 |
"positive_code",
|
| 259 |
"negative_code",
|
| 260 |
"src_uid",
|
| 261 |
},
|
| 262 |
"retrieval_corpus": {
|
|
|
|
| 263 |
"idx",
|
| 264 |
"source_code",
|
| 265 |
},
|
| 266 |
"code_compilation": {
|
|
|
|
| 267 |
"lang",
|
| 268 |
"source_code",
|
| 269 |
"compilation_error",
|
|
@@ -272,6 +279,7 @@ _TEXT_FEATURES = {
|
|
| 272 |
"difficulty",
|
| 273 |
},
|
| 274 |
"tag_classification": {
|
|
|
|
| 275 |
"lang",
|
| 276 |
"source_code",
|
| 277 |
"tags",
|
|
@@ -2060,9 +2068,11 @@ class xCodeEval(datasets.GeneratorBasedBuilder):
|
|
| 2060 |
|
| 2061 |
idx = 0
|
| 2062 |
for filepath in filepaths:
|
|
|
|
| 2063 |
with open(filepath) as rp:
|
| 2064 |
for line in rp:
|
| 2065 |
sample = json.loads(line)
|
|
|
|
| 2066 |
for pre_feature in list(sample.keys()):
|
| 2067 |
if pre_feature not in _TEXT_FEATURES[task_name]:
|
| 2068 |
sample.pop(pre_feature)
|
|
|
|
| 209 |
|
| 210 |
_TEXT_FEATURES = {
|
| 211 |
"apr": {
|
| 212 |
+
"file_name",
|
| 213 |
"similarity_score",
|
| 214 |
"equal_cnt",
|
| 215 |
"replace_cnt",
|
|
|
|
| 231 |
"lang_cluster",
|
| 232 |
},
|
| 233 |
"code_translation": {
|
| 234 |
+
"file_name",
|
| 235 |
"lang",
|
| 236 |
"source_code",
|
| 237 |
"code_uid",
|
|
|
|
| 240 |
"exec_outcome",
|
| 241 |
},
|
| 242 |
"program_synthesis": {
|
| 243 |
+
"file_name",
|
| 244 |
"lang",
|
| 245 |
"source_code",
|
| 246 |
"tags",
|
|
|
|
| 251 |
"exec_outcome"
|
| 252 |
},
|
| 253 |
"retrieval_code_code": {
|
| 254 |
+
"file_name",
|
| 255 |
"positive_code",
|
| 256 |
"negative_code",
|
| 257 |
"src_uid",
|
| 258 |
"source_code",
|
| 259 |
},
|
| 260 |
"retrieval_nl_code": {
|
| 261 |
+
"file_name",
|
| 262 |
"nl",
|
| 263 |
"positive_code",
|
| 264 |
"negative_code",
|
| 265 |
"src_uid",
|
| 266 |
},
|
| 267 |
"retrieval_corpus": {
|
| 268 |
+
"file_name",
|
| 269 |
"idx",
|
| 270 |
"source_code",
|
| 271 |
},
|
| 272 |
"code_compilation": {
|
| 273 |
+
"file_name",
|
| 274 |
"lang",
|
| 275 |
"source_code",
|
| 276 |
"compilation_error",
|
|
|
|
| 279 |
"difficulty",
|
| 280 |
},
|
| 281 |
"tag_classification": {
|
| 282 |
+
"file_name",
|
| 283 |
"lang",
|
| 284 |
"source_code",
|
| 285 |
"tags",
|
|
|
|
| 2068 |
|
| 2069 |
idx = 0
|
| 2070 |
for filepath in filepaths:
|
| 2071 |
+
file_name = filepath.split("/")[-1]
|
| 2072 |
with open(filepath) as rp:
|
| 2073 |
for line in rp:
|
| 2074 |
sample = json.loads(line)
|
| 2075 |
+
sample["file_name"] = file_name
|
| 2076 |
for pre_feature in list(sample.keys()):
|
| 2077 |
if pre_feature not in _TEXT_FEATURES[task_name]:
|
| 2078 |
sample.pop(pre_feature)
|