bigscience-workshop / bigscience-workshop/biomedical
bc5cdr offsets wrong for some entities
- Dominant language
- Python
- Stars
- 505
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Description
## Describe the bug
Some entity offsets for bc5cdr are off by a few characters
## Steps to reproduce the bug
```python
from bigbio.dataloader import BigBioConfigHelpers
data = conhelps.for_config_name("bc5cdr_bigbio_kb").load_dataset()
for doc in data['train']:
for e in doc['entities']:
for t, offset in zip(e["text"], e["offsets"]):
st = offset[0]
ed = offset[1]
# Code to print out offending instances
if t != text[st:ed]:
print(f'pmid: {pmid}')
print(f"entity: {e}")
print(f"entity text: {t}")
print(f'text in article: {text[st:ed]}')
assert t == text[st:ed]
```
## Expected results
The above code should run without incident and shout print any failing instances
## Actual results
The above code fails with an AssertionError. The following instances are in error:
**Train**
1. {'id': '4819', 'type': 'Disease', 'text': ['colorectal', 'cancers'], 'offsets': [[187, 197], [223, 230]], 'normalized': [{'db_name': 'MESH', 'db_id': 'D015179'}]}
2. {'id': '7352', 'type': 'Disease', 'text': ['opistothonus', 'dysfunction'], 'offsets': [[447, 459], [478, 489]], 'normalized': [{'db_name': 'MESH', 'db_id': 'D020258'}]}
3. {'id': '20136', 'type': 'Disease', 'text': ['midline (MD) defects'], 'offsets': [[946, 966]], 'normalized': [{'db_name': 'MESH', 'db_id': 'D009436'}]}
**Validation**
1. {'id': '4124', 'type': 'Disease', 'text': ['atypical absence', 'seizures'], 'offsets': [[247, 263], [293, 301]], 'normalized': [{'db_name': 'MESH', 'db_id': 'D004832'}]}
**Test**
No errors
## Environment info
- `datasets` version: 2.1.0
- Platform: Linux-5.4.0-1072-aws-x86_64-with-glibc2.27
- Python version: 3.9.13
- PyArrow version: 8.0.0
- Pandas version: 1.3.3
Contributor guide
Assessment
This issue has not been assessed yet.