Datasets:
Tasks:
Token Classification
Modalities:
Text
Sub-tasks:
named-entity-recognition
Languages:
English
Size:
10K - 100K
License:
init
Browse files- README.md +68 -0
- bc5cdr.py +77 -0
- dataset/label.json +1 -0
- dataset/test.json +0 -0
- dataset/train.json +0 -0
- dataset/valid.json +0 -0
README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license:
|
| 5 |
+
- other
|
| 6 |
+
multilinguality:
|
| 7 |
+
- monolingual
|
| 8 |
+
size_categories:
|
| 9 |
+
- 10K<n<100K
|
| 10 |
+
task_categories:
|
| 11 |
+
- token-classification
|
| 12 |
+
task_ids:
|
| 13 |
+
- named-entity-recognition
|
| 14 |
+
pretty_name: Ontonotes5
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# Dataset Card for "tner/ontonotes5"
|
| 18 |
+
|
| 19 |
+
## Dataset Description
|
| 20 |
+
|
| 21 |
+
- **Repository:** [T-NER](https://github.com/asahi417/tner)
|
| 22 |
+
- **Paper:** [https://academic.oup.com/database/article/doi/10.1093/database/baw032/2630271?login=true](https://academic.oup.com/database/article/doi/10.1093/database/baw032/2630271?login=true)
|
| 23 |
+
|
| 24 |
+
### Dataset Summary
|
| 25 |
+
Ontonotes5 NER dataset formatted in a part of [TNER](https://github.com/asahi417/tner) project.
|
| 26 |
+
|
| 27 |
+
## Dataset Structure
|
| 28 |
+
|
| 29 |
+
### Data Instances
|
| 30 |
+
An example of `train` looks as follows.
|
| 31 |
+
|
| 32 |
+
```
|
| 33 |
+
{
|
| 34 |
+
'tags': [2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0],
|
| 35 |
+
'tokens': ['Fasciculations', 'in', 'six', 'areas', 'of', 'the', 'body', 'were', 'scored', 'from', '0', 'to', '3', 'and', 'summated', 'as', 'a', 'total', 'fasciculation', 'score', '.']
|
| 36 |
+
}
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
### Label ID
|
| 40 |
+
The label2id dictionary can be found at [here](https://huggingface.co/datasets/tner/bc5cdr/raw/main/dataset/label.json).
|
| 41 |
+
```python
|
| 42 |
+
{
|
| 43 |
+
"O": 0,
|
| 44 |
+
"B-Chemical": 1,
|
| 45 |
+
"B-Disease": 2,
|
| 46 |
+
"I-Disease": 3,
|
| 47 |
+
"I-Chemical": 4
|
| 48 |
+
}
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
### Data Splits
|
| 52 |
+
|
| 53 |
+
| name |train|validation|test|
|
| 54 |
+
|---------|----:|---------:|---:|
|
| 55 |
+
|bc5cdr|5228| 5330|5865|
|
| 56 |
+
|
| 57 |
+
### Citation Information
|
| 58 |
+
|
| 59 |
+
```
|
| 60 |
+
@article{wei2016assessing,
|
| 61 |
+
title={Assessing the state of the art in biomedical relation extraction: overview of the BioCreative V chemical-disease relation (CDR) task},
|
| 62 |
+
author={Wei, Chih-Hsuan and Peng, Yifan and Leaman, Robert and Davis, Allan Peter and Mattingly, Carolyn J and Li, Jiao and Wiegers, Thomas C and Lu, Zhiyong},
|
| 63 |
+
journal={Database},
|
| 64 |
+
volume={2016},
|
| 65 |
+
year={2016},
|
| 66 |
+
publisher={Oxford Academic}
|
| 67 |
+
}
|
| 68 |
+
```
|
bc5cdr.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
""" NER dataset compiled by T-NER library https://github.com/asahi417/tner/tree/master/tner """
|
| 2 |
+
import json
|
| 3 |
+
from itertools import chain
|
| 4 |
+
import datasets
|
| 5 |
+
|
| 6 |
+
logger = datasets.logging.get_logger(__name__)
|
| 7 |
+
_DESCRIPTION = """[Bio Creative 5 CDR NER dataset](https://academic.oup.com/database/article/doi/10.1093/database/baw032/2630271?login=true)"""
|
| 8 |
+
_NAME = "bc5cdr"
|
| 9 |
+
_VERSION = "1.0.0"
|
| 10 |
+
_CITATION = """
|
| 11 |
+
@article{wei2016assessing,
|
| 12 |
+
title={Assessing the state of the art in biomedical relation extraction: overview of the BioCreative V chemical-disease relation (CDR) task},
|
| 13 |
+
author={Wei, Chih-Hsuan and Peng, Yifan and Leaman, Robert and Davis, Allan Peter and Mattingly, Carolyn J and Li, Jiao and Wiegers, Thomas C and Lu, Zhiyong},
|
| 14 |
+
journal={Database},
|
| 15 |
+
volume={2016},
|
| 16 |
+
year={2016},
|
| 17 |
+
publisher={Oxford Academic}
|
| 18 |
+
}
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
_HOME_PAGE = "https://github.com/asahi417/tner"
|
| 22 |
+
_URL = f'https://huggingface.co/datasets/tner/{_NAME}/raw/main/dataset'
|
| 23 |
+
_URLS = {
|
| 24 |
+
str(datasets.Split.TEST): [f'{_URL}/test.json'],
|
| 25 |
+
str(datasets.Split.TRAIN): [f'{_URL}/train.json'],
|
| 26 |
+
str(datasets.Split.VALIDATION): [f'{_URL}/valid.json'],
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class BC5CDRConfig(datasets.BuilderConfig):
|
| 31 |
+
"""BuilderConfig"""
|
| 32 |
+
|
| 33 |
+
def __init__(self, **kwargs):
|
| 34 |
+
"""BuilderConfig.
|
| 35 |
+
|
| 36 |
+
Args:
|
| 37 |
+
**kwargs: keyword arguments forwarded to super.
|
| 38 |
+
"""
|
| 39 |
+
super(BC5CDRConfig, self).__init__(**kwargs)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class BC5CDR(datasets.GeneratorBasedBuilder):
|
| 43 |
+
"""Dataset."""
|
| 44 |
+
|
| 45 |
+
BUILDER_CONFIGS = [
|
| 46 |
+
BC5CDRConfig(name=_NAME, version=datasets.Version(_VERSION), description=_DESCRIPTION),
|
| 47 |
+
]
|
| 48 |
+
|
| 49 |
+
def _split_generators(self, dl_manager):
|
| 50 |
+
downloaded_file = dl_manager.download_and_extract(_URLS)
|
| 51 |
+
return [datasets.SplitGenerator(name=i, gen_kwargs={"filepaths": downloaded_file[str(i)]})
|
| 52 |
+
for i in [datasets.Split.TRAIN, datasets.Split.VALIDATION, datasets.Split.TEST]]
|
| 53 |
+
|
| 54 |
+
def _generate_examples(self, filepaths):
|
| 55 |
+
_key = 0
|
| 56 |
+
for filepath in filepaths:
|
| 57 |
+
logger.info(f"generating examples from = {filepath}")
|
| 58 |
+
with open(filepath, encoding="utf-8") as f:
|
| 59 |
+
_list = [i for i in f.read().split('\n') if len(i) > 0]
|
| 60 |
+
for i in _list:
|
| 61 |
+
data = json.loads(i)
|
| 62 |
+
yield _key, data
|
| 63 |
+
_key += 1
|
| 64 |
+
|
| 65 |
+
def _info(self):
|
| 66 |
+
return datasets.DatasetInfo(
|
| 67 |
+
description=_DESCRIPTION,
|
| 68 |
+
features=datasets.Features(
|
| 69 |
+
{
|
| 70 |
+
"tokens": datasets.Sequence(datasets.Value("string")),
|
| 71 |
+
"tags": datasets.Sequence(datasets.Value("int32")),
|
| 72 |
+
}
|
| 73 |
+
),
|
| 74 |
+
supervised_keys=None,
|
| 75 |
+
homepage=_HOME_PAGE,
|
| 76 |
+
citation=_CITATION,
|
| 77 |
+
)
|
dataset/label.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"O": 0, "B-Chemical": 1, "B-Disease": 2, "I-Disease": 3, "I-Chemical": 4}
|
dataset/test.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dataset/train.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dataset/valid.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|