File size: 10,990 Bytes
30b7811
 
 
dc46a99
30b7811
 
d21eebb
30b7811
 
 
 
 
 
 
 
d21eebb
30b7811
 
d21eebb
 
4c0fe9d
1fc5c4c
30b7811
 
 
 
 
 
1fc5c4c
 
4c0fe9d
1fc5c4c
 
 
 
 
4c0fe9d
 
 
 
 
 
 
 
 
 
 
 
 
 
1fc5c4c
 
 
4c0fe9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1fc5c4c
 
4c0fe9d
1fc5c4c
4c0fe9d
1fc5c4c
 
 
 
 
 
 
 
 
 
 
 
 
4c0fe9d
1fc5c4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4c0fe9d
30b7811
 
 
d21eebb
 
1fc5c4c
4c0fe9d
1fc5c4c
 
 
 
4c0fe9d
 
d21eebb
30b7811
 
 
4c0fe9d
 
 
 
 
 
 
 
d21eebb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4c0fe9d
 
 
 
 
 
 
 
 
 
 
d21eebb
1fc5c4c
d21eebb
4c0fe9d
d21eebb
 
4c0fe9d
d21eebb
 
dc46a99
 
4c0fe9d
263c9f4
 
 
 
4c0fe9d
263c9f4
 
4c0fe9d
1fc5c4c
 
 
 
4c0fe9d
 
1fc5c4c
 
4c0fe9d
 
 
dc46a99
 
4c0fe9d
1fc5c4c
 
 
 
 
4c0fe9d
 
1fc5c4c
 
4c0fe9d
 
 
 
 
 
 
1fc5c4c
 
4c0fe9d
 
 
 
 
 
 
 
 
 
1fc5c4c
 
 
4c0fe9d
 
 
 
1fc5c4c
30b7811
 
 
 
 
d21eebb
 
 
 
 
 
 
 
 
 
 
 
30b7811
 
4c0fe9d
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
---
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.