--- license: other license_name: mixed-permissive license_details: >- Same terms as josh-hud/code-pii: each record keeps the license of its base file (MIT, Apache-2.0, BSD-2/3-Clause, ISC, Unlicense or CC0-1.0) as redistributed by codeparrot/github-code-clean. Generator code Apache-2.0. task_categories: - token-classification language: - code - en tags: - secrets-detection - credential-detection - pii - code - synthetic - span-labels - coreference - anonymization - preview pretty_name: code-pii preview (36% cluster-preserving sample of code-pii v3) size_categories: - 1M=1 span | 1,256,231 (66.1%) | 3,491,739 (66.2%) | 0.360 | | labeled spans | 2,853,437 | 7,936,370 | 0.360 | | hard-negative spans | 1,781,642 | 4,950,684 | 0.360 | | Parquet bytes | 4,284,943,933 | 11,915,030,320 | 0.360 | Labels: `api_key` 37.1%, `password` 17.9%, `token` 13.1%, `email` 11.8%, `private_key` 8.0%, `person_name` 7.3%, `username` 4.7%. ## Schema Each record includes the v2 fields plus `cluster_id`, `cluster_kind`, `cluster_size`, `doc_index`, and an embedded `entities` table on `doc_index == 0`. Each positive span adds `entity_id`, `surface_form_type`, and a gold `replacement`. Spans sharing an `entity_id` across files are the same entity and must receive consistent replacements. Full field documentation is in the [parent data dictionary](https://huggingface.co/datasets/josh-hud/code-pii/blob/main/DATA_DICTIONARY.md). ## Loading ```python from datasets import load_dataset ds = load_dataset("josh-hud/code-pii-preview", split="train") # or streaming=True rec = ds[0] for s in rec["spans"]: assert rec["text"][s["start"]:s["end"]] == s["value"] ``` The parent generator's `validate.py` reports zero offset, entity, replacement, ownership, contiguity, collision or format problems on the regenerated v3 data. Use the parent's `eval_creddata.jsonl` for real-code detection evaluation; use held-out synthetic clusters for coreference and exact anonymization evaluation. ## Caveats All parent caveats apply: injected-line placement artifacts; unlabeled real secrets, emails and names in the base corpus; unrelated files in `bundle` clusters; literal rather than indirect cross-file recurrence; and a Java/JavaScript/HTML-heavy language mix.