Datasets:
Tasks:
Token Classification
Modalities:
Text
Formats:
json
Sub-tasks:
named-entity-recognition
Languages:
English
Size:
1K - 10K
ArXiv:
License:
|
Download build_scripts/README.md from freethenation/conll-crossner-ner-with-context: direct link, hf CLI and curl.
- Browser
- Download file 8.45 kB
-
https://huggingface.co/datasets/freethenation/conll-crossner-ner-with-context/resolve/main/build_scripts/README.md
- Command line
-
hf download hf://datasets/freethenation/conll-crossner-ner-with-context/build_scripts/README.md
-
curl -L -o README.md https://huggingface.co/datasets/freethenation/conll-crossner-ner-with-context/resolve/main/build_scripts/README.md
8.45 kB
| # Build scripts and sources | |
| Written with the help of an AI assistant (Claude). | |
| Each dataset in `..` is built by one script here from untouched source files in `sources/`. | |
| Output format: BigBio KB records, see `../schema.py`. Requires Python 3.10+ and pydantic 2. Run from the dataset | |
| folder, e.g. `python build_scripts/build_crossner.py ai`. | |
| Tests: `python build_scripts/test_build.py` checks the built data against the sources for every issue found so | |
| far (about 20 s). Accepted exceptions are listed, with reasons, in `KNOWN` at the top of the file. | |
| "The InstructUIE copy" below is the widely used sentence-only version of these benchmarks: | |
| `NER/<name>/test.json` and `labels.json` in `IE_INSTRUCTIONS.zip` (see Appendix A of `../README.md`). | |
| ## CoNLL 2003 (test / testb) | |
| | | | | |
| |---|---| | |
| | Script | `build_conll2003.py` → `../CoNLL 2003/test.jsonl`, `labels.json` | | |
| | Source | `sources/conll2003/eng.testb` | | |
| | URL | https://raw.githubusercontent.com/synalp/NER/master/corpus/CoNLL-2003/eng.testb | | |
| | Fetched | 2026-11-24 | | |
| | sha256 | `0632f32c090ef31c223135b7fee3187a7cf8e65c4015c7866bb7783428cdd9a6` | | |
| | Contents | original 4-column file (`token POS chunk NER`), IOB1 tags, 231 `-DOCSTART-` articles | | |
| | License | annotations: CoNLL-2003 shared task release; text: Reuters RCV1 (research use only, via NIST) | | |
| Official page (now offline, archived): https://web.archive.org/web/2019id_/https://www.clips.uantwerpen.be/conll2003/ner.tgz | |
| — its `etc/files.eng.testb` lists the 231 RCV1 file names in the same order as the DOCSTARTs. | |
| What the script does: one record per article, every sentence a `labeled` passage (tokens joined by one | |
| space); IOB1 tags → spans; PER/LOC/ORG/MISC → person/location/organization/else (the names in | |
| `labels.json`, written by the script; names and order are those of the InstructUIE copy's | |
| `NER/CoNLL 2003/labels.json`, so results stay comparable). No text or label corrections. | |
| Result: 231 documents, 3,453 sentences, 5,648 entities (location 1,668, organization 1,661, person 1,617, else 702). | |
| Comparison with the InstructUIE copy (`NER/CoNLL 2003/test.json`): same 3,453 sentences in the | |
| same order and the same entities, but 21 sentences in that copy have entity offsets pointing at the wrong | |
| occurrence of the entity text (e.g. "Australia" placed inside "Australian", the second "Santa Fe" swapped with | |
| the first), so a correct prediction there is scored as wrong. This build takes positions from the original tags. | |
| ## CrossNER (one script for all five domains) | |
| `build_crossner.py <domain>` → `../CrossNER_<Domain>/test.jsonl`, `labels.json` (label lists are written out in the | |
| script, with the names and order of the InstructUIE copy's `NER/CrossNER_<Domain>/labels.json`). | |
| Sources, per domain: | |
| - Labels: `sources/crossner/ner_data/<domain>/test.txt` from https://github.com/zliucr/CrossNER at commit | |
| `2e7ba2a7798c961e3f29fbc51252c5a8d40224bf` (raw URL `https://raw.githubusercontent.com/zliucr/CrossNER/<commit>/ner_data/<domain>/test.txt`). | |
| `token<TAB>BIO-tag` lines, original type names. License: MIT (repo). | |
| - Context: `sources/crossner/<domain>_domainlevel.txt`, the authors' unlabeled Wikipedia corpus, from the Drive folder | |
| linked in their README: https://drive.google.com/drive/folders/1xDAaTwruESNmleuIsln7IaNleNsYlHGn | |
| (fetch a file with `gdown <file id>`). One paragraph per line, articles separated by lines of 48 `=` tokens (shorter `= = =` lines are | |
| headings or breaks inside an article), no titles, | |
| wiki links kept as `Target | anchor`. Text is Wikipedia (CC BY-SA). | |
| | Domain | test.txt sha256 | domainlevel Drive file id | domainlevel sha256 | Fetched | | |
| |---|---|---|---|---| | |
| | ai | `7595ad386e0a98067100fe47f86811b38867a236011fee97cfaa90f778c37bcf` | `1iaN4Ein3SZ_-GoKwuJdLjrwkKs_KnYRD` | `bd1b5541da12ed631810be2ea31ab70a7b8087a0ce3bfec3723e2a4a26d2e194` | 2026-11-24 | | |
| | literature | `77267f8b3e8afe993865c64cfc605f65671f6a0ac9cba65de970f12180fed20e` | `17Qt04NhTFzuiCrBFwA1Tke0sRF5Ed-Iv` | `163a7dde96710eab58124593aab97447261d2fa0f91a745d321e315f59a8cccc` | 2026-11-24 | | |
| | music | `c66e345f959ac65593f76c6b1bd8c6d75f2a6f0bc197389b2e6700d101fd094c` | `1z2RDiRF4gIp7K6VwewPqR-YsuIMUesHn` | `f5383811ad70fe52913facd1173c3dc01d982816271876c722eb1520192b3c52` | 2026-11-24 | | |
| | politics | `05cadc5e129d394f7f92b4a052cf4b6ea4c60878d32a833e500cf046c297455f` | `1ARaQnkLVOI3ZUCCoGcB-lHJPx-qTunFn` | `278045ac0555c853e35cffdd660866c81641c2bd6fe88c8505eb78bccca0340f` | 2026-11-24 | | |
| | science | `3616d59d4d2b9dbf4c1126f8d8ba47ff97886223c95f93649bfd527343e64ced` | `1E7tRWu7o6Q-_Ap5QXVBih6LgWQYM7xN5` | `11ea2687b5903edd0ee1f1c9e33c73148ec3c2bade5993aa14c8f5bfd0596670` | 2026-11-24 | | |
| What the script does: | |
| 1. Reads the test sentences (tokens joined by one space) and BIO spans; renames types to our labels | |
| (all: misc→else, organisation→organization; plus per-domain joined names like programlang→program language). | |
| 2. Finds each sentence's paragraph by token 3-gram overlap, with a threshold of 50%. For rejected matches, | |
| looks for one source span starting at a sentence boundary that contains every test token in order with | |
| bounded gaps. This can match either side of a wiki link. If there is no unique span, the sentence is | |
| kept without context (`document_id` `<domain>-unmatched-<i>`). Quote marks `"` and link separators `|` | |
| are skipped when matching. | |
| 3. Aligns the sentence inside that paragraph (difflib, windowed, gaps up to 12 extra tokens for link targets), then | |
| extends the aligned stretch token by token over the rest of the sentence, skipping up to 25 paragraph tokens only | |
| where a link separator `|` lies in between (long link targets, e.g. one per item in a list). A sentence-final | |
| `.`, `!` or `?` is never matched across extra words unless they are a link target, so a citation glued after | |
| the sentence ("twice.Behrends 1990 , p .") stays in the context. It also includes a link | |
| target left dangling just before the sentence. If backward alignment still misses the start, it checks | |
| whether the full sentence matches from an earlier source boundary to the same end. The stretch is | |
| replaced by our labeled sentence. The rest of the paragraph and all other paragraphs of the | |
| article become `context` passages, unchanged except that runs of whitespace become one space, including link markup, which cannot be stripped reliably | |
| (a link's start isn't marked). | |
| 4. One record per test sentence, in test order; an article holding several test sentences appears in several records. | |
| Results: | |
| - **ai**: 431 sentences, 1,809 entities. | |
| vs the InstructUIE copy: same sentences and order; 5 sentences (#21, 37, 190, 260, 281) have one more entity | |
| here — an entity ending at the last token, which that copy dropped. | |
| - **literature**: 416 sentences, 2,266 entities. | |
| vs the InstructUIE copy: same sentences and order; 3 sentences (#197, 368, 403) gain a sentence-final entity that | |
| copy dropped. | |
| - **music**: 465 sentences, 3,336 entities. vs the InstructUIE copy: same sentences and order. That copy renamed the | |
| labels to organization/else but left 379 gold entities typed `organisation` (208) and `misc` (171), which no | |
| prediction can match; here they are renamed. Beyond that: 2 sentence-final entities that copy dropped (#127, 244) | |
| and 1 entity at the wrong occurrence ("art", #153). Effect on F1 (GLiNER Small v2, sentence only): 60.00 → 63.96. | |
| - **politics**: 651 sentences, 4,209 entities. vs the InstructUIE copy: it drops the last test sentence | |
| (#650, "The Mueller Report showed …"); otherwise same sentences and order, and 1 sentence-final entity that copy | |
| dropped (#552). | |
| - **science**: 543 sentences, 3,089 entities. vs the InstructUIE copy: same sentences and order; 1 sentence-final | |
| entity that copy dropped (#27). | |
| - Score check (GLiNER Small v2, labeled sentence only, GLiNER's evaluation code: exact-match entity micro F1, | |
| threshold 0.5, flat decoding): every dataset scores within 0.08 F1 of the InstructUIE copy, except music (+3.96, | |
| the label fix). | |
| - Context boundaries: source checks confirmed that music #14 and #181 and literature #382 now replace the full | |
| source span while preserving neighbouring text. Music #435 and politics #427 are infobox fragments. | |
| - Spot checks: 6 random records per domain plus every sentence that needed a loose match (AI #12, 49, 105, 116, 155, | |
| 411; literature #20, 215, 323) read by hand: all sit in the right article and paragraph. | |