Datasets:
Tasks:
Token Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
named-entity-recognition
Languages:
Romanian
Size:
10K - 100K
ArXiv:
License:
Commit
·
2b86e45
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +154 -0
- dataset_infos.json +1 -0
- dummy/ronec/1.0.0/dummy_data.zip +3 -0
- ronec.py +187 -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
|
README.md
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
language_creators:
|
5 |
+
- expert-generated
|
6 |
+
- found
|
7 |
+
languages:
|
8 |
+
- ro
|
9 |
+
licenses:
|
10 |
+
- mit
|
11 |
+
multilinguality:
|
12 |
+
- monolingual
|
13 |
+
size_categories:
|
14 |
+
- 1K<n<10K
|
15 |
+
source_datasets:
|
16 |
+
- original
|
17 |
+
task_categories:
|
18 |
+
- structure-prediction
|
19 |
+
task_ids:
|
20 |
+
- named-entity-recognition
|
21 |
+
---
|
22 |
+
|
23 |
+
# Dataset Card for RONEC
|
24 |
+
|
25 |
+
## Table of Contents
|
26 |
+
- [Dataset Description](#dataset-description)
|
27 |
+
- [Dataset Summary](#dataset-summary)
|
28 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
29 |
+
- [Languages](#languages)
|
30 |
+
- [Dataset Structure](#dataset-structure)
|
31 |
+
- [Data Instances](#data-instances)
|
32 |
+
- [Data Fields](#data-instances)
|
33 |
+
- [Data Splits](#data-instances)
|
34 |
+
- [Dataset Creation](#dataset-creation)
|
35 |
+
- [Curation Rationale](#curation-rationale)
|
36 |
+
- [Source Data](#source-data)
|
37 |
+
- [Annotations](#annotations)
|
38 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
39 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
40 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
41 |
+
- [Discussion of Biases](#discussion-of-biases)
|
42 |
+
- [Other Known Limitations](#other-known-limitations)
|
43 |
+
- [Additional Information](#additional-information)
|
44 |
+
- [Dataset Curators](#dataset-curators)
|
45 |
+
- [Licensing Information](#licensing-information)
|
46 |
+
- [Citation Information](#citation-information)
|
47 |
+
|
48 |
+
## Dataset Description
|
49 |
+
|
50 |
+
- **Homepage:** https://github.com/dumitrescustefan/ronec
|
51 |
+
- **Repository:** https://github.com/dumitrescustefan/ronec
|
52 |
+
- **Paper:** https://arxiv.org/abs/1909.01247
|
53 |
+
- **Leaderboard:** [Needs More Information]
|
54 |
+
- **Point of Contact:** [email protected], [email protected]
|
55 |
+
|
56 |
+
### Dataset Summary
|
57 |
+
|
58 |
+
We present RONEC - the Named Entity Corpus for the Romanian language. The corpus contains over 26000 entities in 5000 annotatedsentences, belonging to 16 distinct classes. The sentenceshave been extracted from a copy-right free newspaper, covering severalstyles. This corpus represents the first initiative in the Romanian language space specifically targeted for named entity recognition.
|
59 |
+
|
60 |
+
### Supported Tasks and Leaderboards
|
61 |
+
|
62 |
+
[Needs More Information]
|
63 |
+
|
64 |
+
### Languages
|
65 |
+
|
66 |
+
The text dataset is in Romanian (`ro`)
|
67 |
+
|
68 |
+
## Dataset Structure
|
69 |
+
|
70 |
+
### Data Instances
|
71 |
+
|
72 |
+
An example looks like this:
|
73 |
+
|
74 |
+
```
|
75 |
+
{'id': '1',
|
76 |
+
'ner_tags': [13, 29, 29, 0, 4, 0, 13, 29, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0],
|
77 |
+
'tokens': ['Secretarul', 'de', 'stat', 'al', 'S.U.A.', ',', 'Colin', 'Powell', ',', 'începe', 'un', 'turneu', 'în', 'țările', 'asiatice', 'afectate', 'de', 'valurile', 'seismice', 'uriașe', '.']
|
78 |
+
}
|
79 |
+
```
|
80 |
+
|
81 |
+
### Data Fields
|
82 |
+
|
83 |
+
- `id`: a `string` feature describing the index of the sentence in the dataset
|
84 |
+
- `tokens`: a `list` of `string` features.
|
85 |
+
- `ner_tags`: a `list` of classification labels, with possible values including `O`, `B-DATETIME`, `B-EVENT`, `B-FACILITY`, `B-GPE`, `B-LANGUAGE`, `B-LOC`, `B-MONEY`, `B-NAT_REL_POL`, `B-NUMERIC_VALUE`, `B-ORDINAL`, `B-ORGANIZATION`, `B-PERIOD`, `B-PERSON`, `B-PRODUCT`, `B-QUANTITY`, `B-WORK_OF_ART`, `I-DATETIME`, `I-EVENT`, `I-FACILITY`, `I-GPE`, `I-LANGUAGE`, `I-LOC`, `I-MONEY`, `I-NAT_REL_POL`, `I-NUMERIC_VALUE`, `I-ORDINAL`, `I-ORGANIZATION`, `I-PERIOD`, `I-PERSON`, `I-PRODUCT`, `I-QUANTITY`, `I-WORK_OF_ART`.
|
86 |
+
|
87 |
+
### Data Splits
|
88 |
+
|
89 |
+
The dataset was also split in train (80%), dev (10%) and test (10%)
|
90 |
+
|
91 |
+
## Dataset Creation
|
92 |
+
|
93 |
+
### Curation Rationale
|
94 |
+
|
95 |
+
From the original paper:
|
96 |
+
|
97 |
+
*The corpus, at its current version 1.0 is composed of5127 sentences, annotated with16 classes, for a totalof26377 annotated entities. The 16 classes are: PER-SON, NATRELPOL, ORG, GPE, LOC, FACILITY,PRODUCT, EVENT, LANGUAGE, WORKOFART,DATETIME, PERIOD, MONEY, QUANTITY, NU-MERICVALUE and ORDINAL. It is based on copyright-free text extracted from SoutheastEuropean Times (SETimes) (Tyers and Alperen, 2010).The news portal has published10“news and views fromSoutheast Europe” in ten languages, including Romanian.SETimes has been used in the past for several annotatedcorpora, including parallel corpora for machine translation.For RONEC we have used a hand-picked11selection of sen-tences belonging to several categories*
|
98 |
+
|
99 |
+
### Source Data
|
100 |
+
|
101 |
+
#### Initial Data Collection and Normalization
|
102 |
+
|
103 |
+
*The corpus creation process involved a small number ofpeople that have voluntarily joined the initiative, with theauthors of this paper directing the work. Initially, wesearched for NER resources in Romanian, and found none.Then we looked at English resources and read the in-depthACE guide, out of which a 16-class draft evolved. We thenidentified a copy-right free text from which we hand-pickedsentences to maximize the amount of entities while main-taining style balance. The annotation process was a trial-and-error, with cycles composed of annotation, discussingconfusing entities, updating the annotation guide schematicand going through the corpus section again to correct enti-ties following guide changes.*
|
104 |
+
|
105 |
+
#### Who are the source language producers?
|
106 |
+
|
107 |
+
[Needs More Information]
|
108 |
+
|
109 |
+
### Annotations
|
110 |
+
|
111 |
+
#### Annotation process
|
112 |
+
|
113 |
+
*The corpus creation process involved a small number ofpeople that have voluntarily joined the initiative, with theauthors of this paper directing the work. Initially, wesearched for NER resources in Romanian, and found none.Then we looked at English resources and read the in-depthACE guide, out of which a 16-class draft evolved. We thenidentified a copy-right free text from which we hand-pickedsentences to maximize the amount of entities while main-taining style balance. The annotation process was a trial-and-error, with cycles composed of annotation, discussingconfusing entities, updating the annotation guide schematicand going through the corpus section again to correct enti-ties following guide changes.*
|
114 |
+
|
115 |
+
#### Who are the annotators?
|
116 |
+
|
117 |
+
Stefan Dumitrescu, Marius Avram
|
118 |
+
|
119 |
+
### Personal and Sensitive Information
|
120 |
+
|
121 |
+
[Needs More Information]
|
122 |
+
|
123 |
+
## Considerations for Using the Data
|
124 |
+
|
125 |
+
### Social Impact of Dataset
|
126 |
+
|
127 |
+
[Needs More Information]
|
128 |
+
|
129 |
+
### Discussion of Biases
|
130 |
+
|
131 |
+
[Needs More Information]
|
132 |
+
|
133 |
+
### Other Known Limitations
|
134 |
+
|
135 |
+
[Needs More Information]
|
136 |
+
|
137 |
+
## Additional Information
|
138 |
+
|
139 |
+
### Dataset Curators
|
140 |
+
|
141 |
+
[Needs More Information]
|
142 |
+
|
143 |
+
### Licensing Information
|
144 |
+
|
145 |
+
MIT License
|
146 |
+
|
147 |
+
### Citation Information
|
148 |
+
|
149 |
+
@article{dumitrescu2019introducing,
|
150 |
+
title={Introducing RONEC--the Romanian Named Entity Corpus},
|
151 |
+
author={Dumitrescu, Stefan Daniel and Avram, Andrei-Marius},
|
152 |
+
journal={arXiv preprint arXiv:1909.01247},
|
153 |
+
year={2019}
|
154 |
+
}
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"ronec": {"description": "The RONEC (Named Entity Corpus for the Romanian language) dataset contains over 26000 entities in ~5000 annotated sentence,\nbelonging to 16 distinct classes. It represents the first initiative in the Romanian language space specifically targeted for named entity recognition\n", "citation": "@article{dumitrescu2019introducing,\n title={Introducing RONEC--the Romanian Named Entity Corpus},\n author={Dumitrescu, Stefan Daniel and Avram, Andrei-Marius},\n journal={arXiv preprint arXiv:1909.01247},\n year={2019}\n}\n", "homepage": "https://github.com/dumitrescustefan/ronec", "license": "MIT License", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "ner_tags": {"feature": {"num_classes": 33, "names": ["O", "B-DATETIME", "B-EVENT", "B-FACILITY", "B-GPE", "B-LANGUAGE", "B-LOC", "B-MONEY", "B-NAT_REL_POL", "B-NUMERIC_VALUE", "B-ORDINAL", "B-ORGANIZATION", "B-PERIOD", "B-PERSON", "B-PRODUCT", "B-QUANTITY", "B-WORK_OF_ART", "I-DATETIME", "I-EVENT", "I-FACILITY", "I-GPE", "I-LANGUAGE", "I-LOC", "I-MONEY", "I-NAT_REL_POL", "I-NUMERIC_VALUE", "I-ORDINAL", "I-ORGANIZATION", "I-PERIOD", "I-PERSON", "I-PRODUCT", "I-QUANTITY", "I-WORK_OF_ART"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "ronec", "config_name": "ronec", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2518890, "num_examples": 4173, "dataset_name": "ronec"}, "test": {"name": "test", "num_bytes": 317141, "num_examples": 522, "dataset_name": "ronec"}, "validation": {"name": "validation", "num_bytes": 320904, "num_examples": 522, "dataset_name": "ronec"}}, "download_checksums": {"https://raw.githubusercontent.com/dumitrescustefan/ronec/master/ronec/conllup/raw/train.conllu": {"num_bytes": 11583235, "checksum": "686b230c30866afa4b9c4b2b511062c2562e84af4d9c71035a92712cc90aba21"}, "https://raw.githubusercontent.com/dumitrescustefan/ronec/master/ronec/conllup/raw/dev.conllu": {"num_bytes": 1478451, "checksum": "b99f1b7d9fef24635ee66b925e039663ef7fbe5c5a7851ffdb3efa0d9395ad41"}, "https://raw.githubusercontent.com/dumitrescustefan/ronec/master/ronec/conllup/raw/test.conllu": {"num_bytes": 1464643, "checksum": "7b1f71cfdbd5fc71e44051e1028369f5245afbfd7b17730b31b785bbff3f9c56"}}, "download_size": 14526329, "post_processing_size": null, "dataset_size": 3156935, "size_in_bytes": 17683264}}
|
dummy/ronec/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7c429bbd271fa92ab0163640501122b2d832a3849691b6cd63f671cec6d5d055
|
3 |
+
size 2329
|
ronec.py
ADDED
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
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 |
+
"""Introduction in RONEC: Named Entity Corpus for ROmanian language"""
|
16 |
+
|
17 |
+
from __future__ import absolute_import, division, print_function
|
18 |
+
|
19 |
+
import logging
|
20 |
+
|
21 |
+
import datasets
|
22 |
+
|
23 |
+
|
24 |
+
# Find for instance the citation on arxiv or on the dataset repo/website
|
25 |
+
_CITATION = """\
|
26 |
+
@article{dumitrescu2019introducing,
|
27 |
+
title={Introducing RONEC--the Romanian Named Entity Corpus},
|
28 |
+
author={Dumitrescu, Stefan Daniel and Avram, Andrei-Marius},
|
29 |
+
journal={arXiv preprint arXiv:1909.01247},
|
30 |
+
year={2019}
|
31 |
+
}
|
32 |
+
"""
|
33 |
+
|
34 |
+
# You can copy an official description
|
35 |
+
_DESCRIPTION = """\
|
36 |
+
The RONEC (Named Entity Corpus for the Romanian language) dataset contains over 26000 entities in ~5000 annotated sentence,
|
37 |
+
belonging to 16 distinct classes. It represents the first initiative in the Romanian language space specifically targeted for named entity recognition
|
38 |
+
"""
|
39 |
+
|
40 |
+
_HOMEPAGE = "https://github.com/dumitrescustefan/ronec"
|
41 |
+
|
42 |
+
_LICENSE = "MIT License"
|
43 |
+
|
44 |
+
# The HuggingFace dataset library don't host the datasets but only point to the original files
|
45 |
+
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
46 |
+
_URL = "https://raw.githubusercontent.com/dumitrescustefan/ronec/master/ronec/conllup/raw/"
|
47 |
+
_TRAINING_FILE = "train.conllu"
|
48 |
+
_TEST_FILE = "test.conllu"
|
49 |
+
_DEV_FILE = "dev.conllu"
|
50 |
+
|
51 |
+
|
52 |
+
class RONECConfig(datasets.BuilderConfig):
|
53 |
+
"""BuilderConfig for RONEC dataset"""
|
54 |
+
|
55 |
+
def __init__(self, **kwargs):
|
56 |
+
super(RONECConfig, self).__init__(**kwargs)
|
57 |
+
|
58 |
+
|
59 |
+
class RONEC(datasets.GeneratorBasedBuilder):
|
60 |
+
"""RONEC dataset"""
|
61 |
+
|
62 |
+
VERSION = datasets.Version("1.0.0")
|
63 |
+
BUILDER_CONFIGS = [
|
64 |
+
RONECConfig(name="ronec", version=VERSION, description="RONEC dataset"),
|
65 |
+
]
|
66 |
+
|
67 |
+
def _info(self):
|
68 |
+
|
69 |
+
features = datasets.Features(
|
70 |
+
{
|
71 |
+
"id": datasets.Value("string"),
|
72 |
+
"tokens": datasets.Sequence(datasets.Value("string")),
|
73 |
+
"ner_tags": datasets.Sequence(
|
74 |
+
datasets.features.ClassLabel(
|
75 |
+
names=[
|
76 |
+
"O",
|
77 |
+
"B-DATETIME",
|
78 |
+
"B-EVENT",
|
79 |
+
"B-FACILITY",
|
80 |
+
"B-GPE",
|
81 |
+
"B-LANGUAGE",
|
82 |
+
"B-LOC",
|
83 |
+
"B-MONEY",
|
84 |
+
"B-NAT_REL_POL",
|
85 |
+
"B-NUMERIC_VALUE",
|
86 |
+
"B-ORDINAL",
|
87 |
+
"B-ORGANIZATION",
|
88 |
+
"B-PERIOD",
|
89 |
+
"B-PERSON",
|
90 |
+
"B-PRODUCT",
|
91 |
+
"B-QUANTITY",
|
92 |
+
"B-WORK_OF_ART",
|
93 |
+
"I-DATETIME",
|
94 |
+
"I-EVENT",
|
95 |
+
"I-FACILITY",
|
96 |
+
"I-GPE",
|
97 |
+
"I-LANGUAGE",
|
98 |
+
"I-LOC",
|
99 |
+
"I-MONEY",
|
100 |
+
"I-NAT_REL_POL",
|
101 |
+
"I-NUMERIC_VALUE",
|
102 |
+
"I-ORDINAL",
|
103 |
+
"I-ORGANIZATION",
|
104 |
+
"I-PERIOD",
|
105 |
+
"I-PERSON",
|
106 |
+
"I-PRODUCT",
|
107 |
+
"I-QUANTITY",
|
108 |
+
"I-WORK_OF_ART",
|
109 |
+
]
|
110 |
+
)
|
111 |
+
),
|
112 |
+
}
|
113 |
+
)
|
114 |
+
|
115 |
+
return datasets.DatasetInfo(
|
116 |
+
# This is the description that will appear on the datasets page.
|
117 |
+
description=_DESCRIPTION,
|
118 |
+
# This defines the different columns of the dataset and their types
|
119 |
+
features=features, # Here we define them above because they are different between the two configurations
|
120 |
+
# If there's a common (input, target) tuple from the features,
|
121 |
+
# specify them here. They'll be used if as_supervised=True in
|
122 |
+
# builder.as_dataset.
|
123 |
+
supervised_keys=None,
|
124 |
+
# Homepage of the dataset for documentation
|
125 |
+
homepage=_HOMEPAGE,
|
126 |
+
# License for the dataset if available
|
127 |
+
license=_LICENSE,
|
128 |
+
# Citation for the dataset
|
129 |
+
citation=_CITATION,
|
130 |
+
)
|
131 |
+
|
132 |
+
def _split_generators(self, dl_manager):
|
133 |
+
"""Returns SplitGenerators."""
|
134 |
+
|
135 |
+
urls_to_download = {"train": _URL + _TRAINING_FILE, "dev": _URL + _DEV_FILE, "test": _URL + _TEST_FILE}
|
136 |
+
|
137 |
+
downloaded_files = dl_manager.download(urls_to_download)
|
138 |
+
|
139 |
+
return [
|
140 |
+
datasets.SplitGenerator(
|
141 |
+
name=datasets.Split.TRAIN,
|
142 |
+
# These kwargs will be passed to _generate_examples
|
143 |
+
gen_kwargs={"filepath": downloaded_files["train"]},
|
144 |
+
),
|
145 |
+
datasets.SplitGenerator(
|
146 |
+
name=datasets.Split.TEST,
|
147 |
+
# These kwargs will be passed to _generate_examples
|
148 |
+
gen_kwargs={"filepath": downloaded_files["test"]},
|
149 |
+
),
|
150 |
+
datasets.SplitGenerator(
|
151 |
+
name=datasets.Split.VALIDATION,
|
152 |
+
# These kwargs will be passed to _generate_examples
|
153 |
+
gen_kwargs={"filepath": downloaded_files["dev"]},
|
154 |
+
),
|
155 |
+
]
|
156 |
+
|
157 |
+
def _generate_examples(self, filepath):
|
158 |
+
""" Yields examples. """
|
159 |
+
|
160 |
+
logging.info("⏳ Generating examples from = %s", filepath)
|
161 |
+
with open(filepath, encoding="utf-8") as f:
|
162 |
+
guid = 0
|
163 |
+
tokens = []
|
164 |
+
ner_tags = []
|
165 |
+
for line in f:
|
166 |
+
if "#" in line or line == "\n":
|
167 |
+
if tokens:
|
168 |
+
yield guid, {
|
169 |
+
"id": str(guid),
|
170 |
+
"tokens": tokens,
|
171 |
+
"ner_tags": ner_tags,
|
172 |
+
}
|
173 |
+
guid += 1
|
174 |
+
tokens = []
|
175 |
+
ner_tags = []
|
176 |
+
else:
|
177 |
+
# ronec tokens are tab separated
|
178 |
+
splits = line.split("\t")
|
179 |
+
tokens.append(splits[1])
|
180 |
+
ner_tags.append(splits[10].rstrip())
|
181 |
+
# last example
|
182 |
+
if tokens:
|
183 |
+
yield guid, {
|
184 |
+
"id": str(guid),
|
185 |
+
"tokens": tokens,
|
186 |
+
"ner_tags": ner_tags,
|
187 |
+
}
|