kniv-corpus-en / README.md
milliondreams's picture
Update README: gold corpus, remove GMB refs, fix folder structure
4c0fe9d verified
|
Raw
History Blame
11 kB
---
language:
- en
license: cc-by-sa-4.0
task_categories:
- token-classification
- text-classification
task_ids:
- named-entity-recognition
- part-of-speech
- parsing
tags:
- ner
- pos
- dependency-parsing
- dialog-act
- multi-task
- conllu
- spacy
- gpt-validated
- llm-gold-filtered
- knowledge-distillation
size_categories:
- 100K<n<1M
---
# kniv-corpus-en
Multi-domain NLP corpus for English with annotations for NER (18 entity types), POS tagging (17 UPOS tags), dependency parsing (dep2label), and sentence classification (9 dialog act types). Built for training [kniv](https://github.com/rustic-ai/kniv-nlp-models) multi-task NLP models for the [uniko](https://github.com/rustic-ai/uniko) cognitive memory system.
All data is commercially licensed (CC BY-SA 4.0 compatible). No CoNLL-2003, GMB, or other research-only datasets.
## Repository Structure
```
dragonscale-ai/kniv-corpus-en/
├── data/ # Full corpus Parquet (for load_dataset)
│ ├── train-00000-of-00001.parquet 525,850 sentences (127.7 MB)
│ ├── dev-00000-of-00001.parquet 65,731 sentences (13.8 MB)
│ └── test-00000-of-00001.parquet 65,732 sentences (14.0 MB)
├── corpus/
│ └── gold/ # LLM-validated gold corpus (recommended)
│ ├── train.parquet 237,646 sentences (56.8 MB)
│ ├── dev.parquet 65,731 sentences (13.8 MB)
│ ├── test.parquet 65,732 sentences (14.0 MB)
│ └── progress.json Filter progress metadata
├── train.conllu # Full corpus in CoNLL-U format (547.7 MB)
├── dev.conllu # (67.9 MB)
├── test.conllu # (68.8 MB)
├── metadata.json # Split sizes, domain list
└── README.md
```
### Full corpus vs Gold corpus
| | Full (`data/`) | Gold (`corpus/gold/`) |
|---|---|---|
| **Train sentences** | 525,850 | 237,646 |
| **Validation** | spaCy + GPT corrections | + Qwen3-8B per-example validation |
| **Checks applied** | None | NER entities, CLS labels, POS tags |
| **Recommended for** | Exploration, analysis | Model training |
The gold corpus was produced by validating every sentence with Qwen3-8B (64 concurrent requests via vLLM on A100). Each sentence passed three checks:
- **NER**: every entity span validated ("Is '{entity}' correctly tagged as {type}?")
- **CLS**: dialog act label validated with conversational context
- **POS**: up to 8 POS tags per sentence validated against Universal POS tagset
Sentences failing any check were removed. 45.2% of training data survived (237K from 525K).
## Dataset Formats
### Parquet (recommended)
Each row contains:
| Column | Type | Description |
|--------|------|-------------|
| `sent_id` | string | Unique sentence ID (`{domain}-{index}`) |
| `text` | string | The sentence text |
| `prev_text` | string (nullable) | Previous utterance in conversation (for CLS context) |
| `cls` | string | Dialog act label (one of 9 types) |
| `tokens` | list[string] | Tokenized words |
| `pos_tags` | list[string] | Universal POS tags (17 UPOS labels) |
| `heads` | list[int] | Dependency head indices (0 = root) |
| `deprels` | list[string] | Dependency relation labels |
| `ner_tags` | list[string] | BIO-tagged NER labels (18 entity types) |
### CoNLL-U
Standard [CoNLL-U format](https://universaldependencies.org/format.html) with extensions:
```
# sent_id = conversation-004217
# text = Oh, could you please change it for outside?
# prev_text = It looks like the table will be for inside.
# cls = correction
1 Oh oh INTJ UH _ 5 discourse _ _
2 , , PUNCT , _ 5 punct _ _
3 could could AUX MD _ 5 aux _ _
4 you you PRON PRP _ 5 nsubj _ _
5 please please VERB VB _ 0 root _ _
6 change change VERB VB _ 5 xcomp _ _
7 it it PRON PRP _ 6 obj _ _
8 for for ADP IN _ 9 case _ _
9 outside outside NOUN NN _ 6 obl _ _
10 ? ? PUNCT . _ 5 punct _ _
```
NER tags in MISC column: `NER=B-ORG`, `NER=I-ORG`, etc.
## Dataset Details
| | |
|---|---|
| **Total sentences** | 657,313 |
| **Gold sentences** | 237,646 |
| **NER entity types** | 18 (BIO-tagged = 37 labels) |
| **POS tags** | 17 (Universal Dependencies UPOS) |
| **Dep labels** | ~1,440 (dep2label composite tags) |
| **CLS labels** | 9 (dialog act types) |
| **Annotation** | spaCy `en_core_web_trf` + GPT-5.4-nano validation |
| **Gold filtering** | Qwen3-8B via vLLM (NER + CLS + POS) |
| **License** | CC BY-SA 4.0 |
### Domains
| Domain | Full | Gold | Sources | License |
|--------|------|------|---------|---------|
| **Business** | 197,891 | 73,525 | SEC EDGAR 10-K, Enron emails, OpenStax, Odoo docs, Wikipedia, CUAD contracts, OpenAlex | Public domain / CC BY-4.0 / CC BY-SA 3.0 / ODC-BY |
| **Technical** | 193,032 | 56,438 | Wikipedia (CS/engineering), Python docs | CC BY-SA 3.0 / PSF License |
| **Conversation** | 89,934 | 29,203 | Taskmaster 1/2/3, OASST1, MultiWOZ 2.2, Glaive, Discord Dialogues | CC BY-4.0 / Apache 2.0 / MIT |
| **Encyclopedic** | 66,490 | 29,088 | Wikipedia (science, history, geography, arts) | CC BY-SA 3.0 |
| **News** | 58,026 | 27,541 | Wikinews, Wikipedia (journalism, politics) | CC BY 2.5 / CC BY-SA 3.0 |
| **Narrative** | 51,940 | 21,851 | Project Gutenberg (classic fiction) | Public domain |
### NER Entity Types (18)
| Type | Description | Example |
|------|-------------|---------|
| PERSON | People | *Caroline*, *Dr. Smith* |
| ORG | Organizations | *Apple*, *United Nations* |
| GPE | Geopolitical entities | *France*, *New York* |
| LOC | Locations | *Mount Everest*, *Pacific Ocean* |
| DATE | Dates and periods | *January 2024*, *last quarter* |
| TIME | Times | *3pm*, *two hours* |
| MONEY | Monetary values | *$394B*, *50 million euros* |
| PERCENT | Percentages | *15.3%*, *a third* |
| QUANTITY | Measurements | *100 kilometers*, *5 pounds* |
| ORDINAL | Ordinal numbers | *first*, *3rd* |
| CARDINAL | Cardinal numbers | *three*, *42* |
| NORP | Nationalities/groups | *British*, *Republican* |
| FAC | Facilities | *the White House*, *Highway 101* |
| PRODUCT | Products | *iPhone*, *Boeing 747* |
| EVENT | Events | *World War II*, *Olympics* |
| WORK_OF_ART | Works of art | *Hamlet*, *The Starry Night* |
| LAW | Laws | *the First Amendment* |
| LANGUAGE | Languages | *English*, *Mandarin* |
### CLS Dialog Act Labels (9)
| Label | Description | Uniko action | Gold count |
|-------|-------------|-------------|------------|
| `inform` | States a fact or observation | Extract observation | 173,401 (73.0%) |
| `question` | Asks for information | Record knowledge gap | 14,979 (6.3%) |
| `plan_commit` | Commits to action, offers, suggests | Link to Goal/Task | 12,518 (5.3%) |
| `request` | Asks someone to do something | Create action node | 10,679 (4.5%) |
| `filler` | Fragments, headers, formatting | Skip entirely | 10,538 (4.4%) |
| `correction` | Corrects or contradicts prior statement | Flag for update | 7,587 (3.2%) |
| `social` | Greeting, goodbye, thanks, apology | Skip extraction | 3,111 (1.3%) |
| `agreement` | Agrees with or confirms something | Reinforce observation | 2,956 (1.2%) |
| `feedback` | Acknowledges without adding info | Skip extraction | 1,877 (0.8%) |
### dep2label Encoding
Dependency parsing reformulated as token classification using [rel-pos encoding](https://aclanthology.org/N19-1077/) (Strzyz et al., 2019):
```
+1@nsubj@VERB → "1st VERB to the right, relation=nsubj"
```
## Usage
### Load with HuggingFace Datasets
```python
from datasets import load_dataset
# Full corpus
ds = load_dataset("dragonscale-ai/kniv-corpus-en")
# Gold corpus (recommended for training)
from huggingface_hub import snapshot_download
snapshot_download(
"dragonscale-ai/kniv-corpus-en",
repo_type="dataset",
allow_patterns="corpus/gold/*",
local_dir="kniv-data",
)
import pandas as pd
gold = pd.read_parquet("kniv-data/corpus/gold/train.parquet")
print(f"Gold training: {len(gold)} sentences")
```
### Train a multi-task model
```bash
git clone https://github.com/rustic-ai/kniv-nlp-models
cd kniv-nlp-models
# Prepare training data from gold corpus
python models/deberta-v3-large-nlp-en/prepare_data.py --gold corpus/output/final-gold
# Train teacher (DeBERTa-v3-large, 304M params)
python models/deberta-v3-large-nlp-en/train.py
# Quick test (1 epoch, 100 samples)
python models/deberta-v3-large-nlp-en/train.py --quick-test
```
## Annotation Pipeline
```
collect → preprocess → annotate (spaCy) → validate (GPT) → classify (GPT) → export → gold filter (Qwen3-8B)
```
1. **Collect** — raw text from open sources (APIs, HuggingFace datasets, git repos)
2. **Preprocess** — sentence splitting, cleaning, dedup, prev_text linking for conversations
3. **Annotate** — spaCy `en_core_web_trf` for POS, NER, dependency parse
4. **Validate** — GPT-5.4-nano checks annotations in batches, returns corrections
5. **Classify** — GPT-5.4-nano assigns dialog act labels (with prev_text context for conversations)
6. **Export** — corrections applied, BIO tags repaired, split into train/dev/test
7. **Gold filter** — Qwen3-8B validates every NER entity, CLS label, and POS tag independently. 64 concurrent requests via vLLM on A100. Sentences failing any check removed.
## Quality Notes
- **POS/Dep**: UD English EWT v2.14 data used for POS+Dep training head (expert-annotated, not gold-filtered — already gold standard)
- **NER**: spaCy annotations validated by GPT-5.4-nano, then gold-filtered by Qwen3-8B. ~9.3% of entities rejected.
- **CLS**: GPT-5.4-nano classification validated by Qwen3-8B. ~4.0% rejected. Context-dependent labels (correction, agreement) remain noisier than context-free ones.
- **POS on corpus**: spaCy POS validated by Qwen3-8B. ~41% rejected (aggressive filtering — checks 8 tokens per sentence, so even one disagreement drops the sentence).
## Source
- **Training code:** [rustic-ai/kniv-nlp-models](https://github.com/rustic-ai/kniv-nlp-models)
- **Trained models:** [dragonscale-ai on HuggingFace](https://huggingface.co/dragonscale-ai)
## Citation
```bibtex
@misc{kniv-corpus-en,
title={kniv-corpus-en: Multi-domain NLP Corpus for English},
author={Dragonscale AI},
year={2026},
publisher={Hugging Face},
url={https://huggingface.co/datasets/dragonscale-ai/kniv-corpus-en}
}
```
## License
CC BY-SA 4.0. Individual domain source licenses are listed in the domains table above.