Datasets:
Commit
·
cbb49c7
0
Parent(s):
Update files from the datasets library (from 1.0.2)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.0.2
- .gitattributes +27 -0
- conll2003.py +134 -0
- dataset_infos.json +1 -0
- dummy/conll2003/1.0.0/dummy_data.zip +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
conll2003.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2020 HuggingFace Datasets Authors.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
|
| 16 |
+
# Lint as: python3
|
| 17 |
+
"""Introduction to the CoNLL-2003 Shared Task: Language-Independent Named Entity Recognition"""
|
| 18 |
+
|
| 19 |
+
import logging
|
| 20 |
+
|
| 21 |
+
import datasets
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
_CITATION = """\
|
| 25 |
+
@inproceedings{tjong-kim-sang-de-meulder-2003-introduction,
|
| 26 |
+
title = "Introduction to the {C}o{NLL}-2003 Shared Task: Language-Independent Named Entity Recognition",
|
| 27 |
+
author = "Tjong Kim Sang, Erik F. and
|
| 28 |
+
De Meulder, Fien",
|
| 29 |
+
booktitle = "Proceedings of the Seventh Conference on Natural Language Learning at {HLT}-{NAACL} 2003",
|
| 30 |
+
year = "2003",
|
| 31 |
+
url = "https://www.aclweb.org/anthology/W03-0419",
|
| 32 |
+
pages = "142--147",
|
| 33 |
+
}
|
| 34 |
+
"""
|
| 35 |
+
|
| 36 |
+
_DESCRIPTION = """\
|
| 37 |
+
The shared task of CoNLL-2003 concerns language-independent named entity recognition. We will concentrate on
|
| 38 |
+
four types of named entities: persons, locations, organizations and names of miscellaneous entities that do
|
| 39 |
+
not belong to the previous three groups.
|
| 40 |
+
|
| 41 |
+
The CoNLL-2003 shared task data files contain four columns separated by a single space. Each word has been put on
|
| 42 |
+
a separate line and there is an empty line after each sentence. The first item on each line is a word, the second
|
| 43 |
+
a part-of-speech (POS) tag, the third a syntactic chunk tag and the fourth the named entity tag. The chunk tags
|
| 44 |
+
and the named entity tags have the format I-TYPE which means that the word is inside a phrase of type TYPE. Only
|
| 45 |
+
if two phrases of the same type immediately follow each other, the first word of the second phrase will have tag
|
| 46 |
+
B-TYPE to show that it starts a new phrase. A word with tag O is not part of a phrase. Note the dataset uses IOB2
|
| 47 |
+
tagging scheme, whereas the original dataset uses IOB1.
|
| 48 |
+
|
| 49 |
+
For more details see https://www.clips.uantwerpen.be/conll2003/ner/ and https://www.aclweb.org/anthology/W03-0419
|
| 50 |
+
"""
|
| 51 |
+
|
| 52 |
+
_URL = "https://github.com/davidsbatista/NER-datasets/raw/master/CONLL2003/"
|
| 53 |
+
_TRAINING_FILE = "train.txt"
|
| 54 |
+
_DEV_FILE = "valid.txt"
|
| 55 |
+
_TEST_FILE = "test.txt"
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
class Conll2003Config(datasets.BuilderConfig):
|
| 59 |
+
"""BuilderConfig for Conll2003"""
|
| 60 |
+
|
| 61 |
+
def __init__(self, **kwargs):
|
| 62 |
+
"""BuilderConfig forConll2003.
|
| 63 |
+
|
| 64 |
+
Args:
|
| 65 |
+
**kwargs: keyword arguments forwarded to super.
|
| 66 |
+
"""
|
| 67 |
+
super(Conll2003Config, self).__init__(**kwargs)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
class Conll2003(datasets.GeneratorBasedBuilder):
|
| 71 |
+
"""Conll2003 dataset."""
|
| 72 |
+
|
| 73 |
+
BUILDER_CONFIGS = [
|
| 74 |
+
Conll2003Config(name="conll2003", version=datasets.Version("1.0.0"), description="Conll2003 dataset"),
|
| 75 |
+
]
|
| 76 |
+
|
| 77 |
+
def _info(self):
|
| 78 |
+
return datasets.DatasetInfo(
|
| 79 |
+
description=_DESCRIPTION,
|
| 80 |
+
features=datasets.Features(
|
| 81 |
+
{
|
| 82 |
+
"id": datasets.Value("string"),
|
| 83 |
+
"words": datasets.Sequence(datasets.Value("string")),
|
| 84 |
+
"pos": datasets.Sequence(datasets.Value("string")),
|
| 85 |
+
"chunk": datasets.Sequence(datasets.Value("string")),
|
| 86 |
+
"ner": datasets.Sequence(datasets.Value("string")),
|
| 87 |
+
}
|
| 88 |
+
),
|
| 89 |
+
supervised_keys=None,
|
| 90 |
+
homepage="https://www.aclweb.org/anthology/W03-0419/",
|
| 91 |
+
citation=_CITATION,
|
| 92 |
+
)
|
| 93 |
+
|
| 94 |
+
def _split_generators(self, dl_manager):
|
| 95 |
+
"""Returns SplitGenerators."""
|
| 96 |
+
urls_to_download = {
|
| 97 |
+
"train": f"{_URL}{_TRAINING_FILE}",
|
| 98 |
+
"dev": f"{_URL}{_DEV_FILE}",
|
| 99 |
+
"test": f"{_URL}{_TEST_FILE}",
|
| 100 |
+
}
|
| 101 |
+
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
| 102 |
+
|
| 103 |
+
return [
|
| 104 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
| 105 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
|
| 106 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
|
| 107 |
+
]
|
| 108 |
+
|
| 109 |
+
def _generate_examples(self, filepath):
|
| 110 |
+
logging.info("⏳ Generating examples from = %s", filepath)
|
| 111 |
+
with open(filepath, encoding="utf-8") as f:
|
| 112 |
+
guid = 0
|
| 113 |
+
words = []
|
| 114 |
+
pos = []
|
| 115 |
+
chunk = []
|
| 116 |
+
ner = []
|
| 117 |
+
for line in f:
|
| 118 |
+
if line.startswith("-DOCSTART-") or line == "" or line == "\n":
|
| 119 |
+
if words:
|
| 120 |
+
yield guid, {"id": str(guid), "words": words, "pos": pos, "chunk": chunk, "ner": ner}
|
| 121 |
+
guid += 1
|
| 122 |
+
words = []
|
| 123 |
+
pos = []
|
| 124 |
+
chunk = []
|
| 125 |
+
ner = []
|
| 126 |
+
else:
|
| 127 |
+
# conll2003 tokens are space separated
|
| 128 |
+
splits = line.split(" ")
|
| 129 |
+
words.append(splits[0])
|
| 130 |
+
pos.append(splits[1])
|
| 131 |
+
chunk.append(splits[2])
|
| 132 |
+
ner.append(splits[3].rstrip())
|
| 133 |
+
# last example
|
| 134 |
+
yield guid, {"id": str(guid), "words": words, "pos": pos, "chunk": chunk, "ner": ner}
|
dataset_infos.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"conll2003": {"description": "The shared task of CoNLL-2003 concerns language-independent named entity recognition. We will concentrate on\nfour types of named entities: persons, locations, organizations and names of miscellaneous entities that do\nnot belong to the previous three groups.\n\nThe CoNLL-2003 shared task data files contain four columns separated by a single space. Each word has been put on\na separate line and there is an empty line after each sentence. The first item on each line is a word, the second\na part-of-speech (POS) tag, the third a syntactic chunk tag and the fourth the named entity tag. The chunk tags\nand the named entity tags have the format I-TYPE which means that the word is inside a phrase of type TYPE. Only\nif two phrases of the same type immediately follow each other, the first word of the second phrase will have tag\nB-TYPE to show that it starts a new phrase. A word with tag O is not part of a phrase. Note the dataset uses IOB2\ntagging scheme, whereas the original dataset uses IOB1.\n\nFor more details see https://www.clips.uantwerpen.be/conll2003/ner/ and https://www.aclweb.org/anthology/W03-0419\n", "citation": "@inproceedings{tjong-kim-sang-de-meulder-2003-introduction,\n title = \"Introduction to the {C}o{NLL}-2003 Shared Task: Language-Independent Named Entity Recognition\",\n author = \"Tjong Kim Sang, Erik F. and\n De Meulder, Fien\",\n booktitle = \"Proceedings of the Seventh Conference on Natural Language Learning at {HLT}-{NAACL} 2003\",\n year = \"2003\",\n url = \"https://www.aclweb.org/anthology/W03-0419\",\n pages = \"142--147\",\n}\n", "homepage": "https://www.aclweb.org/anthology/W03-0419/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "words": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "pos": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "chunk": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "ner": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "conll2003", "config_name": "conll2003", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 6032006, "num_examples": 14041, "dataset_name": "conll2003"}, "validation": {"name": "validation", "num_bytes": 1512711, "num_examples": 3250, "dataset_name": "conll2003"}, "test": {"name": "test", "num_bytes": 1378578, "num_examples": 3453, "dataset_name": "conll2003"}}, "download_checksums": {"https://github.com/davidsbatista/NER-datasets/raw/master/CONLL2003/train.txt": {"num_bytes": 3283418, "checksum": "c99b26852dabf57ca9d30a0e892b84544cc8962003151e14a71077c55dc66db5"}, "https://github.com/davidsbatista/NER-datasets/raw/master/CONLL2003/valid.txt": {"num_bytes": 827441, "checksum": "f1f6469322876887de1d04acd43c59b02f59d5b02acf42c027132fa1bf349cb2"}, "https://github.com/davidsbatista/NER-datasets/raw/master/CONLL2003/test.txt": {"num_bytes": 748093, "checksum": "82e0c72d262f86ad3e78b15c5d980bbf87cb205aa4bf6d2d97643f463f8d7ff7"}}, "download_size": 4858952, "post_processing_size": null, "dataset_size": 8923295, "size_in_bytes": 13782247}}
|
dummy/conll2003/1.0.0/dummy_data.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2ced2b276e296a0abc2b541e84fff634995da993037485b30754a518794a1442
|
| 3 |
+
size 1379
|