Datasets:

Languages:
code
Size Categories:
10K<n<100K
Language Creators:
found
Annotations Creators:
expert-generated
Source Datasets:
original
ArXiv:
Tags:
code-to-code
License:
albertvillanova HF staff commited on
Commit
946dd8d
1 Parent(s): f18c108

Delete loading script

Browse files
Files changed (1) hide show
  1. code_x_glue_cc_code_to_code_trans.py +0 -101
code_x_glue_cc_code_to_code_trans.py DELETED
@@ -1,101 +0,0 @@
1
- from typing import List
2
-
3
- import datasets
4
-
5
- from .common import TrainValidTestChild
6
- from .generated_definitions import DEFINITIONS
7
-
8
-
9
- _DESCRIPTION = """The dataset is collected from several public repos, including Lucene(http://lucene.apache.org/), POI(http://poi.apache.org/), JGit(https://github.com/eclipse/jgit/) and Antlr(https://github.com/antlr/).
10
- We collect both the Java and C# versions of the codes and find the parallel functions. After removing duplicates and functions with the empty body, we split the whole dataset into training, validation and test sets."""
11
- _CITATION = """@article{DBLP:journals/corr/abs-2102-04664,
12
- author = {Shuai Lu and
13
- Daya Guo and
14
- Shuo Ren and
15
- Junjie Huang and
16
- Alexey Svyatkovskiy and
17
- Ambrosio Blanco and
18
- Colin B. Clement and
19
- Dawn Drain and
20
- Daxin Jiang and
21
- Duyu Tang and
22
- Ge Li and
23
- Lidong Zhou and
24
- Linjun Shou and
25
- Long Zhou and
26
- Michele Tufano and
27
- Ming Gong and
28
- Ming Zhou and
29
- Nan Duan and
30
- Neel Sundaresan and
31
- Shao Kun Deng and
32
- Shengyu Fu and
33
- Shujie Liu},
34
- title = {CodeXGLUE: {A} Machine Learning Benchmark Dataset for Code Understanding
35
- and Generation},
36
- journal = {CoRR},
37
- volume = {abs/2102.04664},
38
- year = {2021}
39
- }"""
40
-
41
-
42
- class CodeXGlueCcCodeToCodeTransImpl(TrainValidTestChild):
43
- _DESCRIPTION = _DESCRIPTION
44
- _CITATION = _CITATION
45
-
46
- _FEATURES = {
47
- "id": datasets.Value("int32"), # Index of the sample
48
- "java": datasets.Value("string"), # The java version of the code
49
- "cs": datasets.Value("string"), # The C# version of the code
50
- }
51
-
52
- def generate_urls(self, split_name):
53
- for key in "cs", "java":
54
- yield key, f"{split_name}.java-cs.txt.{key}"
55
-
56
- def _generate_examples(self, split_name, file_paths):
57
- """This function returns the examples in the raw (text) form."""
58
- # Open each file (one for java, and one for c#)
59
- files = {k: open(file_paths[k], encoding="utf-8") for k in file_paths}
60
-
61
- id_ = 0
62
- while True:
63
- # Read a single line from each file
64
- entries = {k: files[k].readline() for k in file_paths}
65
-
66
- empty = self.check_empty(entries)
67
- if empty:
68
- # We are done: end of files
69
- return
70
-
71
- entries["id"] = id_
72
- yield id_, entries
73
- id_ += 1
74
-
75
-
76
- CLASS_MAPPING = {
77
- "CodeXGlueCcCodeToCodeTrans": CodeXGlueCcCodeToCodeTransImpl,
78
- }
79
-
80
-
81
- class CodeXGlueCcCodeToCodeTrans(datasets.GeneratorBasedBuilder):
82
- BUILDER_CONFIG_CLASS = datasets.BuilderConfig
83
- BUILDER_CONFIGS = [
84
- datasets.BuilderConfig(name=name, description=info["description"]) for name, info in DEFINITIONS.items()
85
- ]
86
-
87
- def _info(self):
88
- name = self.config.name
89
- info = DEFINITIONS[name]
90
- if info["class_name"] in CLASS_MAPPING:
91
- self.child = CLASS_MAPPING[info["class_name"]](info)
92
- else:
93
- raise RuntimeError(f"Unknown python class for dataset configuration {name}")
94
- ret = self.child._info()
95
- return ret
96
-
97
- def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
98
- return self.child._split_generators(dl_manager=dl_manager)
99
-
100
- def _generate_examples(self, split_name, file_paths):
101
- return self.child._generate_examples(split_name, file_paths)