Datasets:

Languages:
code
Multilinguality:
monolingual
Size Categories:
10K<n<100K
Language Creators:
found
Annotations Creators:
found
Source Datasets:
original
Tags:
License:
system HF staff commited on
Commit
66946af
0 Parent(s):

Update files from the datasets library (from 1.8.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.8.0

.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - found
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - code
8
+ licenses:
9
+ - other-C-UDA
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 10K<n<100K
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - text-retrieval
18
+ task_ids:
19
+ - document-retrieval
20
+ ---
21
+ # Dataset Card for "code_x_glue_cc_clone_detection_poj_104"
22
+
23
+ ## Table of Contents
24
+ - [Dataset Description](#dataset-description)
25
+ - [Dataset Summary](#dataset-summary)
26
+ - [Supported Tasks and Leaderboards](#supported-tasks)
27
+ - [Languages](#languages)
28
+ - [Dataset Structure](#dataset-structure)
29
+ - [Data Instances](#data-instances)
30
+ - [Data Fields](#data-fields)
31
+ - [Data Splits](#data-splits-sample-size)
32
+ - [Dataset Creation](#dataset-creation)
33
+ - [Curation Rationale](#curation-rationale)
34
+ - [Source Data](#source-data)
35
+ - [Annotations](#annotations)
36
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
37
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
38
+ - [Social Impact of Dataset](#social-impact-of-dataset)
39
+ - [Discussion of Biases](#discussion-of-biases)
40
+ - [Other Known Limitations](#other-known-limitations)
41
+ - [Additional Information](#additional-information)
42
+ - [Dataset Curators](#dataset-curators)
43
+ - [Licensing Information](#licensing-information)
44
+ - [Citation Information](#citation-information)
45
+ - [Contributions](#contributions)
46
+
47
+ ## Dataset Description
48
+
49
+ - **Homepage:** https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/Clone-detection-POJ-104
50
+
51
+ ### Dataset Summary
52
+
53
+ CodeXGLUE Clone-detection-POJ-104 dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/Clone-detection-POJ-104
54
+
55
+ Given a code and a collection of candidates as the input, the task is to return Top K codes with the same semantic. Models are evaluated by MAP score.
56
+ We use POJ-104 dataset on this task.
57
+
58
+ ### Supported Tasks and Leaderboards
59
+
60
+ - `document-retrieval`: The dataset can be used to train a model for retrieving top-k codes with the same semantics.
61
+
62
+ ### Languages
63
+
64
+ - C++ **programming** language
65
+
66
+ ## Dataset Structure
67
+
68
+ ### Data Instances
69
+
70
+ An example of 'train' looks as follows.
71
+ ```
72
+ {
73
+ "code": "\nint f(int shu,int min)\n{ \n int k=1;\n if(shu < min)\n { \n k= 0; \n return k;\n } \n else\n {\n for(int i = min;i<shu;i++)\n { \n if(shu%i == 0)\n { \n k=k+ f(shu/i,i); \n } \n \n \n } \n return k; \n}\n} \n\nmain()\n{\n int n,i,a;\n scanf(\"%d\",&n);\n \n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a);\n \n if(i!=n-1) \n printf(\"%d\\n\",f(a,2));\n else\n printf(\"%d\",f(a,2)); \n \n \n \n } \n \n \n }",
74
+ "id": 0,
75
+ "label": "home"
76
+ }
77
+ ```
78
+
79
+ ### Data Fields
80
+
81
+ In the following each data field in go is explained for each config. The data fields are the same among all splits.
82
+
83
+ #### default
84
+
85
+ |field name| type | description |
86
+ |----------|------|----------------------------------------------|
87
+ |id |int32 | Index of the sample |
88
+ |code |string| The full text of the function |
89
+ |label |string| The id of problem that the source code solves|
90
+
91
+ ### Data Splits
92
+
93
+ | name |train|validation|test |
94
+ |-------|----:|---------:|----:|
95
+ |default|32000| 8000|12000|
96
+
97
+ ## Dataset Creation
98
+
99
+ ### Curation Rationale
100
+
101
+ [More Information Needed]
102
+
103
+ ### Source Data
104
+
105
+ #### Initial Data Collection and Normalization
106
+
107
+ [More Information Needed]
108
+
109
+ #### Who are the source language producers?
110
+
111
+ [More Information Needed]
112
+
113
+ ### Annotations
114
+
115
+ #### Annotation process
116
+
117
+ [More Information Needed]
118
+
119
+ #### Who are the annotators?
120
+
121
+ [More Information Needed]
122
+
123
+ ### Personal and Sensitive Information
124
+
125
+ [More Information Needed]
126
+
127
+ ## Considerations for Using the Data
128
+
129
+ ### Social Impact of Dataset
130
+
131
+ [More Information Needed]
132
+
133
+ ### Discussion of Biases
134
+
135
+ [More Information Needed]
136
+
137
+ ### Other Known Limitations
138
+
139
+ [More Information Needed]
140
+
141
+ ## Additional Information
142
+
143
+ ### Dataset Curators
144
+
145
+ https://github.com/microsoft, https://github.com/madlag
146
+
147
+ ### Licensing Information
148
+
149
+ Computational Use of Data Agreement (C-UDA) License.
150
+
151
+ ### Citation Information
152
+
153
+ ```
154
+ @inproceedings{mou2016convolutional,
155
+ title={Convolutional neural networks over tree structures for programming language processing},
156
+ author={Mou, Lili and Li, Ge and Zhang, Lu and Wang, Tao and Jin, Zhi},
157
+ booktitle={Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence},
158
+ pages={1287--1293},
159
+ year={2016}
160
+ }
161
+ ```
162
+
163
+ ### Contributions
164
+
165
+ Thanks to @madlag (and partly also @ncoop57) for adding this dataset.
code_x_glue_cc_clone_detection_poj104.py ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import os.path
3
+ from typing import List
4
+
5
+ import datasets
6
+
7
+ from .common import TrainValidTestChild
8
+ from .generated_definitions import DEFINITIONS
9
+
10
+
11
+ _DESCRIPTION = """Given a code and a collection of candidates as the input, the task is to return Top K codes with the same semantic. Models are evaluated by MAP score.
12
+ We use POJ-104 dataset on this task."""
13
+
14
+ _CITATION = """@inproceedings{mou2016convolutional,
15
+ title={Convolutional neural networks over tree structures for programming language processing},
16
+ author={Mou, Lili and Li, Ge and Zhang, Lu and Wang, Tao and Jin, Zhi},
17
+ booktitle={Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence},
18
+ pages={1287--1293},
19
+ year={2016}
20
+ }"""
21
+
22
+
23
+ class CodeXGlueCcCloneDetectionPoj104Impl(TrainValidTestChild):
24
+ _DESCRIPTION = _DESCRIPTION
25
+ _CITATION = _CITATION
26
+
27
+ _FEATURES = {
28
+ "id": datasets.Value("int32"), # Index of the sample
29
+ "code": datasets.Value("string"), # The full text of the function
30
+ "label": datasets.Value("string"), # The id of problem that the source code solves
31
+ }
32
+
33
+ _SUPERVISED_KEYS = ["label"]
34
+
35
+ SPLIT_RANGES = {"train": (1, 65), "valid": (65, 81), "test": (81, 195)}
36
+
37
+ def generate_urls(self, split_name):
38
+ yield "data", "programs.tar.gz"
39
+
40
+ def _generate_examples(self, split_name, file_paths):
41
+ def files(path):
42
+ g = os.walk(path)
43
+ file = []
44
+ for path, dir_list, file_list in g:
45
+ for file_name in file_list:
46
+ file.append(os.path.join(path, file_name))
47
+ return file
48
+
49
+ root_path = file_paths["data"]
50
+ cont = 0
51
+ for i in range(*self.SPLIT_RANGES[split_name]):
52
+ items = files(os.path.join(root_path, "ProgramData/{}".format(i)))
53
+ for item in items:
54
+ js = {}
55
+ js["label"] = item.split("/")[1]
56
+ js["id"] = cont
57
+ js["code"] = open(item, encoding="latin-1").read()
58
+ yield cont, js
59
+ cont += 1
60
+
61
+
62
+ CLASS_MAPPING = {
63
+ "CodeXGlueCcCloneDetectionPoj104": CodeXGlueCcCloneDetectionPoj104Impl,
64
+ }
65
+
66
+
67
+ class CodeXGlueCcCloneDetectionPoj104(datasets.GeneratorBasedBuilder):
68
+ BUILDER_CONFIG_CLASS = datasets.BuilderConfig
69
+ BUILDER_CONFIGS = [
70
+ datasets.BuilderConfig(name=name, description=info["description"]) for name, info in DEFINITIONS.items()
71
+ ]
72
+
73
+ def _info(self):
74
+ name = self.config.name
75
+ info = DEFINITIONS[name]
76
+ if info["class_name"] in CLASS_MAPPING:
77
+ self.child = CLASS_MAPPING[info["class_name"]](info)
78
+ else:
79
+ raise RuntimeError(f"Unknown python class for dataset configuration {name}")
80
+ ret = self.child._info()
81
+ return ret
82
+
83
+ def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
84
+ return self.child._split_generators(dl_manager=dl_manager)
85
+
86
+ def _generate_examples(self, split_name, file_paths):
87
+ return self.child._generate_examples(split_name, file_paths)
common.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List
2
+
3
+ import datasets
4
+
5
+
6
+ # Citation, taken from https://github.com/microsoft/CodeXGLUE
7
+ _DEFAULT_CITATION = """@article{CodeXGLUE,
8
+ title={CodeXGLUE: A Benchmark Dataset and Open Challenge for Code Intelligence},
9
+ year={2020},}"""
10
+
11
+
12
+ class Child:
13
+ _DESCRIPTION = None
14
+ _FEATURES = None
15
+ _CITATION = None
16
+ SPLITS = {"train": datasets.Split.TRAIN}
17
+ _SUPERVISED_KEYS = None
18
+
19
+ def __init__(self, info):
20
+ self.info = info
21
+
22
+ def homepage(self):
23
+ return self.info["project_url"]
24
+
25
+ def _info(self):
26
+ # This is the description that will appear on the datasets page.
27
+ return datasets.DatasetInfo(
28
+ description=self.info["description"] + "\n\n" + self._DESCRIPTION,
29
+ features=datasets.Features(self._FEATURES),
30
+ homepage=self.homepage(),
31
+ citation=self._CITATION or _DEFAULT_CITATION,
32
+ supervised_keys=self._SUPERVISED_KEYS,
33
+ )
34
+
35
+ def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
36
+ SPLITS = self.SPLITS
37
+ _URL = self.info["raw_url"]
38
+ urls_to_download = {}
39
+ for split in SPLITS:
40
+ if split not in urls_to_download:
41
+ urls_to_download[split] = {}
42
+
43
+ for key, url in self.generate_urls(split):
44
+ if not url.startswith("http"):
45
+ url = _URL + "/" + url
46
+ urls_to_download[split][key] = url
47
+
48
+ downloaded_files = {}
49
+ for k, v in urls_to_download.items():
50
+ downloaded_files[k] = dl_manager.download_and_extract(v)
51
+
52
+ return [
53
+ datasets.SplitGenerator(
54
+ name=SPLITS[k],
55
+ gen_kwargs={"split_name": k, "file_paths": downloaded_files[k]},
56
+ )
57
+ for k in SPLITS
58
+ ]
59
+
60
+ def check_empty(self, entries):
61
+ all_empty = all([v == "" for v in entries.values()])
62
+ all_non_empty = all([v != "" for v in entries.values()])
63
+
64
+ if not all_non_empty and not all_empty:
65
+ raise RuntimeError("Parallel data files should have the same number of lines.")
66
+
67
+ return all_empty
68
+
69
+
70
+ class TrainValidTestChild(Child):
71
+ SPLITS = {
72
+ "train": datasets.Split.TRAIN,
73
+ "valid": datasets.Split.VALIDATION,
74
+ "test": datasets.Split.TEST,
75
+ }
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"default": {"description": "CodeXGLUE Clone-detection-POJ-104 dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/Clone-detection-POJ-104\n\nGiven a code and a collection of candidates as the input, the task is to return Top K codes with the same semantic. Models are evaluated by MAP score.\nWe use POJ-104 dataset on this task.", "citation": "@inproceedings{mou2016convolutional,\ntitle={Convolutional neural networks over tree structures for programming language processing},\nauthor={Mou, Lili and Li, Ge and Zhang, Lu and Wang, Tao and Jin, Zhi},\nbooktitle={Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence},\npages={1287--1293},\nyear={2016}\n}", "homepage": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/Clone-detection-POJ-104", "license": "", "features": {"id": {"dtype": "int32", "id": null, "_type": "Value"}, "code": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": {"input": "label", "output": ""}, "task_templates": null, "builder_name": "code_x_glue_cc_clone_detection_poj104", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 18878686, "num_examples": 32000, "dataset_name": "code_x_glue_cc_clone_detection_poj104"}, "validation": {"name": "validation", "num_bytes": 5765303, "num_examples": 8000, "dataset_name": "code_x_glue_cc_clone_detection_poj104"}, "test": {"name": "test", "num_bytes": 6852864, "num_examples": 12000, "dataset_name": "code_x_glue_cc_clone_detection_poj104"}}, "download_checksums": {"https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/Clone-detection-POJ-104/dataset/programs.tar.gz": {"num_bytes": 8658581, "checksum": "c0b8ef3ee9c9159c882dc9337cb46da0e612a28e24852a83f8a1cd68c838f390"}}, "download_size": 8658581, "post_processing_size": null, "dataset_size": 31496853, "size_in_bytes": 40155434}}
dummy/default/0.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:829541e228b4c3cc9661425a32df14141be42f3cd2e794757fbaa5eefdcf609d
3
+ size 2918
generated_definitions.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DEFINITIONS = {
2
+ "default": {
3
+ "class_name": "CodeXGlueCcCloneDetectionPoj104",
4
+ "dataset_type": "Code-Code",
5
+ "description": "CodeXGLUE Clone-detection-POJ-104 dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/Clone-detection-POJ-104",
6
+ "dir_name": "Clone-detection-POJ-104",
7
+ "name": "default",
8
+ "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/Clone-detection-POJ-104",
9
+ "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/Clone-detection-POJ-104/dataset",
10
+ "sizes": {"test": 12000, "train": 32000, "validation": 8000},
11
+ }
12
+ }