Datasets:
Tasks:
Text Retrieval
Modalities:
Text
Formats:
parquet
Sub-tasks:
document-retrieval
Languages:
code
Size:
10K - 100K
License:
Commit ·
66946af
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
Files changed (7)
- .gitattributesAdded+27
- README.mdAdded+165
- code_x_glue_cc_clone_detection_poj104.pyAdded+87
- common.pyAdded+75
- dataset_infos.jsonAdded+1
- dummy/default/0.0.0/dummy_data.zipAdded+3
- generated_definitions.pyAdded+12
123456789101112131415161718192021222324252627*.7z filter=lfs diff=lfs merge=lfs -text*.arrow filter=lfs diff=lfs merge=lfs -text*.bin filter=lfs diff=lfs merge=lfs -text*.bin.* filter=lfs diff=lfs merge=lfs -text*.bz2 filter=lfs diff=lfs merge=lfs -text*.ftz filter=lfs diff=lfs merge=lfs -text*.gz filter=lfs diff=lfs merge=lfs -text*.h5 filter=lfs diff=lfs merge=lfs -text*.joblib filter=lfs diff=lfs merge=lfs -text*.lfs.* filter=lfs diff=lfs merge=lfs -text*.model filter=lfs diff=lfs merge=lfs -text*.msgpack filter=lfs diff=lfs merge=lfs -text*.onnx filter=lfs diff=lfs merge=lfs -text*.ot filter=lfs diff=lfs merge=lfs -text*.parquet filter=lfs diff=lfs merge=lfs -text*.pb filter=lfs diff=lfs merge=lfs -text*.pt filter=lfs diff=lfs merge=lfs -text*.pth filter=lfs diff=lfs merge=lfs -text*.rar filter=lfs diff=lfs merge=lfs -textsaved_model/**/* filter=lfs diff=lfs merge=lfs -text*.tar.* filter=lfs diff=lfs merge=lfs -text*.tflite filter=lfs diff=lfs merge=lfs -text*.tgz filter=lfs diff=lfs merge=lfs -text*.xz filter=lfs diff=lfs merge=lfs -text*.zip filter=lfs diff=lfs merge=lfs -text*.zstandard filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165---annotations_creators:- foundlanguage_creators:- foundlanguages:- codelicenses:- other-C-UDAmultilinguality:- monolingualsize_categories:- 10K<n<100Ksource_datasets:- originaltask_categories:- text-retrievaltask_ids:- document-retrieval---# Dataset Card for "code_x_glue_cc_clone_detection_poj_104"
## Table of Contents- [Dataset Description](#dataset-description) - [Dataset Summary](#dataset-summary) - [Supported Tasks and Leaderboards](#supported-tasks) - [Languages](#languages)- [Dataset Structure](#dataset-structure) - [Data Instances](#data-instances) - [Data Fields](#data-fields) - [Data Splits](#data-splits-sample-size)- [Dataset Creation](#dataset-creation) - [Curation Rationale](#curation-rationale) - [Source Data](#source-data) - [Annotations](#annotations) - [Personal and Sensitive Information](#personal-and-sensitive-information)- [Considerations for Using the Data](#considerations-for-using-the-data) - [Social Impact of Dataset](#social-impact-of-dataset) - [Discussion of Biases](#discussion-of-biases) - [Other Known Limitations](#other-known-limitations)- [Additional Information](#additional-information) - [Dataset Curators](#dataset-curators) - [Licensing Information](#licensing-information) - [Citation Information](#citation-information) - [Contributions](#contributions)
## Dataset Description
- **Homepage:** https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/Clone-detection-POJ-104
### Dataset Summary
CodeXGLUE Clone-detection-POJ-104 dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/Clone-detection-POJ-104
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.We use POJ-104 dataset on this task.
### Supported Tasks and Leaderboards
- `document-retrieval`: The dataset can be used to train a model for retrieving top-k codes with the same semantics.
### Languages
- C++ **programming** language
## Dataset Structure
### Data Instances
An example of 'train' looks as follows.```{ "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 }", "id": 0, "label": "home"}```
### Data Fields
In the following each data field in go is explained for each config. The data fields are the same among all splits.
#### default
|field name| type | description ||----------|------|----------------------------------------------||id |int32 | Index of the sample ||code |string| The full text of the function ||label |string| The id of problem that the source code solves|
### Data Splits
| name |train|validation|test ||-------|----:|---------:|----:||default|32000| 8000|12000|
## Dataset Creation
### Curation Rationale
[More Information Needed]
### Source Data
#### Initial Data Collection and Normalization
[More Information Needed]
#### Who are the source language producers?
[More Information Needed]
### Annotations
#### Annotation process
[More Information Needed]
#### Who are the annotators?
[More Information Needed]
### Personal and Sensitive Information
[More Information Needed]
## Considerations for Using the Data
### Social Impact of Dataset
[More Information Needed]
### Discussion of Biases
[More Information Needed]
### Other Known Limitations
[More Information Needed]
## Additional Information
### Dataset Curators
https://github.com/microsoft, https://github.com/madlag
### Licensing Information
Computational Use of Data Agreement (C-UDA) License.
### Citation Information
```@inproceedings{mou2016convolutional, title={Convolutional neural networks over tree structures for programming language processing}, author={Mou, Lili and Li, Ge and Zhang, Lu and Wang, Tao and Jin, Zhi}, booktitle={Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence}, pages={1287--1293}, year={2016}}```
### Contributions
Thanks to @madlag (and partly also @ncoop57) for adding this dataset.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687import osimport os.pathfrom typing import List
import datasets
from .common import TrainValidTestChildfrom .generated_definitions import DEFINITIONS
_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.We use POJ-104 dataset on this task."""
_CITATION = """@inproceedings{mou2016convolutional,title={Convolutional neural networks over tree structures for programming language processing},author={Mou, Lili and Li, Ge and Zhang, Lu and Wang, Tao and Jin, Zhi},booktitle={Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence},pages={1287--1293},year={2016}}"""
class CodeXGlueCcCloneDetectionPoj104Impl(TrainValidTestChild): _DESCRIPTION = _DESCRIPTION _CITATION = _CITATION
_FEATURES = { "id": datasets.Value("int32"), # Index of the sample "code": datasets.Value("string"), # The full text of the function "label": datasets.Value("string"), # The id of problem that the source code solves }
_SUPERVISED_KEYS = ["label"]
SPLIT_RANGES = {"train": (1, 65), "valid": (65, 81), "test": (81, 195)}
def generate_urls(self, split_name): yield "data", "programs.tar.gz"
def _generate_examples(self, split_name, file_paths): def files(path): g = os.walk(path) file = [] for path, dir_list, file_list in g: for file_name in file_list: file.append(os.path.join(path, file_name)) return file
root_path = file_paths["data"] cont = 0 for i in range(*self.SPLIT_RANGES[split_name]): items = files(os.path.join(root_path, "ProgramData/{}".format(i))) for item in items: js = {} js["label"] = item.split("/")[1] js["id"] = cont js["code"] = open(item, encoding="latin-1").read() yield cont, js cont += 1
CLASS_MAPPING = { "CodeXGlueCcCloneDetectionPoj104": CodeXGlueCcCloneDetectionPoj104Impl,}
class CodeXGlueCcCloneDetectionPoj104(datasets.GeneratorBasedBuilder): BUILDER_CONFIG_CLASS = datasets.BuilderConfig BUILDER_CONFIGS = [ datasets.BuilderConfig(name=name, description=info["description"]) for name, info in DEFINITIONS.items() ]
def _info(self): name = self.config.name info = DEFINITIONS[name] if info["class_name"] in CLASS_MAPPING: self.child = CLASS_MAPPING[info["class_name"]](info) else: raise RuntimeError(f"Unknown python class for dataset configuration {name}") ret = self.child._info() return ret
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]: return self.child._split_generators(dl_manager=dl_manager)
def _generate_examples(self, split_name, file_paths): return self.child._generate_examples(split_name, file_paths)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475from typing import List
import datasets
# Citation, taken from https://github.com/microsoft/CodeXGLUE_DEFAULT_CITATION = """@article{CodeXGLUE, title={CodeXGLUE: A Benchmark Dataset and Open Challenge for Code Intelligence}, year={2020},}"""
class Child: _DESCRIPTION = None _FEATURES = None _CITATION = None SPLITS = {"train": datasets.Split.TRAIN} _SUPERVISED_KEYS = None
def __init__(self, info): self.info = info
def homepage(self): return self.info["project_url"]
def _info(self): # This is the description that will appear on the datasets page. return datasets.DatasetInfo( description=self.info["description"] + "\n\n" + self._DESCRIPTION, features=datasets.Features(self._FEATURES), homepage=self.homepage(), citation=self._CITATION or _DEFAULT_CITATION, supervised_keys=self._SUPERVISED_KEYS, )
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]: SPLITS = self.SPLITS _URL = self.info["raw_url"] urls_to_download = {} for split in SPLITS: if split not in urls_to_download: urls_to_download[split] = {}
for key, url in self.generate_urls(split): if not url.startswith("http"): url = _URL + "/" + url urls_to_download[split][key] = url
downloaded_files = {} for k, v in urls_to_download.items(): downloaded_files[k] = dl_manager.download_and_extract(v)
return [ datasets.SplitGenerator( name=SPLITS[k], gen_kwargs={"split_name": k, "file_paths": downloaded_files[k]}, ) for k in SPLITS ]
def check_empty(self, entries): all_empty = all([v == "" for v in entries.values()]) all_non_empty = all([v != "" for v in entries.values()])
if not all_non_empty and not all_empty: raise RuntimeError("Parallel data files should have the same number of lines.")
return all_empty
class TrainValidTestChild(Child): SPLITS = { "train": datasets.Split.TRAIN, "valid": datasets.Split.VALIDATION, "test": datasets.Split.TEST, }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}}123version https://git-lfs.github.com/spec/v1oid sha256:829541e228b4c3cc9661425a32df14141be42f3cd2e794757fbaa5eefdcf609dsize 2918123456789101112DEFINITIONS = { "default": { "class_name": "CodeXGlueCcCloneDetectionPoj104", "dataset_type": "Code-Code", "description": "CodeXGLUE Clone-detection-POJ-104 dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/Clone-detection-POJ-104", "dir_name": "Clone-detection-POJ-104", "name": "default", "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Code-Code/Clone-detection-POJ-104", "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Code-Code/Clone-detection-POJ-104/dataset", "sizes": {"test": 12000, "train": 32000, "validation": 8000}, }}.gitattributesAdded+27
README.mdAdded+165
code_x_glue_cc_clone_detection_poj104.pyAdded+87
common.pyAdded+75
dataset_infos.jsonAdded+1
dummy/default/0.0.0/dummy_data.zipAdded+3
generated_definitions.pyAdded+12