parquet-converter
commited on
Commit
·
1902832
1
Parent(s):
a5c47a2
Update parquet files
Browse files- .DS_Store +0 -0
- data/.DS_Store +0 -0
- data/dev.conll +0 -0
- data/test.conll +0 -0
- data/train.conll +0 -0
- shared-task.py +0 -113
- shared/shared-task-test.parquet +3 -0
- shared/shared-task-train.parquet +3 -0
- shared/shared-task-validation.parquet +3 -0
.DS_Store
DELETED
Binary file (6.15 kB)
|
|
data/.DS_Store
DELETED
Binary file (6.15 kB)
|
|
data/dev.conll
DELETED
The diff for this file is too large to render.
See raw diff
|
|
data/test.conll
DELETED
The diff for this file is too large to render.
See raw diff
|
|
data/train.conll
DELETED
The diff for this file is too large to render.
See raw diff
|
|
shared-task.py
DELETED
@@ -1,113 +0,0 @@
|
|
1 |
-
import datasets
|
2 |
-
|
3 |
-
|
4 |
-
logger = datasets.logging.get_logger(__name__)
|
5 |
-
|
6 |
-
|
7 |
-
_CITATION = """\
|
8 |
-
|
9 |
-
"""
|
10 |
-
|
11 |
-
_DESCRIPTION = """\
|
12 |
-
|
13 |
-
|
14 |
-
"""
|
15 |
-
|
16 |
-
_URL = "https://huggingface.co/datasets/mrojas/shared-task/resolve/main/data/"
|
17 |
-
_TRAINING_FILE = "train.conll"
|
18 |
-
_DEV_FILE = "dev.conll"
|
19 |
-
_TEST_FILE = "test.conll"
|
20 |
-
|
21 |
-
|
22 |
-
class SharedConfig(datasets.BuilderConfig):
|
23 |
-
"""BuilderConfig for Shared Task"""
|
24 |
-
|
25 |
-
def __init__(self, **kwargs):
|
26 |
-
"""BuilderConfig for Shared Task.
|
27 |
-
Args:
|
28 |
-
**kwargs: keyword arguments forwarded to super.
|
29 |
-
"""
|
30 |
-
super(SharedConfig, self).__init__(**kwargs)
|
31 |
-
|
32 |
-
|
33 |
-
class Shared(datasets.GeneratorBasedBuilder):
|
34 |
-
"""Shared dataset."""
|
35 |
-
|
36 |
-
BUILDER_CONFIGS = [
|
37 |
-
SharedConfig(name="shared", version=datasets.Version("1.0.0"), description="Shared dataset"),
|
38 |
-
]
|
39 |
-
|
40 |
-
def _info(self):
|
41 |
-
return datasets.DatasetInfo(
|
42 |
-
description=_DESCRIPTION,
|
43 |
-
features=datasets.Features(
|
44 |
-
{
|
45 |
-
"tokens": datasets.Sequence(datasets.Value("string")),
|
46 |
-
"ner_tags": datasets.Sequence(
|
47 |
-
datasets.features.ClassLabel(
|
48 |
-
names=[
|
49 |
-
"B-EXPLORATION",
|
50 |
-
"I-EXPLORATION",
|
51 |
-
"B-PRESENT_ILLNESS",
|
52 |
-
"I-PRESENT_ILLNESS",
|
53 |
-
"B-TREATMENT",
|
54 |
-
"I-TREATMENT",
|
55 |
-
"B-EVOLUTION",
|
56 |
-
"I-EVOLUTION",
|
57 |
-
"B-PAST_MEDICAL_HISTORY",
|
58 |
-
"I-PAST_MEDICAL_HISTORY",
|
59 |
-
"B-DERIVED_FROM/TO",
|
60 |
-
"I-DERIVED_FROM/TO",
|
61 |
-
"B-FAMILY_HISTORY",
|
62 |
-
"I-FAMILY_HISTORY",
|
63 |
-
]
|
64 |
-
)
|
65 |
-
),
|
66 |
-
}
|
67 |
-
),
|
68 |
-
supervised_keys=None,
|
69 |
-
homepage="",
|
70 |
-
citation=_CITATION,
|
71 |
-
)
|
72 |
-
|
73 |
-
def _split_generators(self, dl_manager):
|
74 |
-
"""Returns SplitGenerators."""
|
75 |
-
urls_to_download = {
|
76 |
-
"train": f"{_URL}{_TRAINING_FILE}",
|
77 |
-
"dev": f"{_URL}{_DEV_FILE}",
|
78 |
-
"test": f"{_URL}{_TEST_FILE}",
|
79 |
-
}
|
80 |
-
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
81 |
-
|
82 |
-
return [
|
83 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
84 |
-
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
|
85 |
-
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
|
86 |
-
]
|
87 |
-
|
88 |
-
def _generate_examples(self, filepath):
|
89 |
-
logger.info("⏳ Generating examples from = %s", filepath)
|
90 |
-
with open(filepath, encoding="utf-8") as f:
|
91 |
-
id_ = 0
|
92 |
-
tokens = []
|
93 |
-
ner_tags = []
|
94 |
-
for line in f:
|
95 |
-
if line == "" or line == "\n":
|
96 |
-
if tokens:
|
97 |
-
yield id_, {
|
98 |
-
"tokens": tokens,
|
99 |
-
"ner_tags": ner_tags,
|
100 |
-
}
|
101 |
-
id_ += 1
|
102 |
-
tokens = []
|
103 |
-
ner_tags = []
|
104 |
-
else:
|
105 |
-
# conll2003 tokens are space separated
|
106 |
-
splits = line.split(" ")
|
107 |
-
tokens.append(splits[0])
|
108 |
-
ner_tags.append(splits[1].rstrip())
|
109 |
-
# last example
|
110 |
-
yield id_, {
|
111 |
-
"tokens": tokens,
|
112 |
-
"ner_tags": ner_tags,
|
113 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shared/shared-task-test.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fcbc954ba6917cada5856b1f93053594c484ba4175a35a82488614f3aec8913e
|
3 |
+
size 33422
|
shared/shared-task-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dcc2784e73296fd01bd393d0872aa3083627406aac9637763a6447b7d1312d27
|
3 |
+
size 285656
|
shared/shared-task-validation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ea575a67d2b80a828c9e417968cdb324247b2c8281a5e472be54b4134e135eb6
|
3 |
+
size 25724
|