eduagarcia commited on
Commit
4e2de79
·
1 Parent(s): cb8eda9

Added UlyssesNER-Br-PL dataset

Browse files
Files changed (1) hide show
  1. portuguese_benchmark.py +111 -4
portuguese_benchmark.py CHANGED
@@ -139,6 +139,110 @@ hatebr_map = {
139
  }
140
  _HATEBR_KWARGS['process_label'] = lambda x: hatebr_map[x]
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  class PTBenchmarkConfig(datasets.BuilderConfig):
143
  """BuilderConfig for PTBenchmark."""
144
 
@@ -184,7 +288,7 @@ class PTBenchmarkConfig(datasets.BuilderConfig):
184
  self.indexes_url = indexes_url
185
  self.process_label = process_label
186
 
187
- def _get_classification_features(config):
188
  return datasets.Features(
189
  {
190
  "idx": datasets.Value("int32"),
@@ -193,7 +297,7 @@ def _get_classification_features(config):
193
  }
194
  )
195
 
196
- def _get_ner_features(config):
197
  bio_labels = ["O"]
198
  for label_name in config.label_classes:
199
  bio_labels.append("B-" + label_name)
@@ -208,7 +312,7 @@ def _get_ner_features(config):
208
  }
209
  )
210
 
211
- def _get_rte_features(config):
212
  return datasets.Features(
213
  {
214
  "idx": datasets.Value("int32"),
@@ -218,7 +322,7 @@ def _get_rte_features(config):
218
  }
219
  )
220
 
221
- def _get_sts_features(config):
222
  return datasets.Features(
223
  {
224
  "idx": datasets.Value("int32"),
@@ -321,6 +425,9 @@ class PTBenchmark(datasets.GeneratorBasedBuilder):
321
  ),
322
  PTBenchmarkConfig(
323
  **_HATEBR_KWARGS
 
 
 
324
  )
325
  ]
326
 
 
139
  }
140
  _HATEBR_KWARGS['process_label'] = lambda x: hatebr_map[x]
141
 
142
+ # Extracted from:
143
+ # - https://github.com/ulysses-camara/ulysses-ner-br
144
+
145
+ _ULYSSESNER_META_KWARGS = dict(
146
+ description=textwrap.dedent(
147
+ """\
148
+ UlyssesNER-Br is a corpus of Brazilian Legislative Documents for NER with quality baselines.
149
+ The presented corpus consists of bills and legislative consultations from Brazilian Chamber of Deputies.
150
+ UlyssesNER-Br has seven semantic classes or categories. Based on HAREM,
151
+ we defined five typical categories: person, location, organization, event and date.
152
+ In addition, we defined two specific semantic classes for the legislative domain:
153
+ law foundation and law product. The law foundation category makes reference to
154
+ entities related to laws, resolutions, decrees, as well as to domain-specific entities
155
+ such as bills, which are law proposals being discussed by the parliament, and legislative consultations,
156
+ also known as job requests made by the parliamentarians.
157
+ The law product entity refers to systems, programs, and other products created
158
+ from legislation."""
159
+ ),
160
+ task_type="ner",
161
+ label_classes=['DATA', 'EVENTO', 'FUNDapelido', 'FUNDlei', 'FUNDprojetodelei', 'LOCALconcreto', 'LOCALvirtual', \
162
+ 'ORGgovernamental', 'ORGnaogovernamental', 'ORGpartido', 'PESSOAcargo', 'PESSOAgrupocargo', 'PESSOAindividual', \
163
+ 'PRODUTOoutros', 'PRODUTOprograma', 'PRODUTOsistema'],
164
+ citation=textwrap.dedent(
165
+ """\
166
+ @InProceedings{10.1007/978-3-030-98305-5_1,
167
+ author="Albuquerque, Hidelberg O.
168
+ and Costa, Rosimeire
169
+ and Silvestre, Gabriel
170
+ and Souza, Ellen
171
+ and da Silva, N{\'a}dia F. F.
172
+ and Vit{\'o}rio, Douglas
173
+ and Moriyama, Gyovana
174
+ and Martins, Lucas
175
+ and Soezima, Luiza
176
+ and Nunes, Augusto
177
+ and Siqueira, Felipe
178
+ and Tarrega, Jo{\~a}o P.
179
+ and Beinotti, Joao V.
180
+ and Dias, Marcio
181
+ and Silva, Matheus
182
+ and Gardini, Miguel
183
+ and Silva, Vinicius
184
+ and de Carvalho, Andr{\'e} C. P. L. F.
185
+ and Oliveira, Adriano L. I.",
186
+ editor="Pinheiro, Vl{\'a}dia
187
+ and Gamallo, Pablo
188
+ and Amaro, Raquel
189
+ and Scarton, Carolina
190
+ and Batista, Fernando
191
+ and Silva, Diego
192
+ and Magro, Catarina
193
+ and Pinto, Hugo",
194
+ title="UlyssesNER-Br: A Corpus of Brazilian Legislative Documents for Named Entity Recognition",
195
+ booktitle="Computational Processing of the Portuguese Language",
196
+ year="2022",
197
+ publisher="Springer International Publishing",
198
+ address="Cham",
199
+ pages="3--14",
200
+ isbn="978-3-030-98305-5"
201
+ }
202
+ @InProceedings{10.1007/978-3-031-16474-3_62,
203
+ author="Costa, Rosimeire
204
+ and Albuquerque, Hidelberg Oliveira
205
+ and Silvestre, Gabriel
206
+ and Silva, N{\'a}dia F{\'e}lix F.
207
+ and Souza, Ellen
208
+ and Vit{\'o}rio, Douglas
209
+ and Nunes, Augusto
210
+ and Siqueira, Felipe
211
+ and Pedro Tarrega, Jo{\~a}o
212
+ and Vitor Beinotti, Jo{\~a}o
213
+ and de Souza Dias, M{\'a}rcio
214
+ and Pereira, Fab{\'i}ola S. F.
215
+ and Silva, Matheus
216
+ and Gardini, Miguel
217
+ and Silva, Vinicius
218
+ and de Carvalho, Andr{\'e} C. P. L. F.
219
+ and Oliveira, Adriano L. I.",
220
+ editor="Marreiros, Goreti
221
+ and Martins, Bruno
222
+ and Paiva, Ana
223
+ and Ribeiro, Bernardete
224
+ and Sardinha, Alberto",
225
+ title="Expanding UlyssesNER-Br Named Entity Recognition Corpus with Informal User-Generated Text",
226
+ booktitle="Progress in Artificial Intelligence",
227
+ year="2022",
228
+ publisher="Springer International Publishing",
229
+ address="Cham",
230
+ pages="767--779",
231
+ isbn="978-3-031-16474-3"
232
+ }"""
233
+ ),
234
+ url="https://github.com/ulysses-camara/ulysses-ner-br",
235
+ )
236
+ _ULYSSESNER_PL_KWARGS = dict(
237
+ name = "UlyssesNER-Br-PL",
238
+ data_urls = {
239
+ "train": "https://github.com/ulysses-camara/ulysses-ner-br/raw/main/annotated-corpora/PL_corpus_conll/pl_corpus_tipos/train.txt",
240
+ "validation": "https://github.com/ulysses-camara/ulysses-ner-br/raw/main/annotated-corpora/PL_corpus_conll/pl_corpus_tipos/valid.txt",
241
+ "test": "https://github.com/ulysses-camara/ulysses-ner-br/raw/main/annotated-corpora/PL_corpus_conll/pl_corpus_tipos/test.txt",
242
+ },
243
+ **_ULYSSESNER_META_KWARGS
244
+ )
245
+
246
  class PTBenchmarkConfig(datasets.BuilderConfig):
247
  """BuilderConfig for PTBenchmark."""
248
 
 
288
  self.indexes_url = indexes_url
289
  self.process_label = process_label
290
 
291
+ def _get_classification_features(config: PTBenchmarkConfig):
292
  return datasets.Features(
293
  {
294
  "idx": datasets.Value("int32"),
 
297
  }
298
  )
299
 
300
+ def _get_ner_features(config: PTBenchmarkConfig):
301
  bio_labels = ["O"]
302
  for label_name in config.label_classes:
303
  bio_labels.append("B-" + label_name)
 
312
  }
313
  )
314
 
315
+ def _get_rte_features(config: PTBenchmarkConfig):
316
  return datasets.Features(
317
  {
318
  "idx": datasets.Value("int32"),
 
322
  }
323
  )
324
 
325
+ def _get_sts_features(config: PTBenchmarkConfig = None):
326
  return datasets.Features(
327
  {
328
  "idx": datasets.Value("int32"),
 
425
  ),
426
  PTBenchmarkConfig(
427
  **_HATEBR_KWARGS
428
+ ),
429
+ PTBenchmarkConfig(
430
+ **_ULYSSESNER_PL_KWARGS
431
  )
432
  ]
433