Datasets:
Tasks:
Token Classification
Modalities:
Text
Sub-tasks:
named-entity-recognition
Languages:
English
Size:
10K - 100K
ArXiv:
Upload dataloading script and README.md
Browse files- README.md +855 -0
- cross_ner.py +223 -0
README.md
ADDED
|
@@ -0,0 +1,855 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
annotations_creators:
|
| 3 |
+
- expert-generated
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
language_creators:
|
| 7 |
+
- found
|
| 8 |
+
license: []
|
| 9 |
+
multilinguality:
|
| 10 |
+
- monolingual
|
| 11 |
+
pretty_name: CrossNER is a cross-domain dataset for named entity recognition
|
| 12 |
+
size_categories:
|
| 13 |
+
- 10K<n<100K
|
| 14 |
+
source_datasets:
|
| 15 |
+
- extended|conll2003
|
| 16 |
+
tags:
|
| 17 |
+
- cross domain
|
| 18 |
+
- ai
|
| 19 |
+
- news
|
| 20 |
+
- music
|
| 21 |
+
- literature
|
| 22 |
+
- politics
|
| 23 |
+
- science
|
| 24 |
+
task_categories:
|
| 25 |
+
- token-classification
|
| 26 |
+
task_ids:
|
| 27 |
+
- named-entity-recognition
|
| 28 |
+
dataset_info:
|
| 29 |
+
- config_name: ai
|
| 30 |
+
features:
|
| 31 |
+
- name: id
|
| 32 |
+
dtype: string
|
| 33 |
+
- name: tokens
|
| 34 |
+
sequence: string
|
| 35 |
+
- name: ner_tags
|
| 36 |
+
sequence:
|
| 37 |
+
class_label:
|
| 38 |
+
names:
|
| 39 |
+
'0': O
|
| 40 |
+
'1': B-academicjournal
|
| 41 |
+
'2': I-academicjournal
|
| 42 |
+
'3': B-album
|
| 43 |
+
'4': I-album
|
| 44 |
+
'5': B-algorithm
|
| 45 |
+
'6': I-algorithm
|
| 46 |
+
'7': B-astronomicalobject
|
| 47 |
+
'8': I-astronomicalobject
|
| 48 |
+
'9': B-award
|
| 49 |
+
'10': I-award
|
| 50 |
+
'11': B-band
|
| 51 |
+
'12': I-band
|
| 52 |
+
'13': B-book
|
| 53 |
+
'14': I-book
|
| 54 |
+
'15': B-chemicalcompound
|
| 55 |
+
'16': I-chemicalcompound
|
| 56 |
+
'17': B-chemicalelement
|
| 57 |
+
'18': I-chemicalelement
|
| 58 |
+
'19': B-conference
|
| 59 |
+
'20': I-conference
|
| 60 |
+
'21': B-country
|
| 61 |
+
'22': I-country
|
| 62 |
+
'23': B-discipline
|
| 63 |
+
'24': I-discipline
|
| 64 |
+
'25': B-election
|
| 65 |
+
'26': I-election
|
| 66 |
+
'27': B-enzyme
|
| 67 |
+
'28': I-enzyme
|
| 68 |
+
'29': B-event
|
| 69 |
+
'30': I-event
|
| 70 |
+
'31': B-field
|
| 71 |
+
'32': I-field
|
| 72 |
+
'33': B-literarygenre
|
| 73 |
+
'34': I-literarygenre
|
| 74 |
+
'35': B-location
|
| 75 |
+
'36': I-location
|
| 76 |
+
'37': B-magazine
|
| 77 |
+
'38': I-magazine
|
| 78 |
+
'39': B-metrics
|
| 79 |
+
'40': I-metrics
|
| 80 |
+
'41': B-misc
|
| 81 |
+
'42': I-misc
|
| 82 |
+
'43': B-musicalartist
|
| 83 |
+
'44': I-musicalartist
|
| 84 |
+
'45': B-musicalinstrument
|
| 85 |
+
'46': I-musicalinstrument
|
| 86 |
+
'47': B-musicgenre
|
| 87 |
+
'48': I-musicgenre
|
| 88 |
+
'49': B-organisation
|
| 89 |
+
'50': I-organisation
|
| 90 |
+
'51': B-person
|
| 91 |
+
'52': I-person
|
| 92 |
+
'53': B-poem
|
| 93 |
+
'54': I-poem
|
| 94 |
+
'55': B-politicalparty
|
| 95 |
+
'56': I-politicalparty
|
| 96 |
+
'57': B-politician
|
| 97 |
+
'58': I-politician
|
| 98 |
+
'59': B-product
|
| 99 |
+
'60': I-product
|
| 100 |
+
'61': B-programlang
|
| 101 |
+
'62': I-programlang
|
| 102 |
+
'63': B-protein
|
| 103 |
+
'64': I-protein
|
| 104 |
+
'65': B-researcher
|
| 105 |
+
'66': I-researcher
|
| 106 |
+
'67': B-scientist
|
| 107 |
+
'68': I-scientist
|
| 108 |
+
'69': B-song
|
| 109 |
+
'70': I-song
|
| 110 |
+
'71': B-task
|
| 111 |
+
'72': I-task
|
| 112 |
+
'73': B-theory
|
| 113 |
+
'74': I-theory
|
| 114 |
+
'75': B-university
|
| 115 |
+
'76': I-university
|
| 116 |
+
'77': B-writer
|
| 117 |
+
'78': I-writer
|
| 118 |
+
splits:
|
| 119 |
+
- name: train
|
| 120 |
+
num_bytes: 65080
|
| 121 |
+
num_examples: 100
|
| 122 |
+
- name: validation
|
| 123 |
+
num_bytes: 189453
|
| 124 |
+
num_examples: 350
|
| 125 |
+
- name: test
|
| 126 |
+
num_bytes: 225691
|
| 127 |
+
num_examples: 431
|
| 128 |
+
download_size: 289173
|
| 129 |
+
dataset_size: 480224
|
| 130 |
+
- config_name: literature
|
| 131 |
+
features:
|
| 132 |
+
- name: id
|
| 133 |
+
dtype: string
|
| 134 |
+
- name: tokens
|
| 135 |
+
sequence: string
|
| 136 |
+
- name: ner_tags
|
| 137 |
+
sequence:
|
| 138 |
+
class_label:
|
| 139 |
+
names:
|
| 140 |
+
'0': O
|
| 141 |
+
'1': B-academicjournal
|
| 142 |
+
'2': I-academicjournal
|
| 143 |
+
'3': B-album
|
| 144 |
+
'4': I-album
|
| 145 |
+
'5': B-algorithm
|
| 146 |
+
'6': I-algorithm
|
| 147 |
+
'7': B-astronomicalobject
|
| 148 |
+
'8': I-astronomicalobject
|
| 149 |
+
'9': B-award
|
| 150 |
+
'10': I-award
|
| 151 |
+
'11': B-band
|
| 152 |
+
'12': I-band
|
| 153 |
+
'13': B-book
|
| 154 |
+
'14': I-book
|
| 155 |
+
'15': B-chemicalcompound
|
| 156 |
+
'16': I-chemicalcompound
|
| 157 |
+
'17': B-chemicalelement
|
| 158 |
+
'18': I-chemicalelement
|
| 159 |
+
'19': B-conference
|
| 160 |
+
'20': I-conference
|
| 161 |
+
'21': B-country
|
| 162 |
+
'22': I-country
|
| 163 |
+
'23': B-discipline
|
| 164 |
+
'24': I-discipline
|
| 165 |
+
'25': B-election
|
| 166 |
+
'26': I-election
|
| 167 |
+
'27': B-enzyme
|
| 168 |
+
'28': I-enzyme
|
| 169 |
+
'29': B-event
|
| 170 |
+
'30': I-event
|
| 171 |
+
'31': B-field
|
| 172 |
+
'32': I-field
|
| 173 |
+
'33': B-literarygenre
|
| 174 |
+
'34': I-literarygenre
|
| 175 |
+
'35': B-location
|
| 176 |
+
'36': I-location
|
| 177 |
+
'37': B-magazine
|
| 178 |
+
'38': I-magazine
|
| 179 |
+
'39': B-metrics
|
| 180 |
+
'40': I-metrics
|
| 181 |
+
'41': B-misc
|
| 182 |
+
'42': I-misc
|
| 183 |
+
'43': B-musicalartist
|
| 184 |
+
'44': I-musicalartist
|
| 185 |
+
'45': B-musicalinstrument
|
| 186 |
+
'46': I-musicalinstrument
|
| 187 |
+
'47': B-musicgenre
|
| 188 |
+
'48': I-musicgenre
|
| 189 |
+
'49': B-organisation
|
| 190 |
+
'50': I-organisation
|
| 191 |
+
'51': B-person
|
| 192 |
+
'52': I-person
|
| 193 |
+
'53': B-poem
|
| 194 |
+
'54': I-poem
|
| 195 |
+
'55': B-politicalparty
|
| 196 |
+
'56': I-politicalparty
|
| 197 |
+
'57': B-politician
|
| 198 |
+
'58': I-politician
|
| 199 |
+
'59': B-product
|
| 200 |
+
'60': I-product
|
| 201 |
+
'61': B-programlang
|
| 202 |
+
'62': I-programlang
|
| 203 |
+
'63': B-protein
|
| 204 |
+
'64': I-protein
|
| 205 |
+
'65': B-researcher
|
| 206 |
+
'66': I-researcher
|
| 207 |
+
'67': B-scientist
|
| 208 |
+
'68': I-scientist
|
| 209 |
+
'69': B-song
|
| 210 |
+
'70': I-song
|
| 211 |
+
'71': B-task
|
| 212 |
+
'72': I-task
|
| 213 |
+
'73': B-theory
|
| 214 |
+
'74': I-theory
|
| 215 |
+
'75': B-university
|
| 216 |
+
'76': I-university
|
| 217 |
+
'77': B-writer
|
| 218 |
+
'78': I-writer
|
| 219 |
+
splits:
|
| 220 |
+
- name: train
|
| 221 |
+
num_bytes: 63181
|
| 222 |
+
num_examples: 100
|
| 223 |
+
- name: validation
|
| 224 |
+
num_bytes: 244076
|
| 225 |
+
num_examples: 400
|
| 226 |
+
- name: test
|
| 227 |
+
num_bytes: 270092
|
| 228 |
+
num_examples: 416
|
| 229 |
+
download_size: 334380
|
| 230 |
+
dataset_size: 577349
|
| 231 |
+
- config_name: music
|
| 232 |
+
features:
|
| 233 |
+
- name: id
|
| 234 |
+
dtype: string
|
| 235 |
+
- name: tokens
|
| 236 |
+
sequence: string
|
| 237 |
+
- name: ner_tags
|
| 238 |
+
sequence:
|
| 239 |
+
class_label:
|
| 240 |
+
names:
|
| 241 |
+
'0': O
|
| 242 |
+
'1': B-academicjournal
|
| 243 |
+
'2': I-academicjournal
|
| 244 |
+
'3': B-album
|
| 245 |
+
'4': I-album
|
| 246 |
+
'5': B-algorithm
|
| 247 |
+
'6': I-algorithm
|
| 248 |
+
'7': B-astronomicalobject
|
| 249 |
+
'8': I-astronomicalobject
|
| 250 |
+
'9': B-award
|
| 251 |
+
'10': I-award
|
| 252 |
+
'11': B-band
|
| 253 |
+
'12': I-band
|
| 254 |
+
'13': B-book
|
| 255 |
+
'14': I-book
|
| 256 |
+
'15': B-chemicalcompound
|
| 257 |
+
'16': I-chemicalcompound
|
| 258 |
+
'17': B-chemicalelement
|
| 259 |
+
'18': I-chemicalelement
|
| 260 |
+
'19': B-conference
|
| 261 |
+
'20': I-conference
|
| 262 |
+
'21': B-country
|
| 263 |
+
'22': I-country
|
| 264 |
+
'23': B-discipline
|
| 265 |
+
'24': I-discipline
|
| 266 |
+
'25': B-election
|
| 267 |
+
'26': I-election
|
| 268 |
+
'27': B-enzyme
|
| 269 |
+
'28': I-enzyme
|
| 270 |
+
'29': B-event
|
| 271 |
+
'30': I-event
|
| 272 |
+
'31': B-field
|
| 273 |
+
'32': I-field
|
| 274 |
+
'33': B-literarygenre
|
| 275 |
+
'34': I-literarygenre
|
| 276 |
+
'35': B-location
|
| 277 |
+
'36': I-location
|
| 278 |
+
'37': B-magazine
|
| 279 |
+
'38': I-magazine
|
| 280 |
+
'39': B-metrics
|
| 281 |
+
'40': I-metrics
|
| 282 |
+
'41': B-misc
|
| 283 |
+
'42': I-misc
|
| 284 |
+
'43': B-musicalartist
|
| 285 |
+
'44': I-musicalartist
|
| 286 |
+
'45': B-musicalinstrument
|
| 287 |
+
'46': I-musicalinstrument
|
| 288 |
+
'47': B-musicgenre
|
| 289 |
+
'48': I-musicgenre
|
| 290 |
+
'49': B-organisation
|
| 291 |
+
'50': I-organisation
|
| 292 |
+
'51': B-person
|
| 293 |
+
'52': I-person
|
| 294 |
+
'53': B-poem
|
| 295 |
+
'54': I-poem
|
| 296 |
+
'55': B-politicalparty
|
| 297 |
+
'56': I-politicalparty
|
| 298 |
+
'57': B-politician
|
| 299 |
+
'58': I-politician
|
| 300 |
+
'59': B-product
|
| 301 |
+
'60': I-product
|
| 302 |
+
'61': B-programlang
|
| 303 |
+
'62': I-programlang
|
| 304 |
+
'63': B-protein
|
| 305 |
+
'64': I-protein
|
| 306 |
+
'65': B-researcher
|
| 307 |
+
'66': I-researcher
|
| 308 |
+
'67': B-scientist
|
| 309 |
+
'68': I-scientist
|
| 310 |
+
'69': B-song
|
| 311 |
+
'70': I-song
|
| 312 |
+
'71': B-task
|
| 313 |
+
'72': I-task
|
| 314 |
+
'73': B-theory
|
| 315 |
+
'74': I-theory
|
| 316 |
+
'75': B-university
|
| 317 |
+
'76': I-university
|
| 318 |
+
'77': B-writer
|
| 319 |
+
'78': I-writer
|
| 320 |
+
splits:
|
| 321 |
+
- name: train
|
| 322 |
+
num_bytes: 65077
|
| 323 |
+
num_examples: 100
|
| 324 |
+
- name: validation
|
| 325 |
+
num_bytes: 259702
|
| 326 |
+
num_examples: 380
|
| 327 |
+
- name: test
|
| 328 |
+
num_bytes: 327195
|
| 329 |
+
num_examples: 465
|
| 330 |
+
download_size: 414065
|
| 331 |
+
dataset_size: 651974
|
| 332 |
+
- config_name: conll2003
|
| 333 |
+
features:
|
| 334 |
+
- name: id
|
| 335 |
+
dtype: string
|
| 336 |
+
- name: tokens
|
| 337 |
+
sequence: string
|
| 338 |
+
- name: ner_tags
|
| 339 |
+
sequence:
|
| 340 |
+
class_label:
|
| 341 |
+
names:
|
| 342 |
+
'0': O
|
| 343 |
+
'1': B-academicjournal
|
| 344 |
+
'2': I-academicjournal
|
| 345 |
+
'3': B-album
|
| 346 |
+
'4': I-album
|
| 347 |
+
'5': B-algorithm
|
| 348 |
+
'6': I-algorithm
|
| 349 |
+
'7': B-astronomicalobject
|
| 350 |
+
'8': I-astronomicalobject
|
| 351 |
+
'9': B-award
|
| 352 |
+
'10': I-award
|
| 353 |
+
'11': B-band
|
| 354 |
+
'12': I-band
|
| 355 |
+
'13': B-book
|
| 356 |
+
'14': I-book
|
| 357 |
+
'15': B-chemicalcompound
|
| 358 |
+
'16': I-chemicalcompound
|
| 359 |
+
'17': B-chemicalelement
|
| 360 |
+
'18': I-chemicalelement
|
| 361 |
+
'19': B-conference
|
| 362 |
+
'20': I-conference
|
| 363 |
+
'21': B-country
|
| 364 |
+
'22': I-country
|
| 365 |
+
'23': B-discipline
|
| 366 |
+
'24': I-discipline
|
| 367 |
+
'25': B-election
|
| 368 |
+
'26': I-election
|
| 369 |
+
'27': B-enzyme
|
| 370 |
+
'28': I-enzyme
|
| 371 |
+
'29': B-event
|
| 372 |
+
'30': I-event
|
| 373 |
+
'31': B-field
|
| 374 |
+
'32': I-field
|
| 375 |
+
'33': B-literarygenre
|
| 376 |
+
'34': I-literarygenre
|
| 377 |
+
'35': B-location
|
| 378 |
+
'36': I-location
|
| 379 |
+
'37': B-magazine
|
| 380 |
+
'38': I-magazine
|
| 381 |
+
'39': B-metrics
|
| 382 |
+
'40': I-metrics
|
| 383 |
+
'41': B-misc
|
| 384 |
+
'42': I-misc
|
| 385 |
+
'43': B-musicalartist
|
| 386 |
+
'44': I-musicalartist
|
| 387 |
+
'45': B-musicalinstrument
|
| 388 |
+
'46': I-musicalinstrument
|
| 389 |
+
'47': B-musicgenre
|
| 390 |
+
'48': I-musicgenre
|
| 391 |
+
'49': B-organisation
|
| 392 |
+
'50': I-organisation
|
| 393 |
+
'51': B-person
|
| 394 |
+
'52': I-person
|
| 395 |
+
'53': B-poem
|
| 396 |
+
'54': I-poem
|
| 397 |
+
'55': B-politicalparty
|
| 398 |
+
'56': I-politicalparty
|
| 399 |
+
'57': B-politician
|
| 400 |
+
'58': I-politician
|
| 401 |
+
'59': B-product
|
| 402 |
+
'60': I-product
|
| 403 |
+
'61': B-programlang
|
| 404 |
+
'62': I-programlang
|
| 405 |
+
'63': B-protein
|
| 406 |
+
'64': I-protein
|
| 407 |
+
'65': B-researcher
|
| 408 |
+
'66': I-researcher
|
| 409 |
+
'67': B-scientist
|
| 410 |
+
'68': I-scientist
|
| 411 |
+
'69': B-song
|
| 412 |
+
'70': I-song
|
| 413 |
+
'71': B-task
|
| 414 |
+
'72': I-task
|
| 415 |
+
'73': B-theory
|
| 416 |
+
'74': I-theory
|
| 417 |
+
'75': B-university
|
| 418 |
+
'76': I-university
|
| 419 |
+
'77': B-writer
|
| 420 |
+
'78': I-writer
|
| 421 |
+
splits:
|
| 422 |
+
- name: train
|
| 423 |
+
num_bytes: 3561081
|
| 424 |
+
num_examples: 14041
|
| 425 |
+
- name: validation
|
| 426 |
+
num_bytes: 891431
|
| 427 |
+
num_examples: 3250
|
| 428 |
+
- name: test
|
| 429 |
+
num_bytes: 811470
|
| 430 |
+
num_examples: 3453
|
| 431 |
+
download_size: 2694794
|
| 432 |
+
dataset_size: 5263982
|
| 433 |
+
- config_name: politics
|
| 434 |
+
features:
|
| 435 |
+
- name: id
|
| 436 |
+
dtype: string
|
| 437 |
+
- name: tokens
|
| 438 |
+
sequence: string
|
| 439 |
+
- name: ner_tags
|
| 440 |
+
sequence:
|
| 441 |
+
class_label:
|
| 442 |
+
names:
|
| 443 |
+
'0': O
|
| 444 |
+
'1': B-academicjournal
|
| 445 |
+
'2': I-academicjournal
|
| 446 |
+
'3': B-album
|
| 447 |
+
'4': I-album
|
| 448 |
+
'5': B-algorithm
|
| 449 |
+
'6': I-algorithm
|
| 450 |
+
'7': B-astronomicalobject
|
| 451 |
+
'8': I-astronomicalobject
|
| 452 |
+
'9': B-award
|
| 453 |
+
'10': I-award
|
| 454 |
+
'11': B-band
|
| 455 |
+
'12': I-band
|
| 456 |
+
'13': B-book
|
| 457 |
+
'14': I-book
|
| 458 |
+
'15': B-chemicalcompound
|
| 459 |
+
'16': I-chemicalcompound
|
| 460 |
+
'17': B-chemicalelement
|
| 461 |
+
'18': I-chemicalelement
|
| 462 |
+
'19': B-conference
|
| 463 |
+
'20': I-conference
|
| 464 |
+
'21': B-country
|
| 465 |
+
'22': I-country
|
| 466 |
+
'23': B-discipline
|
| 467 |
+
'24': I-discipline
|
| 468 |
+
'25': B-election
|
| 469 |
+
'26': I-election
|
| 470 |
+
'27': B-enzyme
|
| 471 |
+
'28': I-enzyme
|
| 472 |
+
'29': B-event
|
| 473 |
+
'30': I-event
|
| 474 |
+
'31': B-field
|
| 475 |
+
'32': I-field
|
| 476 |
+
'33': B-literarygenre
|
| 477 |
+
'34': I-literarygenre
|
| 478 |
+
'35': B-location
|
| 479 |
+
'36': I-location
|
| 480 |
+
'37': B-magazine
|
| 481 |
+
'38': I-magazine
|
| 482 |
+
'39': B-metrics
|
| 483 |
+
'40': I-metrics
|
| 484 |
+
'41': B-misc
|
| 485 |
+
'42': I-misc
|
| 486 |
+
'43': B-musicalartist
|
| 487 |
+
'44': I-musicalartist
|
| 488 |
+
'45': B-musicalinstrument
|
| 489 |
+
'46': I-musicalinstrument
|
| 490 |
+
'47': B-musicgenre
|
| 491 |
+
'48': I-musicgenre
|
| 492 |
+
'49': B-organisation
|
| 493 |
+
'50': I-organisation
|
| 494 |
+
'51': B-person
|
| 495 |
+
'52': I-person
|
| 496 |
+
'53': B-poem
|
| 497 |
+
'54': I-poem
|
| 498 |
+
'55': B-politicalparty
|
| 499 |
+
'56': I-politicalparty
|
| 500 |
+
'57': B-politician
|
| 501 |
+
'58': I-politician
|
| 502 |
+
'59': B-product
|
| 503 |
+
'60': I-product
|
| 504 |
+
'61': B-programlang
|
| 505 |
+
'62': I-programlang
|
| 506 |
+
'63': B-protein
|
| 507 |
+
'64': I-protein
|
| 508 |
+
'65': B-researcher
|
| 509 |
+
'66': I-researcher
|
| 510 |
+
'67': B-scientist
|
| 511 |
+
'68': I-scientist
|
| 512 |
+
'69': B-song
|
| 513 |
+
'70': I-song
|
| 514 |
+
'71': B-task
|
| 515 |
+
'72': I-task
|
| 516 |
+
'73': B-theory
|
| 517 |
+
'74': I-theory
|
| 518 |
+
'75': B-university
|
| 519 |
+
'76': I-university
|
| 520 |
+
'77': B-writer
|
| 521 |
+
'78': I-writer
|
| 522 |
+
splits:
|
| 523 |
+
- name: train
|
| 524 |
+
num_bytes: 143507
|
| 525 |
+
num_examples: 200
|
| 526 |
+
- name: validation
|
| 527 |
+
num_bytes: 422760
|
| 528 |
+
num_examples: 541
|
| 529 |
+
- name: test
|
| 530 |
+
num_bytes: 472690
|
| 531 |
+
num_examples: 651
|
| 532 |
+
download_size: 724168
|
| 533 |
+
dataset_size: 1038957
|
| 534 |
+
- config_name: science
|
| 535 |
+
features:
|
| 536 |
+
- name: id
|
| 537 |
+
dtype: string
|
| 538 |
+
- name: tokens
|
| 539 |
+
sequence: string
|
| 540 |
+
- name: ner_tags
|
| 541 |
+
sequence:
|
| 542 |
+
class_label:
|
| 543 |
+
names:
|
| 544 |
+
'0': O
|
| 545 |
+
'1': B-academicjournal
|
| 546 |
+
'2': I-academicjournal
|
| 547 |
+
'3': B-album
|
| 548 |
+
'4': I-album
|
| 549 |
+
'5': B-algorithm
|
| 550 |
+
'6': I-algorithm
|
| 551 |
+
'7': B-astronomicalobject
|
| 552 |
+
'8': I-astronomicalobject
|
| 553 |
+
'9': B-award
|
| 554 |
+
'10': I-award
|
| 555 |
+
'11': B-band
|
| 556 |
+
'12': I-band
|
| 557 |
+
'13': B-book
|
| 558 |
+
'14': I-book
|
| 559 |
+
'15': B-chemicalcompound
|
| 560 |
+
'16': I-chemicalcompound
|
| 561 |
+
'17': B-chemicalelement
|
| 562 |
+
'18': I-chemicalelement
|
| 563 |
+
'19': B-conference
|
| 564 |
+
'20': I-conference
|
| 565 |
+
'21': B-country
|
| 566 |
+
'22': I-country
|
| 567 |
+
'23': B-discipline
|
| 568 |
+
'24': I-discipline
|
| 569 |
+
'25': B-election
|
| 570 |
+
'26': I-election
|
| 571 |
+
'27': B-enzyme
|
| 572 |
+
'28': I-enzyme
|
| 573 |
+
'29': B-event
|
| 574 |
+
'30': I-event
|
| 575 |
+
'31': B-field
|
| 576 |
+
'32': I-field
|
| 577 |
+
'33': B-literarygenre
|
| 578 |
+
'34': I-literarygenre
|
| 579 |
+
'35': B-location
|
| 580 |
+
'36': I-location
|
| 581 |
+
'37': B-magazine
|
| 582 |
+
'38': I-magazine
|
| 583 |
+
'39': B-metrics
|
| 584 |
+
'40': I-metrics
|
| 585 |
+
'41': B-misc
|
| 586 |
+
'42': I-misc
|
| 587 |
+
'43': B-musicalartist
|
| 588 |
+
'44': I-musicalartist
|
| 589 |
+
'45': B-musicalinstrument
|
| 590 |
+
'46': I-musicalinstrument
|
| 591 |
+
'47': B-musicgenre
|
| 592 |
+
'48': I-musicgenre
|
| 593 |
+
'49': B-organisation
|
| 594 |
+
'50': I-organisation
|
| 595 |
+
'51': B-person
|
| 596 |
+
'52': I-person
|
| 597 |
+
'53': B-poem
|
| 598 |
+
'54': I-poem
|
| 599 |
+
'55': B-politicalparty
|
| 600 |
+
'56': I-politicalparty
|
| 601 |
+
'57': B-politician
|
| 602 |
+
'58': I-politician
|
| 603 |
+
'59': B-product
|
| 604 |
+
'60': I-product
|
| 605 |
+
'61': B-programlang
|
| 606 |
+
'62': I-programlang
|
| 607 |
+
'63': B-protein
|
| 608 |
+
'64': I-protein
|
| 609 |
+
'65': B-researcher
|
| 610 |
+
'66': I-researcher
|
| 611 |
+
'67': B-scientist
|
| 612 |
+
'68': I-scientist
|
| 613 |
+
'69': B-song
|
| 614 |
+
'70': I-song
|
| 615 |
+
'71': B-task
|
| 616 |
+
'72': I-task
|
| 617 |
+
'73': B-theory
|
| 618 |
+
'74': I-theory
|
| 619 |
+
'75': B-university
|
| 620 |
+
'76': I-university
|
| 621 |
+
'77': B-writer
|
| 622 |
+
'78': I-writer
|
| 623 |
+
splits:
|
| 624 |
+
- name: train
|
| 625 |
+
num_bytes: 121928
|
| 626 |
+
num_examples: 200
|
| 627 |
+
- name: validation
|
| 628 |
+
num_bytes: 276118
|
| 629 |
+
num_examples: 450
|
| 630 |
+
- name: test
|
| 631 |
+
num_bytes: 334181
|
| 632 |
+
num_examples: 543
|
| 633 |
+
download_size: 485191
|
| 634 |
+
dataset_size: 732227
|
| 635 |
+
---
|
| 636 |
+
# Dataset Card for CrossRE
|
| 637 |
+
## Table of Contents
|
| 638 |
+
- [Table of Contents](#table-of-contents)
|
| 639 |
+
- [Dataset Description](#dataset-description)
|
| 640 |
+
- [Dataset Summary](#dataset-summary)
|
| 641 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
| 642 |
+
- [Languages](#languages)
|
| 643 |
+
- [Dataset Structure](#dataset-structure)
|
| 644 |
+
- [Data Instances](#data-instances)
|
| 645 |
+
- [Data Fields](#data-fields)
|
| 646 |
+
- [Data Splits](#data-splits)
|
| 647 |
+
- [Dataset Creation](#dataset-creation)
|
| 648 |
+
- [Curation Rationale](#curation-rationale)
|
| 649 |
+
- [Source Data](#source-data)
|
| 650 |
+
- [Annotations](#annotations)
|
| 651 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
| 652 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
| 653 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
| 654 |
+
- [Discussion of Biases](#discussion-of-biases)
|
| 655 |
+
- [Other Known Limitations](#other-known-limitations)
|
| 656 |
+
- [Additional Information](#additional-information)
|
| 657 |
+
- [Dataset Curators](#dataset-curators)
|
| 658 |
+
- [Licensing Information](#licensing-information)
|
| 659 |
+
- [Citation Information](#citation-information)
|
| 660 |
+
- [Contributions](#contributions)
|
| 661 |
+
|
| 662 |
+
## Dataset Description
|
| 663 |
+
- **Repository:** [CrossNER](https://github.com/zliucr/CrossNER)
|
| 664 |
+
- **Paper:** [CrossNER: Evaluating Cross-Domain Named Entity Recognition](https://arxiv.org/abs/2012.04373)
|
| 665 |
+
|
| 666 |
+
### Dataset Summary
|
| 667 |
+
CrossNER is a fully-labeled collected of named entity recognition (NER) data spanning over five diverse domains
|
| 668 |
+
(Politics, Natural Science, Music, Literature, and Artificial Intelligence) with specialized entity categories for
|
| 669 |
+
different domains. Additionally, CrossNER also includes unlabeled domain-related corpora for the corresponding five
|
| 670 |
+
domains.
|
| 671 |
+
|
| 672 |
+
For details, see the paper:
|
| 673 |
+
[CrossNER: Evaluating Cross-Domain Named Entity Recognition](https://arxiv.org/abs/2012.04373)
|
| 674 |
+
|
| 675 |
+
### Supported Tasks and Leaderboards
|
| 676 |
+
|
| 677 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 678 |
+
|
| 679 |
+
### Languages
|
| 680 |
+
|
| 681 |
+
The language data in CrossNER is in English (BCP-47 en)
|
| 682 |
+
|
| 683 |
+
## Dataset Structure
|
| 684 |
+
|
| 685 |
+
### Data Instances
|
| 686 |
+
|
| 687 |
+
#### conll2003
|
| 688 |
+
- **Size of downloaded dataset files:** 2.69 MB
|
| 689 |
+
- **Size of the generated dataset:** 5.26 MB
|
| 690 |
+
|
| 691 |
+
An example of 'train' looks as follows:
|
| 692 |
+
```json
|
| 693 |
+
{
|
| 694 |
+
"id": "0",
|
| 695 |
+
"tokens": ["EU", "rejects", "German", "call", "to", "boycott", "British", "lamb", "."],
|
| 696 |
+
"ner_tags": [49, 0, 41, 0, 0, 0, 41, 0, 0]
|
| 697 |
+
}
|
| 698 |
+
```
|
| 699 |
+
|
| 700 |
+
#### politics
|
| 701 |
+
- **Size of downloaded dataset files:** 0.72 MB
|
| 702 |
+
- **Size of the generated dataset:** 1.04 MB
|
| 703 |
+
|
| 704 |
+
An example of 'train' looks as follows:
|
| 705 |
+
```json
|
| 706 |
+
{
|
| 707 |
+
"id": "0",
|
| 708 |
+
"tokens": ["Parties", "with", "mainly", "Eurosceptic", "views", "are", "the", "ruling", "United", "Russia", ",", "and", "opposition", "parties", "the", "Communist", "Party", "of", "the", "Russian", "Federation", "and", "Liberal", "Democratic", "Party", "of", "Russia", "."],
|
| 709 |
+
"ner_tags": [0, 0, 0, 0, 0, 0, 0, 0, 55, 56, 0, 0, 0, 0, 0, 55, 56, 56, 56, 56, 56, 0, 55, 56, 56, 56, 56, 0]
|
| 710 |
+
}
|
| 711 |
+
```
|
| 712 |
+
|
| 713 |
+
#### science
|
| 714 |
+
- **Size of downloaded dataset files:** 0.49 MB
|
| 715 |
+
- **Size of the generated dataset:** 0.73 MB
|
| 716 |
+
|
| 717 |
+
An example of 'train' looks as follows:
|
| 718 |
+
```json
|
| 719 |
+
{
|
| 720 |
+
"id": "0",
|
| 721 |
+
"tokens": ["They", "may", "also", "use", "Adenosine", "triphosphate", ",", "Nitric", "oxide", ",", "and", "ROS", "for", "signaling", "in", "the", "same", "ways", "that", "animals", "do", "."],
|
| 722 |
+
"ner_tags": [0, 0, 0, 0, 15, 16, 0, 15, 16, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
| 723 |
+
}
|
| 724 |
+
```
|
| 725 |
+
|
| 726 |
+
#### music
|
| 727 |
+
- **Size of downloaded dataset files:** 0.41 MB
|
| 728 |
+
- **Size of the generated dataset:** 0.65 MB
|
| 729 |
+
|
| 730 |
+
An example of 'train' looks as follows:
|
| 731 |
+
```json
|
| 732 |
+
{
|
| 733 |
+
"id": "0",
|
| 734 |
+
"tokens": ["In", "2003", ",", "the", "Stade", "de", "France", "was", "the", "primary", "site", "of", "the", "2003", "World", "Championships", "in", "Athletics", "."],
|
| 735 |
+
"ner_tags": [0, 0, 0, 0, 35, 36, 36, 0, 0, 0, 0, 0, 0, 29, 30, 30, 30, 30, 0]
|
| 736 |
+
}
|
| 737 |
+
```
|
| 738 |
+
|
| 739 |
+
#### literature
|
| 740 |
+
- **Size of downloaded dataset files:** 0.33 MB
|
| 741 |
+
- **Size of the generated dataset:** 0.58 MB
|
| 742 |
+
|
| 743 |
+
An example of 'train' looks as follows:
|
| 744 |
+
```json
|
| 745 |
+
{
|
| 746 |
+
"id": "0",
|
| 747 |
+
"tokens": ["In", "1351", ",", "during", "the", "reign", "of", "Emperor", "Toghon", "Temür", "of", "the", "Yuan", "dynasty", ",", "93rd-generation", "descendant", "Kong", "Huan", "(", "孔浣", ")", "'", "s", "2nd", "son", "Kong", "Shao", "(", "孔昭", ")", "moved", "from", "China", "to", "Korea", "during", "the", "Goryeo", ",", "and", "was", "received", "courteously", "by", "Princess", "Noguk", "(", "the", "Mongolian-born", "wife", "of", "the", "future", "king", "Gongmin", ")", "."],
|
| 748 |
+
"ner_tags": [0, 0, 0, 0, 0, 0, 0, 51, 52, 52, 0, 0, 21, 22, 0, 0, 0, 77, 78, 0, 77, 0, 0, 0, 0, 0, 77, 78, 0, 77, 0, 0, 0, 21, 0, 21, 0, 0, 41, 0, 0, 0, 0, 0, 0, 51, 52, 0, 0, 41, 0, 0, 0, 0, 0, 51, 0, 0]
|
| 749 |
+
}
|
| 750 |
+
```
|
| 751 |
+
|
| 752 |
+
#### ai
|
| 753 |
+
- **Size of downloaded dataset files:** 0.29 MB
|
| 754 |
+
- **Size of the generated dataset:** 0.48 MB
|
| 755 |
+
|
| 756 |
+
An example of 'train' looks as follows:
|
| 757 |
+
```json
|
| 758 |
+
{
|
| 759 |
+
"id": "0",
|
| 760 |
+
"tokens": ["Popular", "approaches", "of", "opinion-based", "recommender", "system", "utilize", "various", "techniques", "including", "text", "mining", ",", "information", "retrieval", ",", "sentiment", "analysis", "(", "see", "also", "Multimodal", "sentiment", "analysis", ")", "and", "deep", "learning", "X.Y.", "Feng", ",", "H.", "Zhang", ",", "Y.J.", "Ren", ",", "P.H.", "Shang", ",", "Y.", "Zhu", ",", "Y.C.", "Liang", ",", "R.C.", "Guan", ",", "D.", "Xu", ",", "(", "2019", ")", ",", ",", "21", "(", "5", ")", ":", "e12957", "."],
|
| 761 |
+
"ner_tags": [0, 0, 0, 59, 60, 60, 0, 0, 0, 0, 31, 32, 0, 71, 72, 0, 71, 72, 0, 0, 0, 71, 72, 72, 0, 0, 31, 32, 65, 66, 0, 65, 66, 0, 65, 66, 0, 65, 66, 0, 65, 66, 0, 65, 66, 0, 65, 66, 0, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
| 762 |
+
}
|
| 763 |
+
```
|
| 764 |
+
|
| 765 |
+
### Data Fields
|
| 766 |
+
|
| 767 |
+
The data fields are the same among all splits.
|
| 768 |
+
- `id`: the instance id of this sentence, a `string` feature.
|
| 769 |
+
- `tokens`: the list of tokens of this sentence, a `list` of `string` features.
|
| 770 |
+
- `ner_tags`: the list of entity tags, a `list` of classification labels.
|
| 771 |
+
|
| 772 |
+
```json
|
| 773 |
+
{"O": 0, "B-academicjournal": 1, "I-academicjournal": 2, "B-album": 3, "I-album": 4, "B-algorithm": 5, "I-algorithm": 6, "B-astronomicalobject": 7, "I-astronomicalobject": 8, "B-award": 9, "I-award": 10, "B-band": 11, "I-band": 12, "B-book": 13, "I-book": 14, "B-chemicalcompound": 15, "I-chemicalcompound": 16, "B-chemicalelement": 17, "I-chemicalelement": 18, "B-conference": 19, "I-conference": 20, "B-country": 21, "I-country": 22, "B-discipline": 23, "I-discipline": 24, "B-election": 25, "I-election": 26, "B-enzyme": 27, "I-enzyme": 28, "B-event": 29, "I-event": 30, "B-field": 31, "I-field": 32, "B-literarygenre": 33, "I-literarygenre": 34, "B-location": 35, "I-location": 36, "B-magazine": 37, "I-magazine": 38, "B-metrics": 39, "I-metrics": 40, "B-misc": 41, "I-misc": 42, "B-musicalartist": 43, "I-musicalartist": 44, "B-musicalinstrument": 45, "I-musicalinstrument": 46, "B-musicgenre": 47, "I-musicgenre": 48, "B-organisation": 49, "I-organisation": 50, "B-person": 51, "I-person": 52, "B-poem": 53, "I-poem": 54, "B-politicalparty": 55, "I-politicalparty": 56, "B-politician": 57, "I-politician": 58, "B-product": 59, "I-product": 60, "B-programlang": 61, "I-programlang": 62, "B-protein": 63, "I-protein": 64, "B-researcher": 65, "I-researcher": 66, "B-scientist": 67, "I-scientist": 68, "B-song": 69, "I-song": 70, "B-task": 71, "I-task": 72, "B-theory": 73, "I-theory": 74, "B-university": 75, "I-university": 76, "B-writer": 77, "I-writer": 78}
|
| 774 |
+
```
|
| 775 |
+
|
| 776 |
+
### Data Splits
|
| 777 |
+
| | Train | Dev | Test |
|
| 778 |
+
|--------------|--------|-------|-------|
|
| 779 |
+
| conll2003 | 14,987 | 3,466 | 3,684 |
|
| 780 |
+
| politics | 200 | 541 | 651 |
|
| 781 |
+
| science | 200 | 450 | 543 |
|
| 782 |
+
| music | 100 | 380 | 456 |
|
| 783 |
+
| literature | 100 | 400 | 416 |
|
| 784 |
+
| ai | 100 | 350 | 431 |
|
| 785 |
+
|
| 786 |
+
## Dataset Creation
|
| 787 |
+
|
| 788 |
+
### Curation Rationale
|
| 789 |
+
|
| 790 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 791 |
+
|
| 792 |
+
### Source Data
|
| 793 |
+
|
| 794 |
+
#### Initial Data Collection and Normalization
|
| 795 |
+
|
| 796 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 797 |
+
|
| 798 |
+
#### Who are the source language producers?
|
| 799 |
+
|
| 800 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 801 |
+
|
| 802 |
+
### Annotations
|
| 803 |
+
|
| 804 |
+
#### Annotation process
|
| 805 |
+
|
| 806 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 807 |
+
|
| 808 |
+
#### Who are the annotators?
|
| 809 |
+
|
| 810 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 811 |
+
|
| 812 |
+
### Personal and Sensitive Information
|
| 813 |
+
|
| 814 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 815 |
+
|
| 816 |
+
## Considerations for Using the Data
|
| 817 |
+
|
| 818 |
+
### Social Impact of Dataset
|
| 819 |
+
|
| 820 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 821 |
+
|
| 822 |
+
### Discussion of Biases
|
| 823 |
+
|
| 824 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 825 |
+
|
| 826 |
+
### Other Known Limitations
|
| 827 |
+
|
| 828 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 829 |
+
|
| 830 |
+
## Additional Information
|
| 831 |
+
|
| 832 |
+
### Dataset Curators
|
| 833 |
+
|
| 834 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 835 |
+
|
| 836 |
+
### Licensing Information
|
| 837 |
+
|
| 838 |
+
[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
|
| 839 |
+
|
| 840 |
+
### Citation Information
|
| 841 |
+
|
| 842 |
+
```
|
| 843 |
+
@article{liu2020crossner,
|
| 844 |
+
title={CrossNER: Evaluating Cross-Domain Named Entity Recognition},
|
| 845 |
+
author={Zihan Liu and Yan Xu and Tiezheng Yu and Wenliang Dai and Ziwei Ji and Samuel Cahyawijaya and Andrea Madotto and Pascale Fung},
|
| 846 |
+
year={2020},
|
| 847 |
+
eprint={2012.04373},
|
| 848 |
+
archivePrefix={arXiv},
|
| 849 |
+
primaryClass={cs.CL}
|
| 850 |
+
}
|
| 851 |
+
```
|
| 852 |
+
|
| 853 |
+
### Contributions
|
| 854 |
+
|
| 855 |
+
Thanks to [@phucdev](https://github.com/phucdev) for adding this dataset.
|
cross_ner.py
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""CrossNER is a cross-domain dataset for named entity recognition"""
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
import json
|
| 18 |
+
import os
|
| 19 |
+
|
| 20 |
+
import datasets
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
_CITATION = """\
|
| 24 |
+
@article{liu2020crossner,
|
| 25 |
+
title={CrossNER: Evaluating Cross-Domain Named Entity Recognition},
|
| 26 |
+
author={Zihan Liu and Yan Xu and Tiezheng Yu and Wenliang Dai and Ziwei Ji and Samuel Cahyawijaya and Andrea Madotto and Pascale Fung},
|
| 27 |
+
year={2020},
|
| 28 |
+
eprint={2012.04373},
|
| 29 |
+
archivePrefix={arXiv},
|
| 30 |
+
primaryClass={cs.CL}
|
| 31 |
+
}
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
_DESCRIPTION = """\
|
| 35 |
+
CrossNER is a fully-labeled collected of named entity recognition (NER) data spanning over five diverse domains
|
| 36 |
+
(Politics, Natural Science, Music, Literature, and Artificial Intelligence) with specialized entity categories for
|
| 37 |
+
different domains. Additionally, CrossNER also includes unlabeled domain-related corpora for the corresponding five
|
| 38 |
+
domains.
|
| 39 |
+
|
| 40 |
+
For details, see the paper:
|
| 41 |
+
[CrossNER: Evaluating Cross-Domain Named Entity Recognition](https://arxiv.org/abs/2012.04373)
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
_HOMEPAGE = "https://github.com/zliucr/CrossNER"
|
| 45 |
+
|
| 46 |
+
# TODO: Add the licence for the dataset here if you can find it
|
| 47 |
+
_LICENSE = ""
|
| 48 |
+
|
| 49 |
+
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
| 50 |
+
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
| 51 |
+
_URLS = {
|
| 52 |
+
"conll2003": {
|
| 53 |
+
"train": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/conll2003/train.txt",
|
| 54 |
+
"validation": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/conll2003/dev.txt",
|
| 55 |
+
"test": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/conll2003/test.txt",
|
| 56 |
+
},
|
| 57 |
+
"politics": {
|
| 58 |
+
"train": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/politics/train.txt",
|
| 59 |
+
"validation": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/politics/dev.txt",
|
| 60 |
+
"test": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/politics/test.txt",
|
| 61 |
+
},
|
| 62 |
+
"science": {
|
| 63 |
+
"train": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/science/train.txt",
|
| 64 |
+
"validation": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/science/dev.txt",
|
| 65 |
+
"test": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/science/test.txt",
|
| 66 |
+
},
|
| 67 |
+
"music": {
|
| 68 |
+
"train": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/music/train.txt",
|
| 69 |
+
"validation": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/music/dev.txt",
|
| 70 |
+
"test": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/music/test.txt",
|
| 71 |
+
},
|
| 72 |
+
"literature": {
|
| 73 |
+
"train": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/literature/train.txt",
|
| 74 |
+
"validation": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/literature/dev.txt",
|
| 75 |
+
"test": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/literature/test.txt",
|
| 76 |
+
},
|
| 77 |
+
"ai": {
|
| 78 |
+
"train": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/ai/train.txt",
|
| 79 |
+
"validation": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/ai/dev.txt",
|
| 80 |
+
"test": "https://raw.githubusercontent.com/zliucr/CrossNER/main/ner_data/ai/test.txt",
|
| 81 |
+
},
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
_CLASS_LABELS = [
|
| 86 |
+
"O",
|
| 87 |
+
"B-academicjournal", "I-academicjournal",
|
| 88 |
+
"B-album", "I-album",
|
| 89 |
+
"B-algorithm", "I-algorithm",
|
| 90 |
+
"B-astronomicalobject", "I-astronomicalobject",
|
| 91 |
+
"B-award", "I-award",
|
| 92 |
+
"B-band", "I-band",
|
| 93 |
+
"B-book", "I-book",
|
| 94 |
+
"B-chemicalcompound", "I-chemicalcompound",
|
| 95 |
+
"B-chemicalelement", "I-chemicalelement",
|
| 96 |
+
"B-conference", "I-conference",
|
| 97 |
+
"B-country", "I-country",
|
| 98 |
+
"B-discipline", "I-discipline",
|
| 99 |
+
"B-election", "I-election",
|
| 100 |
+
"B-enzyme", "I-enzyme",
|
| 101 |
+
"B-event", "I-event",
|
| 102 |
+
"B-field", "I-field",
|
| 103 |
+
"B-literarygenre", "I-literarygenre",
|
| 104 |
+
"B-location", "I-location",
|
| 105 |
+
"B-magazine", "I-magazine",
|
| 106 |
+
"B-metrics", "I-metrics",
|
| 107 |
+
"B-misc", "I-misc",
|
| 108 |
+
"B-musicalartist", "I-musicalartist",
|
| 109 |
+
"B-musicalinstrument", "I-musicalinstrument",
|
| 110 |
+
"B-musicgenre", "I-musicgenre",
|
| 111 |
+
"B-organisation", "I-organisation",
|
| 112 |
+
"B-person", "I-person",
|
| 113 |
+
"B-poem", "I-poem",
|
| 114 |
+
"B-politicalparty", "I-politicalparty",
|
| 115 |
+
"B-politician", "I-politician",
|
| 116 |
+
"B-product", "I-product",
|
| 117 |
+
"B-programlang", "I-programlang",
|
| 118 |
+
"B-protein", "I-protein",
|
| 119 |
+
"B-researcher", "I-researcher",
|
| 120 |
+
"B-scientist", "I-scientist",
|
| 121 |
+
"B-song", "I-song",
|
| 122 |
+
"B-task", "I-task",
|
| 123 |
+
"B-theory", "I-theory",
|
| 124 |
+
"B-university", "I-university",
|
| 125 |
+
"B-writer", "I-writer",
|
| 126 |
+
]
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
class CrossNER(datasets.GeneratorBasedBuilder):
|
| 130 |
+
"""CrossNER is a cross-domain dataset for named entity recognition"""
|
| 131 |
+
|
| 132 |
+
VERSION = datasets.Version("1.1.0")
|
| 133 |
+
|
| 134 |
+
# This is an example of a dataset with multiple configurations.
|
| 135 |
+
# If you don't want/need to define several sub-sets in your dataset,
|
| 136 |
+
# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
|
| 137 |
+
|
| 138 |
+
# If you need to make complex sub-parts in the datasets with configurable options
|
| 139 |
+
# You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
|
| 140 |
+
# BUILDER_CONFIG_CLASS = MyBuilderConfig
|
| 141 |
+
|
| 142 |
+
# You will be able to load one or the other configurations in the following list with
|
| 143 |
+
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
| 144 |
+
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
| 145 |
+
BUILDER_CONFIGS = [
|
| 146 |
+
datasets.BuilderConfig(name="conll2003", version=VERSION,
|
| 147 |
+
description="This part of CrossNER covers data from the news domain"),
|
| 148 |
+
datasets.BuilderConfig(name="politics", version=VERSION,
|
| 149 |
+
description="This part of CrossNER covers data from the politics domain"),
|
| 150 |
+
datasets.BuilderConfig(name="science", version=VERSION,
|
| 151 |
+
description="This part of CrossNER covers data from the science domain"),
|
| 152 |
+
datasets.BuilderConfig(name="music", version=VERSION,
|
| 153 |
+
description="This part of CrossNER covers data from the music domain"),
|
| 154 |
+
datasets.BuilderConfig(name="literature", version=VERSION,
|
| 155 |
+
description="This part of CrossNER covers data from the literature domain"),
|
| 156 |
+
datasets.BuilderConfig(name="ai", version=VERSION,
|
| 157 |
+
description="This part of CrossNER covers data from the AI domain"),
|
| 158 |
+
]
|
| 159 |
+
|
| 160 |
+
def _info(self):
|
| 161 |
+
features = datasets.Features(
|
| 162 |
+
{
|
| 163 |
+
"id": datasets.Value("string"),
|
| 164 |
+
"tokens": datasets.Sequence(datasets.Value("string")),
|
| 165 |
+
"ner_tags": datasets.Sequence(datasets.features.ClassLabel(names=_CLASS_LABELS)),
|
| 166 |
+
}
|
| 167 |
+
)
|
| 168 |
+
return datasets.DatasetInfo(
|
| 169 |
+
# This is the description that will appear on the datasets page.
|
| 170 |
+
description=_DESCRIPTION,
|
| 171 |
+
# This defines the different columns of the dataset and their types
|
| 172 |
+
features=features, # Here we define them above because they are different between the two configurations
|
| 173 |
+
# If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
|
| 174 |
+
# specify them. They'll be used if as_supervised=True in builder.as_dataset.
|
| 175 |
+
# supervised_keys=("sentence", "label"),
|
| 176 |
+
# Homepage of the dataset for documentation
|
| 177 |
+
homepage=_HOMEPAGE,
|
| 178 |
+
# License for the dataset if available
|
| 179 |
+
license=_LICENSE,
|
| 180 |
+
# Citation for the dataset
|
| 181 |
+
citation=_CITATION,
|
| 182 |
+
)
|
| 183 |
+
|
| 184 |
+
def _split_generators(self, dl_manager):
|
| 185 |
+
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
| 186 |
+
|
| 187 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
| 188 |
+
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
| 189 |
+
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
| 190 |
+
urls = _URLS[self.config.name]
|
| 191 |
+
downloaded_files = dl_manager.download_and_extract(urls)
|
| 192 |
+
return [datasets.SplitGenerator(name=i, gen_kwargs={"filepath": downloaded_files[str(i)]})
|
| 193 |
+
for i in [datasets.Split.TRAIN, datasets.Split.VALIDATION, datasets.Split.TEST]]
|
| 194 |
+
|
| 195 |
+
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 196 |
+
def _generate_examples(self, filepath):
|
| 197 |
+
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
| 198 |
+
with open(filepath, encoding="utf-8") as f:
|
| 199 |
+
guid = 0
|
| 200 |
+
tokens = []
|
| 201 |
+
ner_tags = []
|
| 202 |
+
for line in f:
|
| 203 |
+
if line == "" or line == "\n":
|
| 204 |
+
if tokens:
|
| 205 |
+
yield guid, {
|
| 206 |
+
"id": str(guid),
|
| 207 |
+
"tokens": tokens,
|
| 208 |
+
"ner_tags": ner_tags,
|
| 209 |
+
}
|
| 210 |
+
guid += 1
|
| 211 |
+
tokens = []
|
| 212 |
+
ner_tags = []
|
| 213 |
+
else:
|
| 214 |
+
splits = line.split("\t")
|
| 215 |
+
tokens.append(splits[0])
|
| 216 |
+
ner_tags.append(splits[1].rstrip())
|
| 217 |
+
# last example
|
| 218 |
+
if tokens:
|
| 219 |
+
yield guid, {
|
| 220 |
+
"id": str(guid),
|
| 221 |
+
"tokens": tokens,
|
| 222 |
+
"ner_tags": ner_tags,
|
| 223 |
+
}
|