AtlasUnified commited on
Commit
2140794
·
1 Parent(s): 4bcc34a

Create atlas-preprocessed-code.py

Browse files
Files changed (1) hide show
  1. atlas-preprocessed-code.py +32 -0
atlas-preprocessed-code.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datasets import GeneratorBasedBuilder, BuilderConfig, Version, load_dataset
2
+
3
+ class RepositoryConfig(BuilderConfig):
4
+ """BuilderConfig for Repository."""
5
+
6
+ def __init__(self, language, features, citation, url, **kwargs):
7
+ super().__init__(name=language, version=Version("1.0.0"), **kwargs)
8
+ self.features = features
9
+ self.data_url = f"https://huggingface.co/datasets/AtlasUnified/atlas-preprocessed-code/blob/main/{language.lower()}.jsonl"
10
+ self.citation = citation
11
+ self.url = url
12
+
13
+
14
+ class Repository(GeneratorBasedBuilder):
15
+ """The Repository dataset."""
16
+
17
+ languages = ['C#', 'C++', 'C', 'Go', 'HTML', 'Haskell', 'Java', 'JavaScript',
18
+ 'Jupyter', 'Kotlin', 'PHP', 'Perl', 'Python', 'Ruby', 'Rust', 'Shell',
19
+ 'Swift', 'TypeScript', 'V']
20
+
21
+ BUILDER_CONFIGS = [
22
+ RepositoryConfig(
23
+ language=language,
24
+ features=["repo_name", "repo_creator", "programming_language", "code", "num_lines"],
25
+ citation="Please insert citation here",
26
+ url=f"https://huggingface.co/datasets/AtlasUnified/atlas-preprocessed-code/blob/main/{language.lower()}.jsonl",
27
+ ) for language in languages
28
+ ]
29
+
30
+
31
+ # load a specific configuration of the dataset with the configuration name
32
+ dataset = load_dataset('repository', 'C#')