Datasets:
Tasks:
Token Classification
Modalities:
Text
Languages:
English
Size:
100K - 1M
ArXiv:
Tags:
abbreviation-detection
License:
Commit
Β·
fe2f1d0
1
Parent(s):
50bda47
changes
Browse files- PLOD-filtered.py +136 -0
- README.md +2 -0
- PLOS-test15-filtered-pos_bio.json β data/PLOS-test15-filtered-pos_bio.json +0 -0
- PLOS-test15-unfiltered-pos_bio.json β data/PLOS-test15-unfiltered-pos_bio.json +0 -0
- PLOS-train70-filtered-pos_bio.json β data/PLOS-train70-filtered-pos_bio.json +0 -0
- PLOS-train70-unfiltered-pos_bio.json β data/PLOS-train70-unfiltered-pos_bio.json +0 -0
- PLOS-val15-filtered-pos_bio.json β data/PLOS-val15-filtered-pos_bio.json +0 -0
- PLOS-val15-unfiltered-pos_bio.json β data/PLOS-val15-unfiltered-pos_bio.json +0 -0
- random.ipynb +0 -0
PLOD-filtered.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
import datasets
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
logger = datasets.logging.get_logger(__name__)
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
_CITATION = """
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
_DESCRIPTION = """
|
| 13 |
+
This is the dataset repository for PLOD Dataset accepted to be published at LREC 2022.
|
| 14 |
+
The dataset can help build sequence labelling models for the task Abbreviation Detection.
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
_TRAINING_FILE = "./data/PLOS-train70-filtered-pos_bio.json"
|
| 18 |
+
_DEV_FILE = "./data/PLOS-val15-filtered-pos_bio.json"
|
| 19 |
+
_TEST_FILE = "./data/PLOS-test15-filtered-pos_bio.json"
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class PLODfilteredConfig(datasets.BuilderConfig):
|
| 23 |
+
"""BuilderConfig for Conll2003"""
|
| 24 |
+
|
| 25 |
+
def __init__(self, **kwargs):
|
| 26 |
+
"""BuilderConfig forConll2003.
|
| 27 |
+
Args:
|
| 28 |
+
**kwargs: keyword arguments forwarded to super.
|
| 29 |
+
"""
|
| 30 |
+
super(PLODfilteredConfig, self).__init__(**kwargs)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class PLODfilteredConfig(datasets.GeneratorBasedBuilder):
|
| 34 |
+
"""PLOD Filtered dataset."""
|
| 35 |
+
|
| 36 |
+
BUILDER_CONFIGS = [
|
| 37 |
+
PLODfilteredConfig(name="PLODfiltered", version=datasets.Version("0.0.2"), description="PLOD filtered dataset"),
|
| 38 |
+
]
|
| 39 |
+
|
| 40 |
+
def _info(self):
|
| 41 |
+
return datasets.DatasetInfo(
|
| 42 |
+
description=_DESCRIPTION,
|
| 43 |
+
features=datasets.Features(
|
| 44 |
+
{
|
| 45 |
+
"id": datasets.Value("string"),
|
| 46 |
+
"tokens": datasets.Sequence(datasets.Value("string")),
|
| 47 |
+
"pos_tags": datasets.Sequence(
|
| 48 |
+
datasets.features.ClassLabel(
|
| 49 |
+
names=[
|
| 50 |
+
"ADJ",
|
| 51 |
+
"ADP",
|
| 52 |
+
"ADV",
|
| 53 |
+
"AUX",
|
| 54 |
+
"CONJ",
|
| 55 |
+
"CCONJ",
|
| 56 |
+
"DET",
|
| 57 |
+
"INTJ",
|
| 58 |
+
"NOUN",
|
| 59 |
+
"NUM",
|
| 60 |
+
"PART",
|
| 61 |
+
"PRON",
|
| 62 |
+
"PROPN",
|
| 63 |
+
"PUNCT",
|
| 64 |
+
"SCONJ",
|
| 65 |
+
"SYM",
|
| 66 |
+
"VERB",
|
| 67 |
+
"X",
|
| 68 |
+
"SPACE"
|
| 69 |
+
]
|
| 70 |
+
)
|
| 71 |
+
),
|
| 72 |
+
"ner_tags": datasets.Sequence(
|
| 73 |
+
datasets.features.ClassLabel(
|
| 74 |
+
names=[
|
| 75 |
+
"B-O",
|
| 76 |
+
"B-AC",
|
| 77 |
+
"I-AC",
|
| 78 |
+
"B-LF",
|
| 79 |
+
"I-LF"
|
| 80 |
+
]
|
| 81 |
+
)
|
| 82 |
+
),
|
| 83 |
+
}
|
| 84 |
+
),
|
| 85 |
+
supervised_keys=None,
|
| 86 |
+
homepage="https://github.com/surrey-nlp/PLOD-AbbreviationDetection",
|
| 87 |
+
citation=_CITATION,
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
def _split_generators(self, dl_manager):
|
| 91 |
+
"""Returns SplitGenerators."""
|
| 92 |
+
data_files = {
|
| 93 |
+
"train": os.path.join(_TRAINING_FILE),
|
| 94 |
+
"dev": os.path.join(_DEV_FILE),
|
| 95 |
+
"test": os.path.join(_TEST_FILE),
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
return [
|
| 99 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_files["train"]}),
|
| 100 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": data_files["dev"]}),
|
| 101 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": data_files["test"]}),
|
| 102 |
+
]
|
| 103 |
+
|
| 104 |
+
def _generate_examples(self, filepath):
|
| 105 |
+
logger.info("β³ Generating examples from = %s", filepath)
|
| 106 |
+
with open(filepath, encoding="utf-8") as f:
|
| 107 |
+
guid = 0
|
| 108 |
+
tokens = []
|
| 109 |
+
pos_tags = []
|
| 110 |
+
ner_tags = []
|
| 111 |
+
for line in f:
|
| 112 |
+
if line.startswith("-DOCSTART-") or line == "" or line == "\n":
|
| 113 |
+
if tokens:
|
| 114 |
+
yield guid, {
|
| 115 |
+
"id": str(guid),
|
| 116 |
+
"tokens": tokens,
|
| 117 |
+
"pos_tags": pos_tags,
|
| 118 |
+
"ner_tags": ner_tags,
|
| 119 |
+
}
|
| 120 |
+
guid += 1
|
| 121 |
+
tokens = []
|
| 122 |
+
pos_tags = []
|
| 123 |
+
ner_tags = []
|
| 124 |
+
else:
|
| 125 |
+
# conll2003 tokens are space separated
|
| 126 |
+
splits = line.split(" ")
|
| 127 |
+
tokens.append(splits[0])
|
| 128 |
+
pos_tags.append(splits[1].strip())
|
| 129 |
+
ner_tags.append(splits[2].strip())
|
| 130 |
+
# last example
|
| 131 |
+
yield guid, {
|
| 132 |
+
"id": str(guid),
|
| 133 |
+
"tokens": tokens,
|
| 134 |
+
"pos_tags": pos_tags,
|
| 135 |
+
"ner_tags": ner_tags,
|
| 136 |
+
}
|
README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: cc-by-sa-4.0
|
| 3 |
---
|
|
|
|
| 1 |
+
# PLOD Abbreviation Detection Dataset
|
| 2 |
+
|
| 3 |
---
|
| 4 |
license: cc-by-sa-4.0
|
| 5 |
---
|
PLOS-test15-filtered-pos_bio.json β data/PLOS-test15-filtered-pos_bio.json
RENAMED
|
File without changes
|
PLOS-test15-unfiltered-pos_bio.json β data/PLOS-test15-unfiltered-pos_bio.json
RENAMED
|
File without changes
|
PLOS-train70-filtered-pos_bio.json β data/PLOS-train70-filtered-pos_bio.json
RENAMED
|
File without changes
|
PLOS-train70-unfiltered-pos_bio.json β data/PLOS-train70-unfiltered-pos_bio.json
RENAMED
|
File without changes
|
PLOS-val15-filtered-pos_bio.json β data/PLOS-val15-filtered-pos_bio.json
RENAMED
|
File without changes
|
PLOS-val15-unfiltered-pos_bio.json β data/PLOS-val15-unfiltered-pos_bio.json
RENAMED
|
File without changes
|
random.ipynb
ADDED
|
File without changes
|