mvasiliniuc commited on
Commit
8ac45cb
·
1 Parent(s): 1534057

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +119 -17
README.md CHANGED
@@ -1,5 +1,6 @@
1
  ---
2
- annotations_creators: []
 
3
  license: other
4
  language_creators:
5
  - crowdsourced
@@ -8,58 +9,159 @@ language:
8
  task_categories:
9
  - text-generation
10
  tags:
11
- - code
12
  size_categories:
13
- - unknown
14
  source_datasets: []
15
- pretty_name: iva-swift-raw
16
  task_ids:
17
  - language-modeling
18
  ---
19
 
20
- # GitHub Swift Code Dataset
21
 
22
  ## Dataset Description
23
- Soon...
 
 
 
 
 
24
 
25
  ### How to use it
26
- Soon...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  ## Data Structure
29
- Soon...
30
 
31
  ### Data Fields
32
 
33
  |Field|Type|Description|
34
  |---|---|---|
35
  |repo_name|string|name of the GitHub repository|
36
- |path|string|path of file in GitHub repository|
37
  |copies|string|number of occurrences in dataset|
38
  |code|string|content of source file|
39
- |size|int|size of source file in bytes|
40
  |license|string|license of GitHub repository|
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  ## Languages
43
 
44
- The dataset contains 30 programming languages with over 60 extensions:
45
 
46
- ```python
47
  {
48
  "Swift": [".swift"]
49
  }
50
  ```
51
 
52
  ## Licenses
53
- Soon...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  ## Dataset Statistics
56
- Soon...
 
 
 
 
 
 
 
 
57
 
58
  ## Dataset Creation
59
 
60
- The dataset was created in the following steps:
61
- 1. Files of with the extensions given in the list above were retrieved from the GitHub dataset on BigQuery. TODO: Link to query and date.
62
- 2. TODO: Add curating steps
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  ## Considerations for Using the Data
65
 
 
1
  ---
2
+ annotations_creators:
3
+ - crowdsourced
4
  license: other
5
  language_creators:
6
  - crowdsourced
 
9
  task_categories:
10
  - text-generation
11
  tags:
12
+ - code, swift, native iOS development
13
  size_categories:
14
+ - 100K<n<1M
15
  source_datasets: []
16
+ pretty_name: iva-swift-codeint-raw
17
  task_ids:
18
  - language-modeling
19
  ---
20
 
21
+ # IVA Swift GitHub Code Dataset
22
 
23
  ## Dataset Description
24
+
25
+ This is the raw IVA Swift dataset extracted from GitHub.
26
+ It contains uncurated Swift files gathered with the purpose to train a code generation model.
27
+
28
+ The dataset consists of 753693 swift code files from GitHub totaling ~700MB of data.
29
+ The dataset was created from the public GitHub dataset on Google BiqQuery.
30
 
31
  ### How to use it
32
+
33
+ To download the full dataset:
34
+
35
+ ```python
36
+ from datasets import load_dataset
37
+ dataset = load_dataset('mvasiliniuc/iva-swift-codeint', split='train')
38
+ ```
39
+
40
+ ```python
41
+
42
+ from datasets import load_dataset
43
+ dataset = load_dataset('mvasiliniuc/iva-swift-codeint', split='train')
44
+ print(dataset[77723])
45
+
46
+ #OUTPUT:
47
+ {
48
+ "repo_name":"simpleandpretty/decider-ios",
49
+ "path":"MessagesExtension/MediaResources.swift",
50
+ "copies":"1",
51
+ "size":"1232",
52
+ "content":"import Foundation\nimport UIKit\n\nclass MediaResources {\n\n static func mediaURL(forGameOption option:FightMove) -> URL {\n let bundle = Bundle.main\n guard\n let mediaURL = bundle.url(forResource: option.rawValue, withExtension: \"mp4\")\n ...",
53
+ "license":"gpl-3.0"
54
+ }
55
+ ```
56
 
57
  ## Data Structure
 
58
 
59
  ### Data Fields
60
 
61
  |Field|Type|Description|
62
  |---|---|---|
63
  |repo_name|string|name of the GitHub repository|
64
+ |path|string|path of the file in GitHub repository|
65
  |copies|string|number of occurrences in dataset|
66
  |code|string|content of source file|
67
+ |size|string|size of the source file in bytes|
68
  |license|string|license of GitHub repository|
69
 
70
+ ### Instance
71
+
72
+ ```json
73
+ {
74
+ "repo_name":"simpleandpretty/decider-ios",
75
+ "path":"MessagesExtension/MediaResources.swift",
76
+ "copies":"1",
77
+ "size":"1232",
78
+ "content":"import Foundation\nimport UIKit\n\nclass MediaResources {\n\n static func mediaURL(forGameOption option:FightMove) -> URL {\n let bundle = Bundle.main\n guard\n let mediaURL = bundle.url(forResource: option.rawValue, withExtension: \"mp4\")\n ...",
79
+ "license":"gpl-3.0"
80
+ }
81
+ ```
82
+
83
  ## Languages
84
 
85
+ The dataset contains only Swift files.
86
 
87
+ ```json
88
  {
89
  "Swift": [".swift"]
90
  }
91
  ```
92
 
93
  ## Licenses
94
+
95
+ Each entry in the dataset contains the associated license. The following is a list of licenses involved and their occurrences.
96
+
97
+ ```json
98
+ {
99
+ "agpl-3.0": 2775,
100
+ "apache-2.0": 180178,
101
+ "artistic-2.0": 314,
102
+ "bsd-2-clause": 5342,
103
+ "bsd-3-clause": 11429,
104
+ "cc0-1.0": 2718,
105
+ "epl-1.0": 980,
106
+ "gpl-2.0": 15751,
107
+ "gpl-3.0": 33074,
108
+ "isc": 1647,
109
+ "lgpl-2.1": 1741,
110
+ "lgpl-3.0": 6150,
111
+ "mit": 476518,
112
+ "mpl-2.0": 11799,
113
+ "unlicense": 3277
114
+ }
115
+ ```
116
 
117
  ## Dataset Statistics
118
+
119
+ ```json
120
+ {
121
+ "Total size": "~712 MB",
122
+ "Number of files": 753693,
123
+ "Number of files under 500 bytes": 129827,
124
+ "Average file size in bytes": 4245,
125
+ }
126
+ ```
127
 
128
  ## Dataset Creation
129
 
130
+ The dataset was created using Google Query for Github:
131
+ https://cloud.google.com/blog/topics/public-datasets/github-on-bigquery-analyze-all-the-open-source-code
132
+
133
+ The following steps were pursued for data
134
+ gathering:
135
+ 1. Creation of a dataset and a table in Google Big Query Project.
136
+ 2. Creation of a bucket in Google Cloud Storage.
137
+ 3. Creation of a query in Google Big Query Project.
138
+ 4. Running the query with the setting to output the results in the dataset and table
139
+ created at step one.
140
+ 5. Exporting the resulting dataset into the bucket created in step 2. Export format of JSON with gzip compression.
141
+
142
+ The result of these steps leads to the following results:
143
+ • 2.7 TB Processed,
144
+ • number of extracted rows/Swift files was 464,215
145
+ • total logical bytes 1.46 GB.
146
+ • The result amounts to 7 json.gz files in a total of 700 MB
147
+
148
+ The SQL Query used is:
149
+ ```sql
150
+ SELECT
151
+ f.repo_name, f.path, c.copies, c.size, c.content, l.license
152
+ FROM
153
+ (select f.*, row_number() over (partition by id order by path desc) as seqnum from `bigquery-public-data.github_repos.files` AS f) f
154
+ JOIN
155
+ `bigquery-public-data.github_repos.contents` AS c
156
+ ON
157
+ f.id = c.id AND seqnum=1
158
+ JOIN
159
+ `bigquery-public-data.github_repos.licenses` AS l
160
+ ON
161
+ f.repo_name = l.repo_name
162
+ WHERE
163
+ NOT c.binary AND ((f.path LIKE '%.kt') AND (c.size BETWEEN 0 AND 1048575))
164
+ ```
165
 
166
  ## Considerations for Using the Data
167