Datasets:
Tasks:
Text Classification
Formats:
parquet
Sub-tasks:
semantic-similarity-classification
Languages:
code
Size:
1M - 10M
License:
Commit
·
3e83a76
0
Parent(s):
Update files from the datasets library (from 1.8.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.8.0
- .gitattributes +27 -0
- README.md +185 -0
- code_x_glue_cc_clone_detection_big_clone_bench.py +95 -0
- common.py +75 -0
- dataset_infos.json +1 -0
- dummy/default/0.0.0/dummy_data.zip +3 -0
- generated_definitions.py +12 -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,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
- 1M<n<10M
|
| 14 |
+
source_datasets:
|
| 15 |
+
- original
|
| 16 |
+
task_categories:
|
| 17 |
+
- text-classification
|
| 18 |
+
task_ids:
|
| 19 |
+
- semantic-similarity-classification
|
| 20 |
+
---
|
| 21 |
+
# Dataset Card for "code_x_glue_cc_clone_detection_big_clone_bench"
|
| 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-BigCloneBench
|
| 50 |
+
|
| 51 |
+
### Dataset Summary
|
| 52 |
+
|
| 53 |
+
CodeXGLUE Clone-detection-BigCloneBench dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/Clone-detection-BigCloneBench
|
| 54 |
+
|
| 55 |
+
Given two codes as the input, the task is to do binary classification (0/1), where 1 stands for semantic equivalence and 0 for others. Models are evaluated by F1 score.
|
| 56 |
+
The dataset we use is BigCloneBench and filtered following the paper Detecting Code Clones with Graph Neural Network and Flow-Augmented Abstract Syntax Tree.
|
| 57 |
+
|
| 58 |
+
### Supported Tasks and Leaderboards
|
| 59 |
+
|
| 60 |
+
- `semantic-similarity-classification`: The dataset can be used to train a model for classifying if two given java methods are cloens of each other.
|
| 61 |
+
|
| 62 |
+
### Languages
|
| 63 |
+
|
| 64 |
+
- Java **programming** language
|
| 65 |
+
|
| 66 |
+
## Dataset Structure
|
| 67 |
+
|
| 68 |
+
### Data Instances
|
| 69 |
+
|
| 70 |
+
An example of 'test' looks as follows.
|
| 71 |
+
```
|
| 72 |
+
{
|
| 73 |
+
"func1": " @Test(expected = GadgetException.class)\n public void malformedGadgetSpecIsCachedAndThrows() throws Exception {\n HttpRequest request = createCacheableRequest();\n expect(pipeline.execute(request)).andReturn(new HttpResponse(\"malformed junk\")).once();\n replay(pipeline);\n try {\n specFactory.getGadgetSpec(createContext(SPEC_URL, false));\n fail(\"No exception thrown on bad parse\");\n } catch (GadgetException e) {\n }\n specFactory.getGadgetSpec(createContext(SPEC_URL, false));\n }\n",
|
| 74 |
+
"func2": " public InputStream getInputStream() throws TGBrowserException {\n try {\n if (!this.isFolder()) {\n URL url = new URL(this.url);\n InputStream stream = url.openStream();\n return stream;\n }\n } catch (Throwable throwable) {\n throw new TGBrowserException(throwable);\n }\n return null;\n }\n",
|
| 75 |
+
"id": 0,
|
| 76 |
+
"id1": 2381663,
|
| 77 |
+
"id2": 4458076,
|
| 78 |
+
"label": false
|
| 79 |
+
}
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
### Data Fields
|
| 83 |
+
|
| 84 |
+
In the following each data field in go is explained for each config. The data fields are the same among all splits.
|
| 85 |
+
|
| 86 |
+
#### default
|
| 87 |
+
|
| 88 |
+
|field name| type | description |
|
| 89 |
+
|----------|------|---------------------------------------------------|
|
| 90 |
+
|id |int32 | Index of the sample |
|
| 91 |
+
|id1 |int32 | The first function id |
|
| 92 |
+
|id2 |int32 | The second function id |
|
| 93 |
+
|func1 |string| The full text of the first function |
|
| 94 |
+
|func2 |string| The full text of the second function |
|
| 95 |
+
|label |bool | 1 is the functions are not equivalent, 0 otherwise|
|
| 96 |
+
|
| 97 |
+
### Data Splits
|
| 98 |
+
|
| 99 |
+
| name |train |validation| test |
|
| 100 |
+
|-------|-----:|---------:|-----:|
|
| 101 |
+
|default|901028| 415416|415416|
|
| 102 |
+
|
| 103 |
+
## Dataset Creation
|
| 104 |
+
|
| 105 |
+
### Curation Rationale
|
| 106 |
+
|
| 107 |
+
[More Information Needed]
|
| 108 |
+
|
| 109 |
+
### Source Data
|
| 110 |
+
|
| 111 |
+
#### Initial Data Collection and Normalization
|
| 112 |
+
|
| 113 |
+
Data was mined from the IJaDataset 2.0 dataset.
|
| 114 |
+
[More Information Needed]
|
| 115 |
+
|
| 116 |
+
#### Who are the source language producers?
|
| 117 |
+
|
| 118 |
+
[More Information Needed]
|
| 119 |
+
|
| 120 |
+
### Annotations
|
| 121 |
+
|
| 122 |
+
#### Annotation process
|
| 123 |
+
|
| 124 |
+
Data was manually labeled by three judges by automatically identifying potential clones using search heuristics.
|
| 125 |
+
[More Information Needed]
|
| 126 |
+
|
| 127 |
+
#### Who are the annotators?
|
| 128 |
+
|
| 129 |
+
[More Information Needed]
|
| 130 |
+
|
| 131 |
+
### Personal and Sensitive Information
|
| 132 |
+
|
| 133 |
+
[More Information Needed]
|
| 134 |
+
|
| 135 |
+
## Considerations for Using the Data
|
| 136 |
+
|
| 137 |
+
### Social Impact of Dataset
|
| 138 |
+
|
| 139 |
+
[More Information Needed]
|
| 140 |
+
|
| 141 |
+
### Discussion of Biases
|
| 142 |
+
|
| 143 |
+
Most of the clones are type 1 and 2 with type 3 and especially type 4 being rare.
|
| 144 |
+
|
| 145 |
+
[More Information Needed]
|
| 146 |
+
|
| 147 |
+
### Other Known Limitations
|
| 148 |
+
|
| 149 |
+
[More Information Needed]
|
| 150 |
+
|
| 151 |
+
## Additional Information
|
| 152 |
+
|
| 153 |
+
### Dataset Curators
|
| 154 |
+
|
| 155 |
+
https://github.com/microsoft, https://github.com/madlag
|
| 156 |
+
|
| 157 |
+
### Licensing Information
|
| 158 |
+
|
| 159 |
+
Computational Use of Data Agreement (C-UDA) License.
|
| 160 |
+
|
| 161 |
+
### Citation Information
|
| 162 |
+
|
| 163 |
+
```
|
| 164 |
+
@inproceedings{svajlenko2014towards,
|
| 165 |
+
title={Towards a big data curated benchmark of inter-project code clones},
|
| 166 |
+
author={Svajlenko, Jeffrey and Islam, Judith F and Keivanloo, Iman and Roy, Chanchal K and Mia, Mohammad Mamun},
|
| 167 |
+
booktitle={2014 IEEE International Conference on Software Maintenance and Evolution},
|
| 168 |
+
pages={476--480},
|
| 169 |
+
year={2014},
|
| 170 |
+
organization={IEEE}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
@inproceedings{wang2020detecting,
|
| 174 |
+
title={Detecting Code Clones with Graph Neural Network and Flow-Augmented Abstract Syntax Tree},
|
| 175 |
+
author={Wang, Wenhan and Li, Ge and Ma, Bo and Xia, Xin and Jin, Zhi},
|
| 176 |
+
booktitle={2020 IEEE 27th International Conference on Software Analysis, Evolution and Reengineering (SANER)},
|
| 177 |
+
pages={261--271},
|
| 178 |
+
year={2020},
|
| 179 |
+
organization={IEEE}
|
| 180 |
+
}
|
| 181 |
+
```
|
| 182 |
+
|
| 183 |
+
### Contributions
|
| 184 |
+
|
| 185 |
+
Thanks to @madlag (and partly also @ncoop57) for adding this dataset.
|
code_x_glue_cc_clone_detection_big_clone_bench.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 = """Given two codes as the input, the task is to do binary classification (0/1), where 1 stands for semantic equivalence and 0 for others. Models are evaluated by F1 score.
|
| 10 |
+
The dataset we use is BigCloneBench and filtered following the paper Detecting Code Clones with Graph Neural Network and Flow-Augmented Abstract Syntax Tree."""
|
| 11 |
+
|
| 12 |
+
_CITATION = """@inproceedings{svajlenko2014towards,
|
| 13 |
+
title={Towards a big data curated benchmark of inter-project code clones},
|
| 14 |
+
author={Svajlenko, Jeffrey and Islam, Judith F and Keivanloo, Iman and Roy, Chanchal K and Mia, Mohammad Mamun},
|
| 15 |
+
booktitle={2014 IEEE International Conference on Software Maintenance and Evolution},
|
| 16 |
+
pages={476--480},
|
| 17 |
+
year={2014},
|
| 18 |
+
organization={IEEE}
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
@inproceedings{wang2020detecting,
|
| 22 |
+
title={Detecting Code Clones with Graph Neural Network and Flow-Augmented Abstract Syntax Tree},
|
| 23 |
+
author={Wang, Wenhan and Li, Ge and Ma, Bo and Xia, Xin and Jin, Zhi},
|
| 24 |
+
booktitle={2020 IEEE 27th International Conference on Software Analysis, Evolution and Reengineering (SANER)},
|
| 25 |
+
pages={261--271},
|
| 26 |
+
year={2020},
|
| 27 |
+
organization={IEEE}
|
| 28 |
+
}"""
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class CodeXGlueCcCloneDetectionBigCloneBenchImpl(TrainValidTestChild):
|
| 32 |
+
_DESCRIPTION = _DESCRIPTION
|
| 33 |
+
_CITATION = _CITATION
|
| 34 |
+
|
| 35 |
+
_FEATURES = {
|
| 36 |
+
"id": datasets.Value("int32"), # Index of the sample
|
| 37 |
+
"id1": datasets.Value("int32"), # The first function id
|
| 38 |
+
"id2": datasets.Value("int32"), # The second function id
|
| 39 |
+
"func1": datasets.Value("string"), # The full text of the first function
|
| 40 |
+
"func2": datasets.Value("string"), # The full text of the second function
|
| 41 |
+
"label": datasets.Value("bool"), # 1 is the functions are not equivalent, 0 otherwise
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
_SUPERVISED_KEYS = ["label"]
|
| 45 |
+
|
| 46 |
+
def generate_urls(self, split_name):
|
| 47 |
+
yield "index", f"{split_name}.txt"
|
| 48 |
+
yield "data", "data.jsonl"
|
| 49 |
+
|
| 50 |
+
def _generate_examples(self, split_name, file_paths):
|
| 51 |
+
import json
|
| 52 |
+
|
| 53 |
+
js_all = {}
|
| 54 |
+
|
| 55 |
+
with open(file_paths["data"], encoding="utf-8") as f:
|
| 56 |
+
for idx, line in enumerate(f):
|
| 57 |
+
entry = json.loads(line)
|
| 58 |
+
js_all[int(entry["idx"])] = entry["func"]
|
| 59 |
+
|
| 60 |
+
with open(file_paths["index"], encoding="utf-8") as f:
|
| 61 |
+
for idx, line in enumerate(f):
|
| 62 |
+
line = line.strip()
|
| 63 |
+
idx1, idx2, label = [int(i) for i in line.split("\t")]
|
| 64 |
+
func1 = js_all[idx1]
|
| 65 |
+
func2 = js_all[idx2]
|
| 66 |
+
|
| 67 |
+
yield idx, dict(id=idx, id1=idx1, id2=idx2, func1=func1, func2=func2, label=(label == 1))
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
CLASS_MAPPING = {
|
| 71 |
+
"CodeXGlueCcCloneDetectionBigCloneBench": CodeXGlueCcCloneDetectionBigCloneBenchImpl,
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
class CodeXGlueCcCloneDetectionBigCloneBench(datasets.GeneratorBasedBuilder):
|
| 76 |
+
BUILDER_CONFIG_CLASS = datasets.BuilderConfig
|
| 77 |
+
BUILDER_CONFIGS = [
|
| 78 |
+
datasets.BuilderConfig(name=name, description=info["description"]) for name, info in DEFINITIONS.items()
|
| 79 |
+
]
|
| 80 |
+
|
| 81 |
+
def _info(self):
|
| 82 |
+
name = self.config.name
|
| 83 |
+
info = DEFINITIONS[name]
|
| 84 |
+
if info["class_name"] in CLASS_MAPPING:
|
| 85 |
+
self.child = CLASS_MAPPING[info["class_name"]](info)
|
| 86 |
+
else:
|
| 87 |
+
raise RuntimeError(f"Unknown python class for dataset configuration {name}")
|
| 88 |
+
ret = self.child._info()
|
| 89 |
+
return ret
|
| 90 |
+
|
| 91 |
+
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
| 92 |
+
return self.child._split_generators(dl_manager=dl_manager)
|
| 93 |
+
|
| 94 |
+
def _generate_examples(self, split_name, file_paths):
|
| 95 |
+
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-BigCloneBench dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/Clone-detection-BigCloneBench\n\nGiven two codes as the input, the task is to do binary classification (0/1), where 1 stands for semantic equivalence and 0 for others. Models are evaluated by F1 score.\nThe dataset we use is BigCloneBench and filtered following the paper Detecting Code Clones with Graph Neural Network and Flow-Augmented Abstract Syntax Tree.", "citation": "@inproceedings{svajlenko2014towards,\ntitle={Towards a big data curated benchmark of inter-project code clones},\nauthor={Svajlenko, Jeffrey and Islam, Judith F and Keivanloo, Iman and Roy, Chanchal K and Mia, Mohammad Mamun},\nbooktitle={2014 IEEE International Conference on Software Maintenance and Evolution},\npages={476--480},\nyear={2014},\norganization={IEEE}\n}\n\n@inproceedings{wang2020detecting,\ntitle={Detecting Code Clones with Graph Neural Network and Flow-Augmented Abstract Syntax Tree},\nauthor={Wang, Wenhan and Li, Ge and Ma, Bo and Xia, Xin and Jin, Zhi},\nbooktitle={2020 IEEE 27th International Conference on Software Analysis, Evolution and Reengineering (SANER)},\npages={261--271},\nyear={2020},\norganization={IEEE}\n}", "homepage": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/Clone-detection-BigCloneBench", "license": "", "features": {"id": {"dtype": "int32", "id": null, "_type": "Value"}, "id1": {"dtype": "int32", "id": null, "_type": "Value"}, "id2": {"dtype": "int32", "id": null, "_type": "Value"}, "func1": {"dtype": "string", "id": null, "_type": "Value"}, "func2": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"dtype": "bool", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": {"input": "label", "output": ""}, "task_templates": null, "builder_name": "code_x_glue_cc_clone_detection_big_clone_bench", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2888035757, "num_examples": 901028, "dataset_name": "code_x_glue_cc_clone_detection_big_clone_bench"}, "validation": {"name": "validation", "num_bytes": 1371399694, "num_examples": 415416, "dataset_name": "code_x_glue_cc_clone_detection_big_clone_bench"}, "test": {"name": "test", "num_bytes": 1220662901, "num_examples": 415416, "dataset_name": "code_x_glue_cc_clone_detection_big_clone_bench"}}, "download_checksums": {"https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/Clone-detection-BigCloneBench/dataset/train.txt": {"num_bytes": 17043552, "checksum": "29119bfa94673374249c3424809fbe6baaa1f0e87a13e3c727bbd6cdf1224b77"}, "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/Clone-detection-BigCloneBench/dataset/data.jsonl": {"num_bytes": 15174797, "checksum": "d8bc51e62deddcc45bd26c5b57f5add2a2cf377f13b9f6c2fb656fbc8fca4dd2"}, "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/Clone-detection-BigCloneBench/dataset/valid.txt": {"num_bytes": 7861019, "checksum": "e59e8c1321df59b6ab0143165cb603030c55800c00e2d782e06810517b8de1e4"}, "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/Clone-detection-BigCloneBench/dataset/test.txt": {"num_bytes": 7876506, "checksum": "a6c0cf79be34e582fdc64007aa894ed094e4f9ff2e5395a8d2b5c39eeef2737a"}}, "download_size": 47955874, "post_processing_size": null, "dataset_size": 5480098352, "size_in_bytes": 5528054226}}
|
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:618fadbd4a6486cd2952107df903c66c3745aa145e527a00549e45b20b263fcf
|
| 3 |
+
size 4093
|
generated_definitions.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
DEFINITIONS = {
|
| 2 |
+
"default": {
|
| 3 |
+
"class_name": "CodeXGlueCcCloneDetectionBigCloneBench",
|
| 4 |
+
"dataset_type": "Code-Code",
|
| 5 |
+
"description": "CodeXGLUE Clone-detection-BigCloneBench dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/Clone-detection-BigCloneBench",
|
| 6 |
+
"dir_name": "Clone-detection-BigCloneBench",
|
| 7 |
+
"name": "default",
|
| 8 |
+
"project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/Clone-detection-BigCloneBench",
|
| 9 |
+
"raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/Clone-detection-BigCloneBench/dataset",
|
| 10 |
+
"sizes": {"test": 415416, "train": 901028, "validation": 415416},
|
| 11 |
+
}
|
| 12 |
+
}
|