PiotrSty's picture
CodeSearchNet Java permissive-only: 334,367 rows
b1dbcfb verified
|
Raw History Blame Contribute Delete
5.23 kB
# 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
```