Commit
·
6fce381
1
Parent(s):
effe920
Create atlas-preprocessed-code.py
Browse files- atlas-preprocessed-code.py +33 -0
atlas-preprocessed-code.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datasets import GeneratorBasedBuilder, BuilderConfig, Version, load_dataset
|
| 2 |
+
|
| 3 |
+
_LANGUAGES = ["C#", "C++", "C", "Go", "HTML", "Haskell", "Java", "JavaScript", "Jupyter",
|
| 4 |
+
"Kotlin", "PHP", "Perl", "Python", "Ruby", "Rust", "Shell", "Swift", "TypeScript", "V"]
|
| 5 |
+
|
| 6 |
+
class RepoConfig(BuilderConfig):
|
| 7 |
+
"""BuilderConfig for Repository."""
|
| 8 |
+
|
| 9 |
+
def __init__(self, language, **kwargs):
|
| 10 |
+
"""
|
| 11 |
+
Args:
|
| 12 |
+
language: the programming language of the repository
|
| 13 |
+
**kwargs: keyword arguments forwarded to super.
|
| 14 |
+
"""
|
| 15 |
+
super().__init__(**kwargs)
|
| 16 |
+
self.language = language
|
| 17 |
+
|
| 18 |
+
class Repository(GeneratorBasedBuilder):
|
| 19 |
+
"""The Repository benchmark."""
|
| 20 |
+
|
| 21 |
+
BUILDER_CONFIGS = [
|
| 22 |
+
RepoConfig(
|
| 23 |
+
name=lang.lower(),
|
| 24 |
+
version=Version("1.0.0"),
|
| 25 |
+
language=lang,
|
| 26 |
+
description=f"Repository of {lang} programs",
|
| 27 |
+
)
|
| 28 |
+
for lang in _LANGUAGES
|
| 29 |
+
]
|
| 30 |
+
|
| 31 |
+
# to load a specific configuration of the dataset with the configuration name
|
| 32 |
+
# replace 'csharp' with the desired language
|
| 33 |
+
dataset = load_dataset('repository', 'csharp')
|