Datasets:
Tasks:
Text Retrieval
Modalities:
Text
Formats:
parquet
Sub-tasks:
document-retrieval
Languages:
code
Size:
10K - 100K
License:
Commit
•
701869d
1
Parent(s):
144ee6c
Convert dataset to Parquet (#5)
Browse files- Convert dataset to Parquet (4bfc047a7002cc24638f10e8855a20fbbbec630d)
- Delete loading script (ce880554b60b42b24b872c7acd26bfa9fb4e0aa5)
- Delete loading script auxiliary file (6e3bb97cf21cac956cd0511120a420fc490fbd19)
- Delete loading script auxiliary file (9679450cf55e2c7796b46ef46cfb6fd8a6c44671)
- README.md +11 -2
- code_x_glue_cc_clone_detection_poj104.py +0 -93
- common.py +0 -75
- data/test-00000-of-00001.parquet +3 -0
- data/train-00000-of-00001.parquet +3 -0
- data/validation-00000-of-00001.parquet +3 -0
- generated_definitions.py +0 -12
README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
---
|
2 |
-
pretty_name: CodeXGlueCcCloneDetectionPoj104
|
3 |
annotations_creators:
|
4 |
- found
|
5 |
language_creators:
|
@@ -18,6 +17,7 @@ task_categories:
|
|
18 |
- text-retrieval
|
19 |
task_ids:
|
20 |
- document-retrieval
|
|
|
21 |
dataset_info:
|
22 |
features:
|
23 |
- name: id
|
@@ -36,8 +36,17 @@ dataset_info:
|
|
36 |
- name: test
|
37 |
num_bytes: 7227506
|
38 |
num_examples: 12000
|
39 |
-
download_size:
|
40 |
dataset_size: 33789014
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
---
|
42 |
# Dataset Card for "code_x_glue_cc_clone_detection_poj_104"
|
43 |
|
|
|
1 |
---
|
|
|
2 |
annotations_creators:
|
3 |
- found
|
4 |
language_creators:
|
|
|
17 |
- text-retrieval
|
18 |
task_ids:
|
19 |
- document-retrieval
|
20 |
+
pretty_name: CodeXGlueCcCloneDetectionPoj104
|
21 |
dataset_info:
|
22 |
features:
|
23 |
- name: id
|
|
|
36 |
- name: test
|
37 |
num_bytes: 7227506
|
38 |
num_examples: 12000
|
39 |
+
download_size: 13348734
|
40 |
dataset_size: 33789014
|
41 |
+
configs:
|
42 |
+
- config_name: default
|
43 |
+
data_files:
|
44 |
+
- split: train
|
45 |
+
path: data/train-*
|
46 |
+
- split: validation
|
47 |
+
path: data/validation-*
|
48 |
+
- split: test
|
49 |
+
path: data/test-*
|
50 |
---
|
51 |
# Dataset Card for "code_x_glue_cc_clone_detection_poj_104"
|
52 |
|
code_x_glue_cc_clone_detection_poj104.py
DELETED
@@ -1,93 +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 = """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.
|
10 |
-
We use POJ-104 dataset on this task."""
|
11 |
-
|
12 |
-
_CITATION = """@inproceedings{mou2016convolutional,
|
13 |
-
title={Convolutional neural networks over tree structures for programming language processing},
|
14 |
-
author={Mou, Lili and Li, Ge and Zhang, Lu and Wang, Tao and Jin, Zhi},
|
15 |
-
booktitle={Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence},
|
16 |
-
pages={1287--1293},
|
17 |
-
year={2016}
|
18 |
-
}"""
|
19 |
-
|
20 |
-
|
21 |
-
class CodeXGlueCcCloneDetectionPoj104Impl(TrainValidTestChild):
|
22 |
-
_DESCRIPTION = _DESCRIPTION
|
23 |
-
_CITATION = _CITATION
|
24 |
-
|
25 |
-
_FEATURES = {
|
26 |
-
"id": datasets.Value("int32"), # Index of the sample
|
27 |
-
"code": datasets.Value("string"), # The full text of the function
|
28 |
-
"label": datasets.Value("string"), # The id of problem that the source code solves
|
29 |
-
}
|
30 |
-
|
31 |
-
_SUPERVISED_KEYS = ["label"]
|
32 |
-
|
33 |
-
SPLIT_RANGES = {"train": (1, 65), "valid": (65, 81), "test": (81, 195)}
|
34 |
-
|
35 |
-
def _generate_examples(self, files, split_name):
|
36 |
-
cont = 0
|
37 |
-
for path, f in files:
|
38 |
-
# path are in the format ProgramData/{index}/{filename}
|
39 |
-
label = int(path.split("/")[1])
|
40 |
-
if self.SPLIT_RANGES[split_name][0] <= label <= self.SPLIT_RANGES[split_name][1]:
|
41 |
-
js = {}
|
42 |
-
js["label"] = str(label)
|
43 |
-
js["id"] = cont
|
44 |
-
js["code"] = f.read().decode("latin-1")
|
45 |
-
yield cont, js
|
46 |
-
cont += 1
|
47 |
-
|
48 |
-
|
49 |
-
CLASS_MAPPING = {
|
50 |
-
"CodeXGlueCcCloneDetectionPoj104": CodeXGlueCcCloneDetectionPoj104Impl,
|
51 |
-
}
|
52 |
-
|
53 |
-
|
54 |
-
class CodeXGlueCcCloneDetectionPoj104(datasets.GeneratorBasedBuilder):
|
55 |
-
BUILDER_CONFIG_CLASS = datasets.BuilderConfig
|
56 |
-
BUILDER_CONFIGS = [
|
57 |
-
datasets.BuilderConfig(name=name, description=info["description"]) for name, info in DEFINITIONS.items()
|
58 |
-
]
|
59 |
-
|
60 |
-
def _info(self):
|
61 |
-
name = self.config.name
|
62 |
-
info = DEFINITIONS[name]
|
63 |
-
if info["class_name"] in CLASS_MAPPING:
|
64 |
-
self.child = CLASS_MAPPING[info["class_name"]](info)
|
65 |
-
else:
|
66 |
-
raise RuntimeError(f"Unknown python class for dataset configuration {name}")
|
67 |
-
ret = self.child._info()
|
68 |
-
return ret
|
69 |
-
|
70 |
-
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
71 |
-
name = self.config.name
|
72 |
-
info = DEFINITIONS[name]
|
73 |
-
archive = dl_manager.download(info["raw_url"] + "/programs.tar.gz")
|
74 |
-
return [
|
75 |
-
datasets.SplitGenerator(
|
76 |
-
name=datasets.Split.TRAIN,
|
77 |
-
# These kwargs will be passed to _generate_examples
|
78 |
-
gen_kwargs={"files": dl_manager.iter_archive(archive), "split_name": "train"},
|
79 |
-
),
|
80 |
-
datasets.SplitGenerator(
|
81 |
-
name=datasets.Split.VALIDATION,
|
82 |
-
# These kwargs will be passed to _generate_examples
|
83 |
-
gen_kwargs={"files": dl_manager.iter_archive(archive), "split_name": "valid"},
|
84 |
-
),
|
85 |
-
datasets.SplitGenerator(
|
86 |
-
name=datasets.Split.TEST,
|
87 |
-
# These kwargs will be passed to _generate_examples
|
88 |
-
gen_kwargs={"files": dl_manager.iter_archive(archive), "split_name": "test"},
|
89 |
-
),
|
90 |
-
]
|
91 |
-
|
92 |
-
def _generate_examples(self, files, split_name):
|
93 |
-
return self.child._generate_examples(files, split_name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
common.py
DELETED
@@ -1,75 +0,0 @@
|
|
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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/test-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4c1d6389d66a68c2b5ad4c345ac264b8f4062258aa870b74a3fd478b7cce4955
|
3 |
+
size 2853417
|
data/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:36403bfcf7933eb40fcdadd543bfece26d18c52a4f1960a96550aa6b15708c03
|
3 |
+
size 8031542
|
data/validation-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:497282b576c408edc2bf4ba0d1b12fda3cdadb102f3cd670a99fa6eeef587ab7
|
3 |
+
size 2463775
|
generated_definitions.py
DELETED
@@ -1,12 +0,0 @@
|
|
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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|