AtlasUnified commited on
Commit
5653fa3
·
1 Parent(s): 48ce789

Upload atlas-preprocessed-code.py

Browse files
Files changed (1) hide show
  1. atlas-preprocessed-code.py +48 -0
atlas-preprocessed-code.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datasets import GeneratorBasedBuilder, BuilderConfig, Version, load_dataset
2
+
3
+ _DESCRIPTION = 'Dataset for {0} repositories...'
4
+ _CITATION = '...'
5
+
6
+ class RepositoryConfig(BuilderConfig):
7
+ """BuilderConfig for Repository."""
8
+
9
+ def __init__(self, language, features, data_url, citation, url, **kwargs):
10
+ """
11
+ Args:
12
+ language: name of the programming language
13
+ features: list of the features that will appear in the feature dict. Should not include "label".
14
+ data_url: url to download the zip file from.
15
+ citation: citation for the data set.
16
+ url: url for information about the data set.
17
+ **kwargs: keyword arguments forwarded to super.
18
+ """
19
+ super().__init__(version=Version("1.0.0"), **kwargs)
20
+ self.language = language
21
+ self.features = features
22
+ self.data_url = data_url
23
+ self.citation = citation
24
+ self.url = url
25
+
26
+ class Repository(GeneratorBasedBuilder):
27
+ """The Repository benchmark."""
28
+
29
+ LANGUAGES = [
30
+ 'C#', 'C++', 'C', 'Go', 'HTML', 'Haskell', 'Java', 'JavaScript',
31
+ 'Jupyter', 'Kotlin', 'PHP', 'Perl', 'Python', 'Ruby', 'Rust',
32
+ 'Shell', 'Swift', 'TypeScript', 'V'
33
+ ]
34
+
35
+ BUILDER_CONFIGS = [
36
+ RepositoryConfig(
37
+ name=lang.lower().replace('+', 'p').replace('#', 'sharp'),
38
+ description=_DESCRIPTION.format(lang),
39
+ language=lang,
40
+ features=["repo_name", "repo_creator", "programming_language", "code", "num_lines"],
41
+ data_url=f"https://example.com/data/{lang.lower().replace('+', 'p').replace('#', 'sharp')}.zip",
42
+ citation=_CITATION,
43
+ url=f"https://example.com/{lang.lower().replace('+', 'p').replace('#', 'sharp')}_dataset",
44
+ ) for lang in LANGUAGES
45
+ ]
46
+
47
+ # load a specific configuration of the dataset with the configuration name
48
+ dataset = load_dataset('repository', 'python')