Update README: gold corpus, remove GMB refs, fix folder structure
Browse files
README.md
CHANGED
|
@@ -18,6 +18,7 @@ tags:
|
|
| 18 |
- conllu
|
| 19 |
- spacy
|
| 20 |
- gpt-validated
|
|
|
|
| 21 |
- knowledge-distillation
|
| 22 |
size_categories:
|
| 23 |
- 100K<n<1M
|
|
@@ -27,45 +28,50 @@ size_categories:
|
|
| 27 |
|
| 28 |
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.
|
| 29 |
|
| 30 |
-
All data is commercially licensed (CC BY-SA 4.0 compatible). No CoNLL-2003 or other research-only datasets.
|
| 31 |
|
| 32 |
## Repository Structure
|
| 33 |
|
| 34 |
```
|
| 35 |
dragonscale-ai/kniv-corpus-en/
|
| 36 |
-
├── data/
|
| 37 |
-
│ ├── train-00000-of-00001.parquet
|
| 38 |
-
│ ├── dev-00000-of-00001.parquet
|
| 39 |
-
│ └── test-00000-of-00001.parquet
|
| 40 |
-
├──
|
| 41 |
-
|
| 42 |
-
├──
|
| 43 |
-
├──
|
| 44 |
-
├──
|
| 45 |
-
│
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
│ │ ├── ud_dev.json POS + Dep dev
|
| 51 |
-
│ │ ├── ud_test.json POS + Dep test
|
| 52 |
-
│ │ └── label_vocabs.json All label vocabularies
|
| 53 |
-
│ └── deberta-v3-large-nlp-en-gold/ LLM-validated gold data (recommended)
|
| 54 |
-
│ ├── ner_train.json NER gold (36K, Qwen3-8B validated)
|
| 55 |
-
│ ├── ner_dev.json NER gold dev (4.5K)
|
| 56 |
-
│ ├── ner_test.json NER gold test (4.5K)
|
| 57 |
-
│ ├── ud_train.json POS gold (10.3K, Qwen3-8B validated)
|
| 58 |
-
│ ├── ud_dev.json POS dev
|
| 59 |
-
│ ├── ud_test.json POS test
|
| 60 |
-
│ └── label_vocabs.json All label vocabularies
|
| 61 |
└── README.md
|
| 62 |
```
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
## Dataset Formats
|
| 65 |
|
| 66 |
-
###
|
| 67 |
|
| 68 |
-
|
| 69 |
|
| 70 |
| Column | Type | Description |
|
| 71 |
|--------|------|-------------|
|
|
@@ -79,9 +85,7 @@ Auto-detected by HuggingFace. Each row contains:
|
|
| 79 |
| `deprels` | list[string] | Dependency relation labels |
|
| 80 |
| `ner_tags` | list[string] | BIO-tagged NER labels (18 entity types) |
|
| 81 |
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
### 2. CoNLL-U (for linguistic tools)
|
| 85 |
|
| 86 |
Standard [CoNLL-U format](https://universaldependencies.org/format.html) with extensions:
|
| 87 |
|
|
@@ -102,128 +106,35 @@ Standard [CoNLL-U format](https://universaldependencies.org/format.html) with ex
|
|
| 102 |
10 ? ? PUNCT . _ 5 punct _ _
|
| 103 |
```
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
Metadata comments:
|
| 108 |
-
- `# sent_id` — unique identifier
|
| 109 |
-
- `# text` — original sentence text
|
| 110 |
-
- `# prev_text` — previous utterance (conversation domain only, optional)
|
| 111 |
-
- `# cls` — dialog act classification label
|
| 112 |
-
- `MISC` column — NER tags as `NER=B-ORG`, `NER=I-ORG`, etc.
|
| 113 |
-
|
| 114 |
-
### 3. Prepared JSON (for direct model training)
|
| 115 |
-
|
| 116 |
-
Pre-processed splits ready for `torch.utils.data.Dataset`. Located in `prepared/deberta-v3-large-nlp-en/`.
|
| 117 |
-
|
| 118 |
-
**NER files** (`ner_train.json`, `ner_dev.json`, `ner_test.json`):
|
| 119 |
-
```json
|
| 120 |
-
{
|
| 121 |
-
"words": ["Apple", "reported", "$394B", "revenue"],
|
| 122 |
-
"text": "Apple reported $394B revenue",
|
| 123 |
-
"ner_tags": ["B-ORG", "O", "B-MONEY", "O"],
|
| 124 |
-
"cls_label": "inform",
|
| 125 |
-
"prev_text": null
|
| 126 |
-
}
|
| 127 |
-
```
|
| 128 |
-
Sources: kniv corpus (6 domains, spaCy + GPT validated) + GMB (CC BY 4.0, 48K human-annotated).
|
| 129 |
-
|
| 130 |
-
**UD files** (`ud_train.json`, `ud_dev.json`, `ud_test.json`):
|
| 131 |
-
```json
|
| 132 |
-
{
|
| 133 |
-
"words": ["The", "cat", "sat"],
|
| 134 |
-
"text": "The cat sat",
|
| 135 |
-
"pos_tags": ["DET", "NOUN", "VERB"],
|
| 136 |
-
"dep_labels": ["-1@det@NOUN", "0@root@ROOT", "+1@nsubj@VERB"],
|
| 137 |
-
"heads": [1, -1, 1],
|
| 138 |
-
"deprels": ["det", "root", "nsubj"],
|
| 139 |
-
"cls_label": "inform"
|
| 140 |
-
}
|
| 141 |
-
```
|
| 142 |
-
Source: UD English EWT v2.14 (CC BY-SA 4.0).
|
| 143 |
-
|
| 144 |
-
### 4. Gold-validated data (recommended for training)
|
| 145 |
-
|
| 146 |
-
Located in `prepared/deberta-v3-large-nlp-en-gold/`. This is the same data as above but filtered through **Qwen3-8B** running locally to remove annotation errors.
|
| 147 |
-
|
| 148 |
-
**Validation process:**
|
| 149 |
-
- Every NER entity span checked: "Is '{entity}' correctly tagged as {type}?" — sentences with any incorrect entity removed
|
| 150 |
-
- Every UD sentence checked: 3 random POS tags validated — sentences with incorrect POS removed
|
| 151 |
-
- ~10.5% of NER sentences removed (bad entity types)
|
| 152 |
-
- ~17.4% of UD sentences removed (ambiguous/incorrect POS)
|
| 153 |
-
|
| 154 |
-
Result: **36K NER + 10.3K UD gold training examples** with higher annotation confidence than the standard prepared data.
|
| 155 |
-
|
| 156 |
-
```python
|
| 157 |
-
from huggingface_hub import snapshot_download
|
| 158 |
-
|
| 159 |
-
# Download gold data (recommended)
|
| 160 |
-
snapshot_download(
|
| 161 |
-
"dragonscale-ai/kniv-corpus-en",
|
| 162 |
-
repo_type="dataset",
|
| 163 |
-
allow_patterns="prepared/deberta-v3-large-nlp-en-gold/*",
|
| 164 |
-
local_dir="data"
|
| 165 |
-
)
|
| 166 |
-
```
|
| 167 |
-
|
| 168 |
-
**Label vocabulary** (`label_vocabs.json`):
|
| 169 |
-
```json
|
| 170 |
-
{
|
| 171 |
-
"ner_labels": ["O", "B-PERSON", "I-PERSON", "B-ORG", "I-ORG", ...],
|
| 172 |
-
"pos_labels": ["ADJ", "ADP", "ADV", "AUX", ...],
|
| 173 |
-
"dep_labels": ["+1@nsubj@VERB", "-1@det@NOUN", "0@root@ROOT", ...],
|
| 174 |
-
"cls_labels": ["inform", "correction", "agreement", ...]
|
| 175 |
-
}
|
| 176 |
-
```
|
| 177 |
|
| 178 |
## Dataset Details
|
| 179 |
|
| 180 |
| | |
|
| 181 |
|---|---|
|
| 182 |
| **Total sentences** | 657,313 |
|
|
|
|
| 183 |
| **NER entity types** | 18 (BIO-tagged = 37 labels) |
|
| 184 |
| **POS tags** | 17 (Universal Dependencies UPOS) |
|
| 185 |
| **Dep labels** | ~1,440 (dep2label composite tags) |
|
| 186 |
| **CLS labels** | 9 (dialog act types) |
|
| 187 |
-
| **Annotation** | spaCy `en_core_web_trf` + GPT-5.4 validation
|
| 188 |
-
| **
|
| 189 |
| **License** | CC BY-SA 4.0 |
|
| 190 |
|
| 191 |
-
### Splits
|
| 192 |
-
|
| 193 |
-
| Split | Sentences |
|
| 194 |
-
|-------|-----------|
|
| 195 |
-
| train | 525,850 |
|
| 196 |
-
| dev | 65,731 |
|
| 197 |
-
| test | 65,732 |
|
| 198 |
-
|
| 199 |
### Domains
|
| 200 |
|
| 201 |
-
| Domain |
|
| 202 |
-
|--------|-----------|---------|---------|
|
| 203 |
-
| **
|
| 204 |
-
| **
|
| 205 |
-
| **
|
| 206 |
-
| **Encyclopedic** | 66,490 | Wikipedia (science, history, geography, arts) | CC BY-SA 3.0 |
|
| 207 |
-
| **News** | 58,026 | Wikinews, Wikipedia (journalism, politics) | CC BY 2.5 / CC BY-SA 3.0 |
|
| 208 |
-
| **Narrative** | 51,940 | Project Gutenberg (classic fiction) | Public domain |
|
| 209 |
-
|
| 210 |
-
### Annotation Pipeline
|
| 211 |
-
|
| 212 |
-
```
|
| 213 |
-
collect → preprocess → annotate (spaCy) → validate (GPT) → classify (GPT) → export
|
| 214 |
-
```
|
| 215 |
-
|
| 216 |
-
1. **Collect** — raw text from open sources (APIs, HuggingFace datasets, git repos)
|
| 217 |
-
2. **Preprocess** — sentence splitting (non-conversation) or utterance extraction (conversation), cleaning, quality filtering, deduplication, prev_text linking
|
| 218 |
-
3. **Annotate** — spaCy `en_core_web_trf` produces POS, NER, dependency parse per sentence (single pass, both CoNLL-U and JSONL)
|
| 219 |
-
4. **Validate** — GPT-5.4-nano checks POS/NER/dep annotations in batches of 5, returns corrections. Invalid POS corrections rejected (only valid UPOS accepted). Orphan BIO I-tags repaired.
|
| 220 |
-
5. **Classify** — GPT-5.4-nano assigns dialog act labels in batches of 20. Conversation domain sentences include `prev_text` for context-dependent labels (correction, agreement, filler).
|
| 221 |
-
6. **Export** — corrections applied, CLS labels embedded, BIO tags validated, split into train/dev/test, output as CoNLL-U + Parquet
|
| 222 |
|
| 223 |
### NER Entity Types (18)
|
| 224 |
|
| 225 |
-
BIO-tagged in the `ner_tags` column (Parquet) or MISC field (CoNLL-U):
|
| 226 |
-
|
| 227 |
| Type | Description | Example |
|
| 228 |
|------|-------------|---------|
|
| 229 |
| PERSON | People | *Caroline*, *Dr. Smith* |
|
|
@@ -245,126 +156,88 @@ BIO-tagged in the `ner_tags` column (Parquet) or MISC field (CoNLL-U):
|
|
| 245 |
| LAW | Laws | *the First Amendment* |
|
| 246 |
| LANGUAGE | Languages | *English*, *Mandarin* |
|
| 247 |
|
| 248 |
-
NER sources: kniv corpus (spaCy + GPT validated, 6 domains) + GMB Groningen Meaning Bank (CC BY 4.0, 48K human-corrected sentences, 8 entity types mapped to the 18-type scheme).
|
| 249 |
-
|
| 250 |
### CLS Dialog Act Labels (9)
|
| 251 |
|
| 252 |
-
| Label | Description | Uniko action |
|
| 253 |
-
|-------|-------------|-------------|-----------|
|
| 254 |
-
| `inform` | States a fact
|
| 255 |
-
| `question` | Asks for information | Record knowledge gap |
|
| 256 |
-
| `
|
| 257 |
-
| `
|
| 258 |
-
| `
|
| 259 |
-
| `
|
| 260 |
-
| `
|
| 261 |
-
| `agreement` | Agrees with or confirms something | Reinforce observation |
|
| 262 |
-
| `feedback` | Acknowledges without adding
|
| 263 |
-
|
| 264 |
-
Context-dependent labels (correction, agreement, feedback) are classified with the previous utterance (`prev_text`) as context for conversation domain sentences.
|
| 265 |
|
| 266 |
### dep2label Encoding
|
| 267 |
|
| 268 |
-
Dependency parsing
|
| 269 |
|
| 270 |
```
|
| 271 |
-
+1@nsubj@VERB
|
| 272 |
-
│ │ │
|
| 273 |
-
│ │ └── POS tag of the head token
|
| 274 |
-
│ └──────── dependency relation
|
| 275 |
-
└──────────── signed offset (1st VERB to the right)
|
| 276 |
```
|
| 277 |
|
| 278 |
-
Decoding back to a dependency tree is O(n) per sentence.
|
| 279 |
-
|
| 280 |
## Usage
|
| 281 |
|
| 282 |
-
###
|
| 283 |
|
| 284 |
```python
|
| 285 |
from datasets import load_dataset
|
| 286 |
|
|
|
|
| 287 |
ds = load_dataset("dragonscale-ai/kniv-corpus-en")
|
| 288 |
|
| 289 |
-
#
|
| 290 |
-
example = ds["train"][0]
|
| 291 |
-
print(f"Text: {example['text']}")
|
| 292 |
-
print(f"CLS: {example['cls']}")
|
| 293 |
-
print(f"Prev: {example['prev_text']}") # None for non-conversation
|
| 294 |
-
for tok, pos, ner in zip(example['tokens'], example['pos_tags'], example['ner_tags']):
|
| 295 |
-
print(f" {tok:20s} POS={pos:6s} NER={ner}")
|
| 296 |
-
```
|
| 297 |
-
|
| 298 |
-
### Training-ready JSON (for model training)
|
| 299 |
-
|
| 300 |
-
```python
|
| 301 |
from huggingface_hub import snapshot_download
|
| 302 |
-
|
| 303 |
-
# Download prepared training data
|
| 304 |
snapshot_download(
|
| 305 |
"dragonscale-ai/kniv-corpus-en",
|
| 306 |
repo_type="dataset",
|
| 307 |
-
allow_patterns="
|
| 308 |
-
local_dir="data"
|
| 309 |
)
|
| 310 |
|
| 311 |
-
import
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
print(f"NER training examples: {len(ner_train)}")
|
| 315 |
-
|
| 316 |
-
with open("data/prepared/deberta-v3-large-nlp-en/label_vocabs.json") as f:
|
| 317 |
-
vocabs = json.load(f)
|
| 318 |
-
print(f"NER labels: {len(vocabs['ner_labels'])}")
|
| 319 |
-
print(f"POS labels: {len(vocabs['pos_labels'])}")
|
| 320 |
-
print(f"Dep labels: {len(vocabs['dep_labels'])}")
|
| 321 |
-
print(f"CLS labels: {vocabs['cls_labels']}")
|
| 322 |
-
```
|
| 323 |
-
|
| 324 |
-
### Via CoNLL-U files
|
| 325 |
-
|
| 326 |
-
```python
|
| 327 |
-
import conllu
|
| 328 |
-
from huggingface_hub import hf_hub_download
|
| 329 |
-
|
| 330 |
-
path = hf_hub_download("dragonscale-ai/kniv-corpus-en", "train.conllu", repo_type="dataset")
|
| 331 |
-
|
| 332 |
-
with open(path) as f:
|
| 333 |
-
sentences = conllu.parse(f.read())
|
| 334 |
-
|
| 335 |
-
for sent in sentences[:3]:
|
| 336 |
-
print(f"Text: {sent.metadata['text']}")
|
| 337 |
-
print(f"CLS: {sent.metadata.get('cls', 'N/A')}")
|
| 338 |
-
if 'prev_text' in sent.metadata:
|
| 339 |
-
print(f"Prev: {sent.metadata['prev_text'][:80]}")
|
| 340 |
-
for token in sent:
|
| 341 |
-
ner = token.get("misc", {})
|
| 342 |
-
ner_tag = ner.get("NER", "O") if isinstance(ner, dict) else "O"
|
| 343 |
-
print(f" {token['form']:20s} POS={token['upos']:6s} DEP={token['deprel']:12s} NER={ner_tag}")
|
| 344 |
```
|
| 345 |
|
| 346 |
-
###
|
| 347 |
|
| 348 |
```bash
|
| 349 |
git clone https://github.com/rustic-ai/kniv-nlp-models
|
| 350 |
cd kniv-nlp-models
|
| 351 |
-
uv pip install -e .
|
| 352 |
|
| 353 |
-
# Prepare data
|
| 354 |
-
|
| 355 |
|
| 356 |
# Train teacher (DeBERTa-v3-large, 304M params)
|
| 357 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 358 |
|
| 359 |
-
# Quick test (1 epoch, 100 samples — verify setup)
|
| 360 |
-
uv run python models/deberta-v3-large-nlp-en/train.py --quick-test
|
| 361 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 362 |
|
| 363 |
## Quality Notes
|
| 364 |
|
| 365 |
-
- **POS/Dep**:
|
| 366 |
-
- **NER**: spaCy
|
| 367 |
-
- **CLS**: GPT-5.4-nano classification
|
|
|
|
| 368 |
|
| 369 |
## Source
|
| 370 |
|
|
@@ -385,4 +258,4 @@ uv run python models/deberta-v3-large-nlp-en/train.py --quick-test
|
|
| 385 |
|
| 386 |
## License
|
| 387 |
|
| 388 |
-
CC BY-SA 4.0. Individual domain source licenses are listed in the domains table above
|
|
|
|
| 18 |
- conllu
|
| 19 |
- spacy
|
| 20 |
- gpt-validated
|
| 21 |
+
- llm-gold-filtered
|
| 22 |
- knowledge-distillation
|
| 23 |
size_categories:
|
| 24 |
- 100K<n<1M
|
|
|
|
| 28 |
|
| 29 |
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.
|
| 30 |
|
| 31 |
+
All data is commercially licensed (CC BY-SA 4.0 compatible). No CoNLL-2003, GMB, or other research-only datasets.
|
| 32 |
|
| 33 |
## Repository Structure
|
| 34 |
|
| 35 |
```
|
| 36 |
dragonscale-ai/kniv-corpus-en/
|
| 37 |
+
├── data/ # Full corpus Parquet (for load_dataset)
|
| 38 |
+
│ ├── train-00000-of-00001.parquet 525,850 sentences (127.7 MB)
|
| 39 |
+
│ ├── dev-00000-of-00001.parquet 65,731 sentences (13.8 MB)
|
| 40 |
+
│ └── test-00000-of-00001.parquet 65,732 sentences (14.0 MB)
|
| 41 |
+
├── corpus/
|
| 42 |
+
│ └── gold/ # LLM-validated gold corpus (recommended)
|
| 43 |
+
│ ├── train.parquet 237,646 sentences (56.8 MB)
|
| 44 |
+
│ ├── dev.parquet 65,731 sentences (13.8 MB)
|
| 45 |
+
│ ├── test.parquet 65,732 sentences (14.0 MB)
|
| 46 |
+
│ └── progress.json Filter progress metadata
|
| 47 |
+
├── train.conllu # Full corpus in CoNLL-U format (547.7 MB)
|
| 48 |
+
├── dev.conllu # (67.9 MB)
|
| 49 |
+
├── test.conllu # (68.8 MB)
|
| 50 |
+
├── metadata.json # Split sizes, domain list
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
└── README.md
|
| 52 |
```
|
| 53 |
|
| 54 |
+
### Full corpus vs Gold corpus
|
| 55 |
+
|
| 56 |
+
| | Full (`data/`) | Gold (`corpus/gold/`) |
|
| 57 |
+
|---|---|---|
|
| 58 |
+
| **Train sentences** | 525,850 | 237,646 |
|
| 59 |
+
| **Validation** | spaCy + GPT corrections | + Qwen3-8B per-example validation |
|
| 60 |
+
| **Checks applied** | None | NER entities, CLS labels, POS tags |
|
| 61 |
+
| **Recommended for** | Exploration, analysis | Model training |
|
| 62 |
+
|
| 63 |
+
The gold corpus was produced by validating every sentence with Qwen3-8B (64 concurrent requests via vLLM on A100). Each sentence passed three checks:
|
| 64 |
+
- **NER**: every entity span validated ("Is '{entity}' correctly tagged as {type}?")
|
| 65 |
+
- **CLS**: dialog act label validated with conversational context
|
| 66 |
+
- **POS**: up to 8 POS tags per sentence validated against Universal POS tagset
|
| 67 |
+
|
| 68 |
+
Sentences failing any check were removed. 45.2% of training data survived (237K from 525K).
|
| 69 |
+
|
| 70 |
## Dataset Formats
|
| 71 |
|
| 72 |
+
### Parquet (recommended)
|
| 73 |
|
| 74 |
+
Each row contains:
|
| 75 |
|
| 76 |
| Column | Type | Description |
|
| 77 |
|--------|------|-------------|
|
|
|
|
| 85 |
| `deprels` | list[string] | Dependency relation labels |
|
| 86 |
| `ner_tags` | list[string] | BIO-tagged NER labels (18 entity types) |
|
| 87 |
|
| 88 |
+
### CoNLL-U
|
|
|
|
|
|
|
| 89 |
|
| 90 |
Standard [CoNLL-U format](https://universaldependencies.org/format.html) with extensions:
|
| 91 |
|
|
|
|
| 106 |
10 ? ? PUNCT . _ 5 punct _ _
|
| 107 |
```
|
| 108 |
|
| 109 |
+
NER tags in MISC column: `NER=B-ORG`, `NER=I-ORG`, etc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
## Dataset Details
|
| 112 |
|
| 113 |
| | |
|
| 114 |
|---|---|
|
| 115 |
| **Total sentences** | 657,313 |
|
| 116 |
+
| **Gold sentences** | 237,646 |
|
| 117 |
| **NER entity types** | 18 (BIO-tagged = 37 labels) |
|
| 118 |
| **POS tags** | 17 (Universal Dependencies UPOS) |
|
| 119 |
| **Dep labels** | ~1,440 (dep2label composite tags) |
|
| 120 |
| **CLS labels** | 9 (dialog act types) |
|
| 121 |
+
| **Annotation** | spaCy `en_core_web_trf` + GPT-5.4-nano validation |
|
| 122 |
+
| **Gold filtering** | Qwen3-8B via vLLM (NER + CLS + POS) |
|
| 123 |
| **License** | CC BY-SA 4.0 |
|
| 124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
### Domains
|
| 126 |
|
| 127 |
+
| Domain | Full | Gold | Sources | License |
|
| 128 |
+
|--------|------|------|---------|---------|
|
| 129 |
+
| **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 |
|
| 130 |
+
| **Technical** | 193,032 | 56,438 | Wikipedia (CS/engineering), Python docs | CC BY-SA 3.0 / PSF License |
|
| 131 |
+
| **Conversation** | 89,934 | 29,203 | Taskmaster 1/2/3, OASST1, MultiWOZ 2.2, Glaive, Discord Dialogues | CC BY-4.0 / Apache 2.0 / MIT |
|
| 132 |
+
| **Encyclopedic** | 66,490 | 29,088 | Wikipedia (science, history, geography, arts) | CC BY-SA 3.0 |
|
| 133 |
+
| **News** | 58,026 | 27,541 | Wikinews, Wikipedia (journalism, politics) | CC BY 2.5 / CC BY-SA 3.0 |
|
| 134 |
+
| **Narrative** | 51,940 | 21,851 | Project Gutenberg (classic fiction) | Public domain |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
### NER Entity Types (18)
|
| 137 |
|
|
|
|
|
|
|
| 138 |
| Type | Description | Example |
|
| 139 |
|------|-------------|---------|
|
| 140 |
| PERSON | People | *Caroline*, *Dr. Smith* |
|
|
|
|
| 156 |
| LAW | Laws | *the First Amendment* |
|
| 157 |
| LANGUAGE | Languages | *English*, *Mandarin* |
|
| 158 |
|
|
|
|
|
|
|
| 159 |
### CLS Dialog Act Labels (9)
|
| 160 |
|
| 161 |
+
| Label | Description | Uniko action | Gold count |
|
| 162 |
+
|-------|-------------|-------------|------------|
|
| 163 |
+
| `inform` | States a fact or observation | Extract observation | 173,401 (73.0%) |
|
| 164 |
+
| `question` | Asks for information | Record knowledge gap | 14,979 (6.3%) |
|
| 165 |
+
| `plan_commit` | Commits to action, offers, suggests | Link to Goal/Task | 12,518 (5.3%) |
|
| 166 |
+
| `request` | Asks someone to do something | Create action node | 10,679 (4.5%) |
|
| 167 |
+
| `filler` | Fragments, headers, formatting | Skip entirely | 10,538 (4.4%) |
|
| 168 |
+
| `correction` | Corrects or contradicts prior statement | Flag for update | 7,587 (3.2%) |
|
| 169 |
+
| `social` | Greeting, goodbye, thanks, apology | Skip extraction | 3,111 (1.3%) |
|
| 170 |
+
| `agreement` | Agrees with or confirms something | Reinforce observation | 2,956 (1.2%) |
|
| 171 |
+
| `feedback` | Acknowledges without adding info | Skip extraction | 1,877 (0.8%) |
|
|
|
|
|
|
|
| 172 |
|
| 173 |
### dep2label Encoding
|
| 174 |
|
| 175 |
+
Dependency parsing reformulated as token classification using [rel-pos encoding](https://aclanthology.org/N19-1077/) (Strzyz et al., 2019):
|
| 176 |
|
| 177 |
```
|
| 178 |
+
+1@nsubj@VERB → "1st VERB to the right, relation=nsubj"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
```
|
| 180 |
|
|
|
|
|
|
|
| 181 |
## Usage
|
| 182 |
|
| 183 |
+
### Load with HuggingFace Datasets
|
| 184 |
|
| 185 |
```python
|
| 186 |
from datasets import load_dataset
|
| 187 |
|
| 188 |
+
# Full corpus
|
| 189 |
ds = load_dataset("dragonscale-ai/kniv-corpus-en")
|
| 190 |
|
| 191 |
+
# Gold corpus (recommended for training)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
from huggingface_hub import snapshot_download
|
|
|
|
|
|
|
| 193 |
snapshot_download(
|
| 194 |
"dragonscale-ai/kniv-corpus-en",
|
| 195 |
repo_type="dataset",
|
| 196 |
+
allow_patterns="corpus/gold/*",
|
| 197 |
+
local_dir="kniv-data",
|
| 198 |
)
|
| 199 |
|
| 200 |
+
import pandas as pd
|
| 201 |
+
gold = pd.read_parquet("kniv-data/corpus/gold/train.parquet")
|
| 202 |
+
print(f"Gold training: {len(gold)} sentences")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
```
|
| 204 |
|
| 205 |
+
### Train a multi-task model
|
| 206 |
|
| 207 |
```bash
|
| 208 |
git clone https://github.com/rustic-ai/kniv-nlp-models
|
| 209 |
cd kniv-nlp-models
|
|
|
|
| 210 |
|
| 211 |
+
# Prepare training data from gold corpus
|
| 212 |
+
python models/deberta-v3-large-nlp-en/prepare_data.py --gold corpus/output/final-gold
|
| 213 |
|
| 214 |
# Train teacher (DeBERTa-v3-large, 304M params)
|
| 215 |
+
python models/deberta-v3-large-nlp-en/train.py
|
| 216 |
+
|
| 217 |
+
# Quick test (1 epoch, 100 samples)
|
| 218 |
+
python models/deberta-v3-large-nlp-en/train.py --quick-test
|
| 219 |
+
```
|
| 220 |
+
|
| 221 |
+
## Annotation Pipeline
|
| 222 |
|
|
|
|
|
|
|
| 223 |
```
|
| 224 |
+
collect → preprocess → annotate (spaCy) → validate (GPT) → classify (GPT) → export → gold filter (Qwen3-8B)
|
| 225 |
+
```
|
| 226 |
+
|
| 227 |
+
1. **Collect** — raw text from open sources (APIs, HuggingFace datasets, git repos)
|
| 228 |
+
2. **Preprocess** — sentence splitting, cleaning, dedup, prev_text linking for conversations
|
| 229 |
+
3. **Annotate** — spaCy `en_core_web_trf` for POS, NER, dependency parse
|
| 230 |
+
4. **Validate** — GPT-5.4-nano checks annotations in batches, returns corrections
|
| 231 |
+
5. **Classify** — GPT-5.4-nano assigns dialog act labels (with prev_text context for conversations)
|
| 232 |
+
6. **Export** — corrections applied, BIO tags repaired, split into train/dev/test
|
| 233 |
+
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.
|
| 234 |
|
| 235 |
## Quality Notes
|
| 236 |
|
| 237 |
+
- **POS/Dep**: UD English EWT v2.14 data used for POS+Dep training head (expert-annotated, not gold-filtered — already gold standard)
|
| 238 |
+
- **NER**: spaCy annotations validated by GPT-5.4-nano, then gold-filtered by Qwen3-8B. ~9.3% of entities rejected.
|
| 239 |
+
- **CLS**: GPT-5.4-nano classification validated by Qwen3-8B. ~4.0% rejected. Context-dependent labels (correction, agreement) remain noisier than context-free ones.
|
| 240 |
+
- **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).
|
| 241 |
|
| 242 |
## Source
|
| 243 |
|
|
|
|
| 258 |
|
| 259 |
## License
|
| 260 |
|
| 261 |
+
CC BY-SA 4.0. Individual domain source licenses are listed in the domains table above.
|