Datasets:
Tasks:
Translation
Modalities:
Text
Formats:
parquet
Size:
100K - 1M
ArXiv:
Tags:
text-to-code
License:
Commit ·
4d2468a
1
Parent(s): 45c1f2e
Update parquet files
Browse filesFiles changed (9)
- .gitattributesDeleted-27
- README.mdDeleted-186
- code_x_glue_tc_text_to_code.pyDeleted-69
- common.pyDeleted-75
- dataset_infos.jsonDeleted-1
- default/code_x_glue_tc_text_to_code-test.parquetAdded+3
- default/code_x_glue_tc_text_to_code-train.parquetAdded+3
- default/code_x_glue_tc_text_to_code-validation.parquetAdded+3
- generated_definitions.pyDeleted-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 -text123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186---annotations_creators:- foundlanguage_creators:- foundlanguage:- code- enlicense:- c-udamultilinguality:- other-programming-languagessize_categories:- 100K<n<1Msource_datasets:- originaltask_categories:- translationtask_ids: []pretty_name: CodeXGlueTcTextToCodetags:- text-to-codedataset_info: features: - name: id dtype: int32 - name: nl dtype: string - name: code dtype: string splits: - name: train num_bytes: 96225611 num_examples: 100000 - name: validation num_bytes: 1749751 num_examples: 2000 - name: test num_bytes: 1609306 num_examples: 2000 download_size: 100769638 dataset_size: 99584668---# Dataset Card for "code_x_glue_tc_text_to_code"
## 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/Text-Code/text-to-code
### Dataset Summary
CodeXGLUE text-to-code dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Text-Code/text-to-code
The dataset we use is crawled and filtered from Microsoft Documentation, whose document located at https://github.com/MicrosoftDocs/.
### Supported Tasks and Leaderboards
- `machine-translation`: The dataset can be used to train a model for generating Java code from an **English** natural language description.
### Languages
- Java **programming** language
## Dataset Structure
### Data Instances
An example of 'train' looks as follows.```{ "code": "boolean function ( ) { return isParsed ; }", "id": 0, "nl": "check if details are parsed . concode_field_sep Container parent concode_elem_sep boolean isParsed concode_elem_sep long offset concode_elem_sep long contentStartPosition concode_elem_sep ByteBuffer deadBytes concode_elem_sep boolean isRead concode_elem_sep long memMapSize concode_elem_sep Logger LOG concode_elem_sep byte[] userType concode_elem_sep String type concode_elem_sep ByteBuffer content concode_elem_sep FileChannel fileChannel concode_field_sep Container getParent concode_elem_sep byte[] getUserType concode_elem_sep void readContent concode_elem_sep long getOffset concode_elem_sep long getContentSize concode_elem_sep void getContent concode_elem_sep void setDeadBytes concode_elem_sep void parse concode_elem_sep void getHeader concode_elem_sep long getSize concode_elem_sep void parseDetails concode_elem_sep String getType concode_elem_sep void _parseDetails concode_elem_sep String getPath concode_elem_sep boolean verify concode_elem_sep void setParent concode_elem_sep void getBox concode_elem_sep boolean isSmallBox"}```
### 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 ||nl |string| The natural language description of the task||code |string| The programming source code for the task |
### Data Splits
| name |train |validation|test||-------|-----:|---------:|---:||default|100000| 2000|2000|
## 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
```@article{iyer2018mapping, title={Mapping language to code in programmatic context}, author={Iyer, Srinivasan and Konstas, Ioannis and Cheung, Alvin and Zettlemoyer, Luke}, journal={arXiv preprint arXiv:1808.09588}, year={2018}}```
### Contributions
Thanks to @madlag (and partly also @ncoop57) for adding this dataset.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869import jsonfrom typing import List
import datasets
from .common import Childfrom .generated_definitions import DEFINITIONS
_DESCRIPTION = """We use concode dataset which is a widely used code generation dataset from Iyer's EMNLP 2018 paper Mapping Language to Code in Programmatic Context. See paper for details."""_CITATION = """@article{iyer2018mapping,title={Mapping language to code in programmatic context},author={Iyer, Srinivasan and Konstas, Ioannis and Cheung, Alvin and Zettlemoyer, Luke},journal={arXiv preprint arXiv:1808.09588},year={2018}}"""
class CodeXGlueTcTextToCodeImpl(Child): _DESCRIPTION = _DESCRIPTION _CITATION = _CITATION
_FEATURES = { "id": datasets.Value("int32"), # Index of the sample "nl": datasets.Value("string"), # The natural language description of the task "code": datasets.Value("string"), # The programming source code for the task }
_SUPERVISED_KEYS = ["code"]
SPLITS = {"train": datasets.Split.TRAIN, "dev": datasets.Split.VALIDATION, "test": datasets.Split.TEST}
def generate_urls(self, split_name): yield "data", f"concode/{split_name}.json"
def _generate_examples(self, split_name, file_paths): with open(file_paths["data"], encoding="utf-8") as f: for idx, line in enumerate(f): entry = json.loads(line) entry["id"] = idx yield idx, entry
CLASS_MAPPING = { "CodeXGlueTcTextToCode": CodeXGlueTcTextToCodeImpl,}
class CodeXGlueTcTextToCode(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 text-to-code dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Text-Code/text-to-code\n\nWe use concode dataset which is a widely used code generation dataset from Iyer's EMNLP 2018 paper Mapping Language to Code in Programmatic Context. See paper for details.", "citation": "@article{iyer2018mapping,\ntitle={Mapping language to code in programmatic context},\nauthor={Iyer, Srinivasan and Konstas, Ioannis and Cheung, Alvin and Zettlemoyer, Luke},\njournal={arXiv preprint arXiv:1808.09588},\nyear={2018}\n}", "homepage": "https://github.com/madlag/CodeXGLUE/tree/main/Text-Code/text-to-code", "license": "", "features": {"id": {"dtype": "int32", "id": null, "_type": "Value"}, "nl": {"dtype": "string", "id": null, "_type": "Value"}, "code": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": {"input": "code", "output": ""}, "task_templates": null, "builder_name": "code_x_glue_tc_text_to_code", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 96225611, "num_examples": 100000, "dataset_name": "code_x_glue_tc_text_to_code"}, "validation": {"name": "validation", "num_bytes": 1749751, "num_examples": 2000, "dataset_name": "code_x_glue_tc_text_to_code"}, "test": {"name": "test", "num_bytes": 1609306, "num_examples": 2000, "dataset_name": "code_x_glue_tc_text_to_code"}}, "download_checksums": {"https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Text-Code/text-to-code/dataset/concode/train.json": {"num_bytes": 97365680, "checksum": "a130f375c415932ffe0188e76b3c8aaef92b1b52d228e342328657b9ae97f17f"}, "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Text-Code/text-to-code/dataset/concode/dev.json": {"num_bytes": 1772646, "checksum": "cd4f91cfaa12a886a1d7acaf92eaf8ab066845c37a9221e56634d345958c922a"}, "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Text-Code/text-to-code/dataset/concode/test.json": {"num_bytes": 1631312, "checksum": "3323b1d723c2183a0ef4693413d25ef5a6b988b50b37b2f401de6c2c5c55159f"}}, "download_size": 100769638, "post_processing_size": null, "dataset_size": 99584668, "size_in_bytes": 200354306}}123version https://git-lfs.github.com/spec/v1oid sha256:6186ac91bf2e6229671120b5e98945d6dff3789fe0931e2d3e56ee90d26547f5size 526046123version https://git-lfs.github.com/spec/v1oid sha256:781fd829c48bc5b21aed5334ec66eb9270faff425d585ec858fb5488a5a70a4csize 33097825123version https://git-lfs.github.com/spec/v1oid sha256:d36db2afb242dccafdc8c5f1ee014d9656b9cf46ecf7b84e28d431b6124031bfsize 634480123456789101112DEFINITIONS = { "default": { "class_name": "CodeXGlueTcTextToCode", "dataset_type": "Text-Code", "description": "CodeXGLUE text-to-code dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Text-Code/text-to-code", "dir_name": "text-to-code", "name": "default", "project_url": "https://github.com/madlag/CodeXGLUE/tree/main/Text-Code/text-to-code", "raw_url": "https://raw.githubusercontent.com/madlag/CodeXGLUE/main/Text-Code/text-to-code/dataset", "sizes": {"test": 2000, "train": 100000, "validation": 2000}, }}.gitattributesDeleted-27
README.mdDeleted-186
code_x_glue_tc_text_to_code.pyDeleted-69
common.pyDeleted-75
dataset_infos.jsonDeleted-1
default/code_x_glue_tc_text_to_code-test.parquetAdded+3
default/code_x_glue_tc_text_to_code-train.parquetAdded+3
default/code_x_glue_tc_text_to_code-validation.parquetAdded+3
generated_definitions.pyDeleted-12