system HF staff commited on
Commit
5a3df14
1 Parent(s): 13900c3

Update files from the datasets library (from 1.15.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.15.0

Files changed (4) hide show
  1. README.md +72 -21
  2. dataset_infos.json +1 -1
  3. dummy/ronec/2.0.0/dummy_data.zip +3 -0
  4. ronec.py +41 -67
README.md CHANGED
@@ -19,6 +19,7 @@ task_categories:
19
  task_ids:
20
  - named-entity-recognition
21
  paperswithcode_id: ronec
 
22
  ---
23
 
24
  # Dataset Card for RONEC
@@ -52,57 +53,87 @@ paperswithcode_id: ronec
52
  - **Homepage:** https://github.com/dumitrescustefan/ronec
53
  - **Repository:** https://github.com/dumitrescustefan/ronec
54
  - **Paper:** https://arxiv.org/abs/1909.01247
55
- - **Leaderboard:** [Needs More Information]
56
  - **Point of Contact:** dumitrescu.stefan@gmail.com, avram.andreimarius@gmail.com
57
 
58
  ### Dataset Summary
59
 
60
- 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.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  ### Supported Tasks and Leaderboards
63
 
64
- [Needs More Information]
 
 
65
 
66
  ### Languages
67
 
68
- The text dataset is in Romanian (`ro`)
69
 
70
  ## Dataset Structure
71
 
72
  ### Data Instances
73
 
74
- An example looks like this:
75
 
76
- ```
77
- {'id': '1',
78
- 'ner_tags': [13, 29, 29, 0, 4, 0, 13, 29, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0],
79
- 'tokens': ['Secretarul', 'de', 'stat', 'al', 'S.U.A.', ',', 'Colin', 'Powell', ',', 'începe', 'un', 'turneu', 'în', 'țările', 'asiatice', 'afectate', 'de', 'valurile', 'seismice', 'uriașe', '.']
 
 
 
80
  }
81
  ```
82
 
83
  ### Data Fields
84
 
85
- - `id`: a `string` feature describing the index of the sentence in the dataset
86
- - `tokens`: a `list` of `string` features.
87
- - `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`.
 
 
 
88
 
89
  ### Data Splits
90
 
91
- The dataset was also split in train (80%), dev (10%) and test (10%)
92
 
93
  ## Dataset Creation
94
 
95
  ### Curation Rationale
96
 
97
- From the original paper:
98
-
99
- *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*
100
 
101
  ### Source Data
102
 
 
 
103
  #### Initial Data Collection and Normalization
104
 
105
- *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.*
106
 
107
  #### Who are the source language producers?
108
 
@@ -110,17 +141,35 @@ From the original paper:
110
 
111
  ### Annotations
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  #### Annotation process
114
 
115
- *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.*
116
 
117
  #### Who are the annotators?
118
 
119
- Stefan Dumitrescu, Marius Avram
120
 
121
  ### Personal and Sensitive Information
122
 
123
- [Needs More Information]
124
 
125
  ## Considerations for Using the Data
126
 
@@ -148,13 +197,15 @@ MIT License
148
 
149
  ### Citation Information
150
 
 
151
  @article{dumitrescu2019introducing,
152
  title={Introducing RONEC--the Romanian Named Entity Corpus},
153
  author={Dumitrescu, Stefan Daniel and Avram, Andrei-Marius},
154
  journal={arXiv preprint arXiv:1909.01247},
155
  year={2019}
156
  }
 
157
 
158
  ### Contributions
159
 
160
- Thanks to [@iliemihai](https://github.com/iliemihai) for adding this dataset.
19
  task_ids:
20
  - named-entity-recognition
21
  paperswithcode_id: ronec
22
+ pretty_name: RONEC
23
  ---
24
 
25
  # Dataset Card for RONEC
53
  - **Homepage:** https://github.com/dumitrescustefan/ronec
54
  - **Repository:** https://github.com/dumitrescustefan/ronec
55
  - **Paper:** https://arxiv.org/abs/1909.01247
56
+ - **Leaderboard:** https://lirobenchmark.github.io/
57
  - **Point of Contact:** dumitrescu.stefan@gmail.com, avram.andreimarius@gmail.com
58
 
59
  ### Dataset Summary
60
 
61
+ RONEC, at version 2.0, holds 12330 sentences with over 0.5M tokens, annotated with 15 classes, to a total of 80.283 distinctly annotated entities.
62
+
63
+ The corpus has the following classes and distribution in the train/valid/test splits:
64
+
65
+ | Classes | Total | Train | | Valid | | Test | |
66
+ |------------- |:------: |:------: |:-------: |:------: |:-------: |:------: |:-------: |
67
+ | | # | # | % | # | % | # | % |
68
+ | PERSON | **26130** | 19167 | 73.35 | 2733 | 10.46 | 4230 | 16.19 |
69
+ | GPE | **11103** | 8193 | 73.79 | 1182 | 10.65 | 1728 | 15.56 |
70
+ | LOC | **2467** | 1824 | 73.94 | 270 | 10.94 | 373 | 15.12 |
71
+ | ORG | **7880** | 5688 | 72.18 | 880 | 11.17 | 1312 | 16.65 |
72
+ | LANGUAGE | **467** | 342 | 73.23 | 52 | 11.13 | 73 | 15.63 |
73
+ | NAT_REL_POL | **4970** | 3673 | 73.90 | 516 | 10.38 | 781 | 15.71 |
74
+ | DATETIME | **9614** | 6960 | 72.39 | 1029 | 10.7 | 1625 | 16.9 |
75
+ | PERIOD | **1188** | 862 | 72.56 | 129 | 10.86 | 197 | 16.58 |
76
+ | QUANTITY | **1588** | 1161 | 73.11 | 181 | 11.4 | 246 | 15.49 |
77
+ | MONEY | **1424** | 1041 | 73.10 | 159 | 11.17 | 224 | 15.73 |
78
+ | NUMERIC | **7735** | 5734 | 74.13 | 814 | 10.52 | 1187 | 15.35 |
79
+ | ORDINAL | **1893** | 1377 | 72.74 | 212 | 11.2 | 304 | 16.06 |
80
+ | FACILITY | **1126** | 840 | 74.6 | 113 | 10.04 | 173 | 15.36 |
81
+ | WORK_OF_ART | **1596** | 1157 | 72.49 | 176 | 11.03 | 263 | 16.48 |
82
+ | EVENT | **1102** | 826 | 74.95 | 107 | 9.71 | 169 | 15.34 |
83
+
84
 
85
  ### Supported Tasks and Leaderboards
86
 
87
+ The corpus is meant to train Named Entity Recognition models for the Romanian language.
88
+
89
+ Please see the leaderboard here : [https://lirobenchmark.github.io/](https://lirobenchmark.github.io/)
90
 
91
  ### Languages
92
 
93
+ RONEC is in Romanian (`ro`)
94
 
95
  ## Dataset Structure
96
 
97
  ### Data Instances
98
 
99
+ The dataset is a list of instances. For example, an instance looks like:
100
 
101
+ ```json
102
+ {
103
+ "id": 10454,
104
+ "tokens": ["Pentru", "a", "vizita", "locația", "care", "va", "fi", "pusă", "la", "dispoziția", "reprezentanților", "consiliilor", "județene", ",", "o", "delegație", "a", "U.N.C.J.R.", ",", "din", "care", "a", "făcut", "parte", "și", "dl", "Constantin", "Ostaficiuc", ",", "președintele", "C.J.T.", ",", "a", "fost", "prezentă", "la", "Bruxelles", ",", "între", "1-3", "martie", "."],
105
+ "ner_tags": ["O", "O", "O", "O", "O", "O", "O", "O", "O", "O", "B-PERSON", "O", "O", "O", "O", "O", "O", "B-ORG", "O", "O", "O", "O", "O", "O", "O", "B-PERSON", "I-PERSON", "I-PERSON", "I-PERSON", "I-PERSON", "B-ORG", "O", "O", "O", "O", "O", "B-GPE", "O", "B-PERIOD", "I-PERIOD", "I-PERIOD", "O"],
106
+ "ner_ids": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0, 5, 0, 19, 20, 20, 0],
107
+ "space_after": [true, true, true, true, true, true, true, true, true, true, true, true, false, true, true, true, true, false, true, true, true, true, true, true, true, true, true, false, true, true, false, true, true, true, true, true, false, true, true, true, false, false]
108
  }
109
  ```
110
 
111
  ### Data Fields
112
 
113
+ The fields of each examples are:
114
+
115
+ - ``tokens`` are the words of the sentence.
116
+ - ``ner_tags`` are the string tags assigned to each token, following the BIO2 format. For example, the span ``"între", "1-3", "martie"`` has three tokens, but is a single class ``PERIOD``, marked as ``"B-PERIOD", "I-PERIOD", "I-PERIOD"``.
117
+ - ``ner_ids`` are the integer encoding of each tag, to be compatible with the standard and to be quickly used for model training. Note that each ``B``-starting tag is odd, and each ``I``-starting tag is even.
118
+ - ``space_after`` is used to help if there is a need to detokenize the dataset. A ``true`` value means that there is a space after the token on that respective position.
119
 
120
  ### Data Splits
121
 
122
+ The dataset is split in train: 9000 sentences, dev: 1330 sentence and test: 2000 sentences.
123
 
124
  ## Dataset Creation
125
 
126
  ### Curation Rationale
127
 
128
+ [Needs More Information]
 
 
129
 
130
  ### Source Data
131
 
132
+ *The corpus data source represents sentences that are free of copyright, taken from older datasets like the freely available SEETimes and more recent datasources like the Romanian Wikipedia or the Common Crawl.*
133
+
134
  #### Initial Data Collection and Normalization
135
 
136
+ [Needs More Information]
137
 
138
  #### Who are the source language producers?
139
 
141
 
142
  ### Annotations
143
 
144
+ The corpus was annotated with the following classes:
145
+
146
+ 1. PERSON - proper nouns, including common nouns or pronouns if they refer to a person. (e.g. 'sister')
147
+ 2. GPE - geo political entity, like a city or a country; has to have a governance form
148
+ 3. LOC - location, like a sea, continent, region, road, address, etc.
149
+ 4. ORG - organization
150
+ 5. LANGUAGE - language (e.g. Romanian, French, etc.)
151
+ 6. NAT_REL_POL - national, religious or political organizations
152
+ 7. DATETIME - a time and date in any format, including references to time (e.g. 'yesterday')
153
+ 8. PERIOD - a period that is precisely bounded by two date times
154
+ 9. QUANTITY - a quantity that is not numerical; it has a unit of measure
155
+ 10. MONEY - a monetary value, numeric or otherwise
156
+ 11. NUMERIC - a simple numeric value, represented as digits or words
157
+ 12. ORDINAL - an ordinal value like 'first', 'third', etc.
158
+ 13. FACILITY - a named place that is easily recognizable
159
+ 14. WORK_OF_ART - a work of art like a named TV show, painting, etc.
160
+ 15. EVENT - a named recognizable or periodic major event
161
+
162
  #### Annotation process
163
 
164
+ The corpus was annotated by 3 language experts, and was cross-checked for annotation consistency. The annotation took several months to complete, but the result is a high quality dataset.
165
 
166
  #### Who are the annotators?
167
 
168
+ Stefan Dumitrescu (lead).
169
 
170
  ### Personal and Sensitive Information
171
 
172
+ All the source data is already freely downloadable and usable online, so there are no privacy concerns.
173
 
174
  ## Considerations for Using the Data
175
 
197
 
198
  ### Citation Information
199
 
200
+ ```bibtex
201
  @article{dumitrescu2019introducing,
202
  title={Introducing RONEC--the Romanian Named Entity Corpus},
203
  author={Dumitrescu, Stefan Daniel and Avram, Andrei-Marius},
204
  journal={arXiv preprint arXiv:1909.01247},
205
  year={2019}
206
  }
207
+ ```
208
 
209
  ### Contributions
210
 
211
+ Thanks to [@iliemihai](https://github.com/iliemihai) for adding v1.0 of the dataset.
dataset_infos.json CHANGED
@@ -1 +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}}
1
+ {"ronec": {"description": "RONEC - the Romanian Named Entity Corpus, at version 2.0, holds 12330 sentences with over 0.5M tokens, annotated with 15 classes, to a total of 80.283 distinctly annotated entities. It is used for named entity recognition and represents the largest Romanian NER corpus to date.\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": "int32", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "ner_ids": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "space_after": {"feature": {"dtype": "bool", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "ner_tags": {"feature": {"num_classes": 31, "names": ["O", "B-PERSON", "I-PERSON", "B-ORG", "I-ORG", "B-GPE", "I-GPE", "B-LOC", "I-LOC", "B-NAT_REL_POL", "I-NAT_REL_POL", "B-EVENT", "I-EVENT", "B-LANGUAGE", "I-LANGUAGE", "B-WORK_OF_ART", "I-WORK_OF_ART", "B-DATETIME", "I-DATETIME", "B-PERIOD", "I-PERIOD", "B-MONEY", "I-MONEY", "B-QUANTITY", "I-QUANTITY", "B-NUMERIC", "I-NUMERIC", "B-ORDINAL", "I-ORDINAL", "B-FACILITY", "I-FACILITY"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "ronec", "config_name": "ronec", "version": {"version_str": "2.0.0", "description": null, "major": 2, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 8701577, "num_examples": 9000, "dataset_name": "ronec"}, "validation": {"name": "validation", "num_bytes": 1266490, "num_examples": 1330, "dataset_name": "ronec"}, "test": {"name": "test", "num_bytes": 1902224, "num_examples": 2000, "dataset_name": "ronec"}}, "download_checksums": {"https://raw.githubusercontent.com/dumitrescustefan/ronec/master/data/train.json": {"num_bytes": 10753146, "checksum": "349d8632f3f416cdefa7709c759d6fba458d0cdc0a59c546af5b5d4167096e48"}, "https://raw.githubusercontent.com/dumitrescustefan/ronec/master/data/valid.json": {"num_bytes": 1567702, "checksum": "0c3e08c8fb7058c96d91c30cc3fe12b684b682c1c481e84a9d05aac14b59fe04"}, "https://raw.githubusercontent.com/dumitrescustefan/ronec/master/data/test.json": {"num_bytes": 2355095, "checksum": "7532619fd6680adb4c3926f5e185f3c1705caeb2d8466e9fe2a4428e81660704"}}, "download_size": 14675943, "post_processing_size": null, "dataset_size": 11870291, "size_in_bytes": 26546234}}
dummy/ronec/2.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dccefc79b6e137f97cd4c671c0fc66e21100d4ff6a654cadb59ab5b9ba09a670
3
+ size 4916
ronec.py CHANGED
@@ -12,15 +12,14 @@
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
 
18
  import datasets
19
 
20
 
21
  logger = datasets.logging.get_logger(__name__)
22
 
23
-
24
  # Find for instance the citation on arxiv or on the dataset repo/website
25
  _CITATION = """\
26
  @article{dumitrescu2019introducing,
@@ -33,8 +32,7 @@ _CITATION = """\
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"
@@ -43,10 +41,10 @@ _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):
@@ -59,53 +57,52 @@ class RONECConfig(datasets.BuilderConfig):
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
  ),
@@ -143,14 +140,14 @@ class RONEC(datasets.GeneratorBasedBuilder):
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
 
@@ -158,30 +155,7 @@ class RONEC(datasets.GeneratorBasedBuilder):
158
  """Yields examples."""
159
 
160
  logger.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
- }
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
+ import json
17
 
18
  import datasets
19
 
20
 
21
  logger = datasets.logging.get_logger(__name__)
22
 
 
23
  # Find for instance the citation on arxiv or on the dataset repo/website
24
  _CITATION = """\
25
  @article{dumitrescu2019introducing,
32
 
33
  # You can copy an official description
34
  _DESCRIPTION = """\
35
+ RONEC - the Romanian Named Entity Corpus, at version 2.0, holds 12330 sentences with over 0.5M tokens, annotated with 15 classes, to a total of 80.283 distinctly annotated entities. It is used for named entity recognition and represents the largest Romanian NER corpus to date.
 
36
  """
37
 
38
  _HOMEPAGE = "https://github.com/dumitrescustefan/ronec"
41
 
42
  # The HuggingFace dataset library don't host the datasets but only point to the original files
43
  # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
44
+ _URL = "https://raw.githubusercontent.com/dumitrescustefan/ronec/master/data/"
45
+ _TRAINING_FILE = "train.json"
46
+ _DEV_FILE = "valid.json"
47
+ _TEST_FILE = "test.json"
48
 
49
 
50
  class RONECConfig(datasets.BuilderConfig):
57
  class RONEC(datasets.GeneratorBasedBuilder):
58
  """RONEC dataset"""
59
 
60
+ VERSION = datasets.Version("2.0.0")
61
  BUILDER_CONFIGS = [
62
  RONECConfig(name="ronec", version=VERSION, description="RONEC dataset"),
63
  ]
64
 
65
  def _info(self):
 
66
  features = datasets.Features(
67
  {
68
+ "id": datasets.Value("int32"),
69
  "tokens": datasets.Sequence(datasets.Value("string")),
70
+ "ner_ids": datasets.Sequence(datasets.Value("int32")),
71
+ "space_after": datasets.Sequence(datasets.Value("bool")),
72
  "ner_tags": datasets.Sequence(
73
  datasets.features.ClassLabel(
74
  names=[
75
  "O",
76
+ "B-PERSON",
77
+ "I-PERSON",
78
+ "B-ORG",
79
+ "I-ORG",
80
  "B-GPE",
81
+ "I-GPE",
82
  "B-LOC",
83
+ "I-LOC",
84
  "B-NAT_REL_POL",
85
+ "I-NAT_REL_POL",
86
+ "B-EVENT",
 
 
 
 
 
 
 
87
  "I-EVENT",
88
+ "B-LANGUAGE",
 
89
  "I-LANGUAGE",
90
+ "B-WORK_OF_ART",
91
+ "I-WORK_OF_ART",
92
+ "B-DATETIME",
93
+ "I-DATETIME",
94
+ "B-PERIOD",
 
95
  "I-PERIOD",
96
+ "B-MONEY",
97
+ "I-MONEY",
98
+ "B-QUANTITY",
99
  "I-QUANTITY",
100
+ "B-NUMERIC",
101
+ "I-NUMERIC",
102
+ "B-ORDINAL",
103
+ "I-ORDINAL",
104
+ "B-FACILITY",
105
+ "I-FACILITY",
106
  ]
107
  )
108
  ),
140
  gen_kwargs={"filepath": downloaded_files["train"]},
141
  ),
142
  datasets.SplitGenerator(
143
+ name=datasets.Split.VALIDATION,
144
  # These kwargs will be passed to _generate_examples
145
+ gen_kwargs={"filepath": downloaded_files["dev"]},
146
  ),
147
  datasets.SplitGenerator(
148
+ name=datasets.Split.TEST,
149
  # These kwargs will be passed to _generate_examples
150
+ gen_kwargs={"filepath": downloaded_files["test"]},
151
  ),
152
  ]
153
 
155
  """Yields examples."""
156
 
157
  logger.info("⏳ Generating examples from = %s", filepath)
158
+ with open(filepath, "r", encoding="utf-8") as f:
159
+ data = json.load(f)
160
+ for instance in data:
161
+ yield instance["id"], instance