atlas-preprocessed-code / atlas-preprocessed-code.py
AtlasUnified's picture
Upload atlas-preprocessed-code.py
5653fa3
raw
history blame
1.94 kB
from datasets import GeneratorBasedBuilder, BuilderConfig, Version, load_dataset
_DESCRIPTION = 'Dataset for {0} repositories...'
_CITATION = '...'
class RepositoryConfig(BuilderConfig):
"""BuilderConfig for Repository."""
def __init__(self, language, features, data_url, citation, url, **kwargs):
"""
Args:
language: name of the programming language
features: list of the features that will appear in the feature dict. Should not include "label".
data_url: url to download the zip file from.
citation: citation for the data set.
url: url for information about the data set.
**kwargs: keyword arguments forwarded to super.
"""
super().__init__(version=Version("1.0.0"), **kwargs)
self.language = language
self.features = features
self.data_url = data_url
self.citation = citation
self.url = url
class Repository(GeneratorBasedBuilder):
"""The Repository benchmark."""
LANGUAGES = [
'C#', 'C++', 'C', 'Go', 'HTML', 'Haskell', 'Java', 'JavaScript',
'Jupyter', 'Kotlin', 'PHP', 'Perl', 'Python', 'Ruby', 'Rust',
'Shell', 'Swift', 'TypeScript', 'V'
]
BUILDER_CONFIGS = [
RepositoryConfig(
name=lang.lower().replace('+', 'p').replace('#', 'sharp'),
description=_DESCRIPTION.format(lang),
language=lang,
features=["repo_name", "repo_creator", "programming_language", "code", "num_lines"],
data_url=f"https://example.com/data/{lang.lower().replace('+', 'p').replace('#', 'sharp')}.zip",
citation=_CITATION,
url=f"https://example.com/{lang.lower().replace('+', 'p').replace('#', 'sharp')}_dataset",
) for lang in LANGUAGES
]
# load a specific configuration of the dataset with the configuration name
dataset = load_dataset('repository', 'python')