nirjas-dataset / README.md
rycerzes's picture
Upload README.md with huggingface_hub
98011c4 verified
|
Raw
History Blame Contribute Delete
3.58 kB
---
language:
- en
license: apache-2.0
task_categories:
- text-classification
tags:
- license-detection
- fossology
- nirjas
- binary-classification
- code
- legal
pretty_name: Nirjas Gate Dataset
size_categories:
- 10K<n<100K
---
# Nirjas Gate Dataset
Binary classification dataset for the **Nirjas gate** — a recall-first classifier that answers:
*"Is this text actual license text worth routing to Atarashi for identification?"*
This is a narrow gate, not a broad "license-related" detector. Its job is to route actual license
bodies (MIT text, GPL headers, Apache notices) to Atarashi while correctly rejecting license
references ("see LICENSE file"), copyright notices, code comments, and package metadata.
## Dataset Summary
| split | total | license_related | not_license_related |
|---|---|---|---|
| train | 55,610 | 30,232 | 25,378 |
| validation | 6,877 | 3,707 | 3,170 |
| test | 6,895 | 3,770 | 3,125 |
Splits are **content-hash frozen** — each text always lands in the same split regardless of
dataset rebuilds, so benchmark deltas are real and duplicates cannot leak across train/test.
## Dataset Structure
### Columns
- `text` — the text fragment (license body, code comment, legal notice, etc.)
- `label` — `0 = license_related`, `1 = not_license_related` (ClassLabel)
- `source` — origin: `scancode`, `fossology`, `generated`, `synthetic`, `shortform`, `augmented`, `code_corpus`
- `negative_type` — for negatives: `generic_code_comment`, `same_register_notice`, `license_discussion`, `copyright_discussion`, `todo_fixme`, `commented_code`
### Label Convention
| label | int | meaning |
|---|---|---|
| `license_related` | 0 | actual license text — route to Atarashi |
| `not_license_related` | 1 | everything else — discard |
### Positive sources (train)
| source | count |
|---|---|
| scancode (ScanCode LicenseDB) | 18,931 |
| shortform (SPDX identifiers + snippets) | 4,820 |
| synthetic/rare (LLM-augmented) | 4,262 |
| fossology (licenseRef.json) | 1,681 |
| augmented | 538 |
### Negative types (train)
| type | count | description |
|---|---|---|
| `generic_code_comment` | 6,324 | real source comments from the-stack-smol |
| `same_register_notice` | 5,177 | boilerplate legal-register non-licenses |
| `todo_fixme` | 4,264 | TODO/FIXME/HACK comments |
| `license_discussion` | 4,232 | commentary about licenses, not license text |
| `copyright_discussion` | 2,769 | copyright attribution, not license grants |
| `commented_code` | 2,612 | commented-out source code |
## Usage
```python
from datasets import load_dataset
ds = load_dataset("rycerzes/nirjas-dataset")
train = ds["train"]
```
## Deployed Gate
The deployed model is `potion-base-32M` (`StaticModelForClassification`) at threshold **0.20**
(recall-first, NOT argmax). At this threshold:
| metric | synthetic test set | real corpus (the-stack-smol + ScanCode, n=600) |
|---|---|---|
| License recall | 0.9952 | 1.0000 |
| FPR | 0.0227 | 0.0133 |
## Generation Pipeline
Built by [`minerva-dataset-pipeline`](https://github.com/fossology/Minerva-Dataset-Generation/pull/6):
1. Fetch license texts from ScanCode LicenseDB + FOSSology licenseRef.json
2. Sliding-window split with junk-fragment filtering
3. LLM-assisted augmentation for rare licenses
4. Hard negative generation (LLM + template-based)
5. Content-hash frozen train/val/test split
6. Class balancing
## Downstream Task
Part of the [FOSSology Nirjas](https://github.com/fossology/Nirjas) ML pipeline:
```
source file → Nirjas gate → [license_related] → Atarashi (which license?)
```