File size: 5,228 Bytes
b1dbcfb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# code_search_net_java_permissive — CodeSearchNet Java (permissive only)

Added: 2026-12-05. Release: `None` (working copy, not a release).

## What the data is

Function-level Java source with its docstring, restricted to repositories whose
audited licence is permissive.

| | |
|---|---|
| Rows (functions) | **334,367** |
| Repositories | **3,880** |
| Characters (`text`) | **299,132,516** |
| Tokens, tiktoken `cl100k_base` | **63,689,933** |
| Parquet | **163,300,781 bytes** (zstd), 20 columns |
| Splits | train 303,622 · validation 12,828 · test 17,917 |
| Language | Java (code) + English (docstrings) |
| Not OCR, not translated | yes |

`text` = docstring + `\n\n` + code. `id` is
`sha1(repo|path|func_name|sha256(code))[:24]` and is unique. `record_sha256` is
the canonical SHA-256 of the row and ships in the parquet.

## Where it comes from

- Upstream: [`code-search-net/code_search_net`](https://huggingface.co/datasets/code-search-net/code_search_net),
  `java` configuration, revision `bd0cf261e357a3eb5c8fba490d23ec1a1cd59555`
  (2026-02-23).
- Derived from the open-licence build
  [`PiotrSty/code-search-net-java`](https://huggingface.co/datasets/PiotrSty/code-search-net-java),
  which itself is the concatenation of the three official Java shards.
- No intermediary snapshot beyond the official HF dataset; no GitHub scraping
  of file contents (only the licence API was queried).

## Composition

Licences (rows), from a per-repo audit against the GitHub licence API
(`/repos/{owner}/{repo}/license`, 2026-12-05):

| SPDX | rows | % |
|---|---:|---:|
| Apache-2.0 | 264,874 | 79.2% |
| MIT | 52,732 | 15.8% |
| BSD-3-Clause | 10,322 | 3.1% |
| BSD-2-Clause | 5,480 | 1.6% |
| ISC | 772 | 0.2% |
| Zlib | 117 | 0.0% |
| WTFPL | 57 | 0.0% |
| Artistic-2.0 | 13 | 0.0% |

Audit coverage: 4,769 repositories queried; 4,483 returned a licence, 285 had
no LICENSE file, 1 failed (HTTP 502). Repositories with a permissive licence:
3,880.

Largest repositories by rows: `aws/aws-sdk-java` 22,028 ·
`Azure/azure-sdk-for-java` 10,240 · `facebookarchive/hadoop-20` 3,979 ·
`apache/flink` 3,515 · `deeplearning4j/deeplearning4j` 3,047 ·
`yan74/afplib` 2,781 · `googleapis/google-cloud-java` 2,751 ·
`netscaler/nitro` 2,603 · `oblac/jodd` 2,177 · `google/closure-compiler` 2,079.

Row length (`token_count`): min 22 · mean 190.5 · max 65,834. Docstrings are
non-empty for 334,367 / 334,367 rows.

## Schema

```
id, repo, path, func_name, url, split, language, docstring, code, text,
token_count, doc_chars, code_chars, license_basis, source, added,
record_sha256, license, license_class, license_source
```

## Collection, normalization, filtering

Committed scripts: `build_csn_java.py` (shards → records), `audit_licenses.py`
(GitHub licence API), `apply_licenses.py` (join), `filter_open.py` (drop
NOASSERTION/unknown), `filter_permissive.py` (this subset), `finalize_permissive.py`.

- Code ≥ 20 chars; text ≥ 100 chars.
- Exact-code SHA-256 dedup (global).
- Drop rows whose repository has no detected open licence (`NOASSERTION`,
  `unknown`): 47,818 rows / 355 repositories.
- Keep only `license_class == "permissive"`: removes 114,492 weak/strong/other
  copyleft rows. Total removed from the 496,677 audited rows: 162,310.
- No text rewriting beyond stripping; no PII scrubbing (see Not checked).

## Rights

- Every retained row has an audited permissive SPDX licence in `license` and a
  `license_source` URL; `license_class == "permissive"`.
- No copyleft (LGPL/EPL/GPL/AGPL) and no `NOASSERTION`/`unknown` rows.
- Permissive is not obligation-free: Apache-2.0 requires NOTICE/attribution and
  preservation of notices; MIT/BSD require the copyright notice. The parquet
  carries `repo` and `url` for attribution, but **does not bundle licence
  texts or NOTICE files**.
- Repo-level licence is not file-level: a repository may vendor or generate
  files under other terms; GitHub's detection reports the repository licence
  only.

## Why include it / uses

A licence-clean, function-level Java corpus with docstrings for code LLM
pretraining/SFT, code–documentation retrieval, and function-level generation or
summarisation. The permissive-only slice removes copyleft obligations for
downstream redistribution.

## Limitations

- Function-level only: no repository context, imports, or call graph.
- Licence state is a 2026-12-05 GitHub snapshot; repos can relicense later.
- The permissive subset is dominated by Apache-2.0 (79%) and large SDK repos
  (`aws/aws-sdk-java`, `Azure/azure-sdk-for-java`), so domain balance is skewed.
- Docstrings are upstream quality, sometimes terse or duplicated across
  overloads.

## Not checked

- PII in code or docstrings (author names, emails, keys): **no scrubber was run;
  SlayerLab/NERGAL not applied**.
- Whether GitHub's LICENSE-file detection matches actual terms.
- Vendored/generated files inside repos that may carry other licences.
- Cross-corpus dedup against other code corpora.
- Preservation of Apache NOTICE / BSD-MIT copyright notices in downstream use.

## Reproduce

```bash
# from the open-licence build's parquet
python filter_permissive.py
python finalize_permissive.py   # README, manifest, checksums, upload
```