Datasets:

Sub-tasks:
slot-filling
Languages:
code
Multilinguality:
monolingual
Size Categories:
10K<n<100K
1K<n<10K
Language Creators:
found
Annotations Creators:
found
Source Datasets:
original
Tags:
License:
albertvillanova HF staff commited on
Commit
d83003b
1 Parent(s): 3e39f7b

Delete loading script

Browse files
code_x_glue_cc_cloze_testing_maxmin.py DELETED
@@ -1,83 +0,0 @@
1
- import json
2
- from typing import List
3
-
4
- import datasets
5
-
6
- from .common import Child
7
- from .generated_definitions import DEFINITIONS
8
-
9
-
10
- _DESCRIPTION = """Cloze tests are widely adopted in Natural Languages Processing to evaluate the performance of the trained language models. The task is aimed to predict the answers for the blank with the context of the blank, which can be formulated as a multi-choice classification problem.
11
- Here we present the two cloze testing datasets in code domain with six different programming languages: ClozeTest-maxmin and ClozeTest-all. Each instance in the dataset contains a masked code function, its docstring and the target word.
12
- The only difference between ClozeTest-maxmin and ClozeTest-all is their selected words sets, where ClozeTest-maxmin only contains two words while ClozeTest-all contains 930 words."""
13
-
14
- _CITATION = """@article{CodeXGLUE,
15
- title={CodeXGLUE: An Open Challenge for Code Intelligence},
16
- journal={arXiv},
17
- year={2020},
18
- }
19
- @article{feng2020codebert,
20
- title={CodeBERT: A Pre-Trained Model for Programming and Natural Languages},
21
- author={Feng, Zhangyin and Guo, Daya and Tang, Duyu and Duan, Nan and Feng, Xiaocheng and Gong, Ming and Shou, Linjun and Qin, Bing and Liu, Ting and Jiang, Daxin and others},
22
- journal={arXiv preprint arXiv:2002.08155},
23
- year={2020}
24
- }
25
- @article{husain2019codesearchnet,
26
- title={CodeSearchNet Challenge: Evaluating the State of Semantic Code Search},
27
- author={Husain, Hamel and Wu, Ho-Hsiang and Gazit, Tiferet and Allamanis, Miltiadis and Brockschmidt, Marc},
28
- journal={arXiv preprint arXiv:1909.09436},
29
- year={2019}
30
- }"""
31
-
32
-
33
- class CodeXGlueCcClozeTestingImpl(Child):
34
- _DESCRIPTION = _DESCRIPTION
35
- _CITATION = _CITATION
36
-
37
- _FEATURES = {
38
- "id": datasets.Value("int32"), # Index of the sample
39
- "idx": datasets.Value("string"), # Original index in the dataset
40
- "nl_tokens": datasets.features.Sequence(datasets.Value("string")), # Natural language tokens
41
- "pl_tokens": datasets.features.Sequence(datasets.Value("string")), # Programming language tokens
42
- }
43
-
44
- def generate_urls(self, split_name):
45
- yield "data", "clozeTest.json"
46
-
47
- def _generate_examples(self, split_name, file_paths):
48
- with open(file_paths["data"], encoding="utf-8") as f:
49
- j = json.load(f)
50
- index = 0
51
- for entry in j:
52
- yield index, dict(
53
- id=index, idx=entry["idx"], nl_tokens=entry["nl_tokens"], pl_tokens=entry["pl_tokens"]
54
- )
55
- index += 1
56
-
57
-
58
- CLASS_MAPPING = {
59
- "CodeXGlueCcClozeTestingMaxmin": CodeXGlueCcClozeTestingImpl,
60
- }
61
-
62
-
63
- class CodeXGlueCcClozeTestingMaxmin(datasets.GeneratorBasedBuilder):
64
- BUILDER_CONFIG_CLASS = datasets.BuilderConfig
65
- BUILDER_CONFIGS = [
66
- datasets.BuilderConfig(name=name, description=info["description"]) for name, info in DEFINITIONS.items()
67
- ]
68
-
69
- def _info(self):
70
- name = self.config.name
71
- info = DEFINITIONS[name]
72
- if info["class_name"] in CLASS_MAPPING:
73
- self.child = CLASS_MAPPING[info["class_name"]](info)
74
- else:
75
- raise RuntimeError(f"Unknown python class for dataset configuration {name}")
76
- ret = self.child._info()
77
- return ret
78
-
79
- def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
80
- return self.child._split_generators(dl_manager=dl_manager)
81
-
82
- def _generate_examples(self, split_name, file_paths):
83
- return self.child._generate_examples(split_name, file_paths)