Datasets:
|
Download README.md from U4RASD/TypePrediction: direct link, hf CLI and curl.
- Browser
- Download file 7.41 kB
-
https://huggingface.co/datasets/U4RASD/TypePrediction/resolve/main/README.md
- Command line
-
hf download hf://datasets/U4RASD/TypePrediction/README.md
-
curl -L -o README.md https://huggingface.co/datasets/U4RASD/TypePrediction/resolve/main/README.md
7.41 kB
| language: | |
| - ar | |
| pretty_name: TypePrediction | |
| task_categories: | |
| - token-classification | |
| tags: | |
| - named-entity-recognition | |
| - arabic | |
| - wojood | |
| - entity-typing | |
| size_categories: | |
| - 100K<n<1M | |
| # TypePrediction | |
| Unified mention-level type prediction data built from all available local Wojood NER datasets except `WojoodRelations`. | |
| ## Main file | |
| - `type_predictor_data.jsonl` | |
| - `type_predictor_train.jsonl` | |
| - `type_predictor_val.jsonl` | |
| - `type_predictor_test.jsonl` | |
| - `summary.json` | |
| - `split_summary.json` | |
| - `build_type_prediction_dataset.py` | |
| - `push_to_hf.py` | |
| - `split_data.py` | |
| - `artifacts/ambiguous_span_type_conflicts.jsonl` | |
| - `artifacts/split_assignments.jsonl` | |
| Each row contains: | |
| ```json | |
| { | |
| "id": "tp_000001", | |
| "entity": "النص", | |
| "type": "ORG", | |
| "sentence": "الجملة الكاملة", | |
| "start_token": 0, | |
| "end_token": 1, | |
| "start_char": 0, | |
| "end_char": 10, | |
| "raw_types": ["ORG", "NONGOV"], | |
| "sources": [ | |
| {"dataset": "WojoodFine", "split": "train"}, | |
| {"dataset": "Wojood1_1_nested", "split": "train"} | |
| ] | |
| } | |
| ``` | |
| ## Stored row examples | |
| Simple flat/coarse example: | |
| ```json | |
| { | |
| "id": "tp_000001", | |
| "entity": "عبد الحميد عبد العاطي", | |
| "type": "PERS", | |
| "sentence": "! ! ! تم النشر قبل بواسطة عبد الحميد عبد العاطي ازهقنا .", | |
| "start_token": 7, | |
| "end_token": 10, | |
| "start_char": 26, | |
| "end_char": 47, | |
| "raw_types": ["PERS"], | |
| "sources": [{"dataset": "WojoodFine", "split": "train"}] | |
| } | |
| ``` | |
| Example where a fine label is mapped to a coarse label: | |
| ```json | |
| { | |
| "id": "tp_001001", | |
| "entity": "للعراقيين", | |
| "type": "NORP", | |
| "sentence": ", أثارت محاكمات 11 مشتبها بهم فرنسيين في العراق في مايو / أيار هذه المخاوف ، ليس فقط للمشتبه بهم الأجانب بل للعراقيين أيضا .", | |
| "start_token": 22, | |
| "end_token": 22, | |
| "start_char": 108, | |
| "end_char": 117, | |
| "raw_types": ["NORP"], | |
| "sources": [{"dataset": "WojoodFine", "split": "train"}] | |
| } | |
| ``` | |
| Example merged across multiple source datasets: | |
| ```json | |
| { | |
| "id": "tp_050001", | |
| "entity": "مصر", | |
| "type": "GPE", | |
| "sentence": "بعدما أطاح به آية الله الخميني وبنظامه ، حيث توجه بداية إلى مصر قبل أن يستقر به الأمر في المغرب ، ,", | |
| "start_token": 12, | |
| "end_token": 12, | |
| "start_char": 60, | |
| "end_char": 63, | |
| "raw_types": ["GPE", "COUNTRY"], | |
| "sources": [ | |
| {"dataset": "Wojood1_1_flat", "split": "test"}, | |
| {"dataset": "Wojood1_1_nested", "split": "test"}, | |
| {"dataset": "WojoodFine-Flat", "split": "split20"} | |
| ] | |
| } | |
| ``` | |
| ## Construction | |
| 1. Parse all sentence-separated CoNLL-style files from: | |
| - `Wojood1_1_flat` | |
| - `Wojood1_1_nested` | |
| - `WojoodFine` | |
| - `WojoodFine-Flat` | |
| 2. Extract every entity span, including nested spans when multiple BIO tags are present on the same token sequence. | |
| 3. Map fine labels to coarse labels using `wojood_ontology.json`. | |
| 4. Reconstruct full sentence text and both token and character spans. | |
| 5. Deduplicate by `(sentence, entity, type, start_token, end_token)` and merge provenance. | |
| 6. Remove exact span/type conflicts from the main file: | |
| - conflict key: `(sentence, entity, start_token, end_token, start_char, end_char)` | |
| - if the same exact span has more than one coarse type, all candidate rows for that span are written to `artifacts/ambiguous_span_type_conflicts.jsonl` | |
| - the main `type_predictor_data.jsonl` keeps only unambiguous rows | |
| 7. Assign deterministic ids in final sorted order: `tp_000001`, `tp_000002`, ... | |
| ## Parsing details and edge cases | |
| - `Wojood1_1_flat` uses simple space-separated `token tag` rows. | |
| - `Wojood1_1_nested` uses space-separated rows with multiple BIO tags on the same token when nested annotations exist. | |
| - `WojoodFine` and `WojoodFine-Flat` use tab-separated rows. | |
| - Some `WojoodFine` rows place multiple tags inside a single tab field, for example: | |
| - `نبيه\tI-OCC B-PERS\t\t\t` | |
| The builder normalizes this by splitting tag cells on internal whitespace. | |
| - Some fine labels appear with alias spellings that differ from the ontology ids, for example: | |
| - `GPE-ORG` -> `GPE_ORG` | |
| - `Cluster` -> `CLUSTER` | |
| - `Path` -> `PATH` | |
| The builder canonicalizes these before mapping to coarse parents. | |
| - Sentence boundaries are read from blank lines in the CoNLL files. | |
| - Character spans are reconstructed after joining sentence tokens with single spaces. | |
| - The main file is single-label by construction. Ambiguous multi-type spans are excluded rather than guessed. | |
| ## Summary | |
| - total rows: `125996` | |
| - unique sentences: `33933` | |
| - raw extracted mentions before dedupe: `408035` | |
| - rows merged by dedupe: `275272` | |
| - ambiguous span groups excluded: `3383` | |
| - candidate rows excluded by ambiguity filtering: `6767` | |
| ## Source breakdown | |
| - `Wojood1_1_flat/test`: 14573 mentions from 6606 sentences | |
| - `Wojood1_1_flat/train`: 49959 mentions from 23125 sentences | |
| - `Wojood1_1_flat/val`: 7143 mentions from 3304 sentences | |
| - `Wojood1_1_nested/test`: 18045 mentions from 6606 sentences | |
| - `Wojood1_1_nested/train`: 62377 mentions from 23125 sentences | |
| - `Wojood1_1_nested/val`: 8944 mentions from 3304 sentences | |
| - `WojoodFine/test`: 27848 mentions from 5748 sentences | |
| - `WojoodFine/train`: 96188 mentions from 19484 sentences | |
| - `WojoodFine/val`: 13800 mentions from 2828 sentences | |
| - `WojoodFine-Flat/split10`: 10859 mentions from 3304 sentences | |
| - `WojoodFine-Flat/split20`: 22208 mentions from 6606 sentences | |
| - `WojoodFine-Flat/split70`: 76091 mentions from 23125 sentences | |
| ## Top coarse types | |
| - `GPE`: 26902 | |
| - `ORG`: 26593 | |
| - `DATE`: 19762 | |
| - `PERS`: 10712 | |
| - `NORP`: 10217 | |
| - `ORDINAL`: 7807 | |
| - `OCC`: 7696 | |
| - `EVENT`: 3769 | |
| - `CARDINAL`: 3724 | |
| - `LOC`: 2388 | |
| - `WEBSITE`: 1478 | |
| - `FAC`: 1296 | |
| - `LAW`: 904 | |
| - `TIME`: 871 | |
| - `MONEY`: 420 | |
| - `CURR`: 411 | |
| - `LANGUAGE`: 332 | |
| - `PERCENT`: 312 | |
| - `PRODUCT`: 190 | |
| - `QUANTITY`: 106 | |
| ## Validation performed | |
| - verified that all four non-relation Wojood sources were included | |
| - verified nested extraction is enabled when multiple tags occur on one token | |
| - verified fine-to-coarse mapping uses the repo's `wojood_ontology.json` | |
| - verified `sentence[start_char:end_char] == entity` across the built file | |
| - verified deduped rows merge provenance rather than silently dropping it | |
| - verified no exact span in the main file has more than one coarse type | |
| - verified ids are unique and deterministic | |
| ## Split files | |
| The repo also includes a mention-level stratified split built from `type_predictor_data.jsonl`: | |
| - `type_predictor_train.jsonl` | |
| - `type_predictor_val.jsonl` | |
| - `type_predictor_test.jsonl` | |
| - `split_summary.json` | |
| - `artifacts/split_assignments.jsonl` | |
| - `split_data.py` | |
| Split policy: | |
| 1. Start from the clean `type_predictor_data.jsonl`. | |
| 2. Perform a stratified `80/20` split by the `type` column with `random_state = 42`. | |
| 3. Split the holdout pool again, stratified by `type`, into equal halves. | |
| 4. Keep sentence overlap allowed across splits. | |
| 5. Preserve all original fields. | |
| 6. Add `evaluation_category` only to validation and test rows: | |
| - `unseen_sentence` | |
| - `seen_sentence_new_entity` | |
| Current split sizes: | |
| - train: `100,796` | |
| - validation: `12,600` | |
| - test: `12,600` | |
| Current evaluation-category counts: | |
| - validation `seen_sentence_new_entity`: `11,661` | |
| - validation `unseen_sentence`: `939` | |
| - test `seen_sentence_new_entity`: `11,606` | |
| - test `unseen_sentence`: `994` | |