iluvvatar commited on
Commit
9362815
1 Parent(s): d78624a
Files changed (6) hide show
  1. README.md +89 -0
  2. RuNNE.py +94 -0
  3. data/dev.jsonl +0 -0
  4. data/test.jsonl +0 -0
  5. data/train.jsonl +0 -0
  6. ent_types.txt +29 -0
README.md ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ languages:
3
+ - ru
4
+ multilinguality:
5
+ - monolingual
6
+ pretty_name: RuNNE
7
+ task_categories:
8
+ - structure-prediction
9
+ task_ids:
10
+ - named-entity-recognition
11
+ ---
12
+
13
+ # RuNNE dataset
14
+
15
+ ## Table of Contents
16
+ - [Dataset Description](#dataset-description)
17
+ - [Dataset Structure](#dataset-structure)
18
+ - [Citation Information](#citation-information)
19
+ - [Contacts](#contacts)
20
+
21
+ ## Dataset Description
22
+ Part of NEREL dataset (https://arxiv.org/abs/2108.13112), a Russian dataset
23
+ for named entity recognition and relation extraction, used in RuNNE (2022)
24
+ competition (https://github.com/dialogue-evaluation/RuNNE).
25
+
26
+ Entities may be nested (see https://arxiv.org/abs/2108.13112).
27
+
28
+ Entity types list:
29
+ * AGE
30
+ * AWARD
31
+ * CITY
32
+ * COUNTRY
33
+ * CRIME
34
+ * DATE
35
+ * DISEASE
36
+ * DISTRICT
37
+ * EVENT
38
+ * FACILITY
39
+ * FAMILY
40
+ * IDEOLOGY
41
+ * LANGUAGE
42
+ * LAW
43
+ * LOCATION
44
+ * MONEY
45
+ * NATIONALITY
46
+ * NUMBER
47
+ * ORDINAL
48
+ * ORGANIZATION
49
+ * PENALTY
50
+ * PERCENT
51
+ * PERSON
52
+ * PRODUCT
53
+ * PROFESSION
54
+ * RELIGION
55
+ * STATE_OR_PROVINCE
56
+ * TIME
57
+ * WORK_OF_ART
58
+
59
+ ## Dataset Structure
60
+ There are two "configs" or "subsets" of the dataset.
61
+ Using
62
+ `load_dataset('MalakhovIlya/RuNNE', 'ent_types')['ent_types']`
63
+ you can download list of entity types (
64
+ Dataset({
65
+ features: ['type'],
66
+ num_rows: 29
67
+ })
68
+ )
69
+ Using
70
+ `load_dataset('MalakhovIlya/RuNNE', 'data')` or `load_dataset('MalakhovIlya/RuNNE')`
71
+ you can download the data itself (DatasetDict)
72
+
73
+ Dataset consists of 3 splits: "train", "test" and "dev". Each of them contains text document. "Train" and "test" splits also contain annotated entities, "dev" doesn't.
74
+ Each entity is represented by a string of the following format: "\<start> \<stop> \<type>", where \<start> is a position of the first symbol of entity in text, \<stop> is the last symbol position in text and \<type> is a one of the aforementioned list of types.
75
+
76
+ P.S.
77
+ Original NEREL dataset also contains relations, events and linked entities, but they were not added here yet ¯\\\_(ツ)_/¯
78
+
79
+ ## Citation Information
80
+ @article{Artemova2022runne,
81
+ title={{RuNNE-2022 Shared Task: Recognizing Nested Named Entities}},
82
+ author={Artemova, Ekaterina and Zmeev, Maksim and Loukachevitch, Natalia and Rozhkov, Igor and Batura, Tatiana and Braslavski, Pavel and Ivanov, Vladimir and Tutubalina, Elena},
83
+ journal={Computational Linguistics and Intellectual Technologies: Proceedings of the International Conference "Dialog"},
84
+ year={2022}
85
+ }
86
+
87
+ ## Contacts
88
+ Malakhov Ilya
89
+ Telegram - https://t.me/noname_4710
RuNNE.py ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datasets
2
+ import json
3
+
4
+ _NAME = 'RuNNE'
5
+ _CITATION = '''
6
+ @article{Artemova2022runne,
7
+ title={{RuNNE-2022 Shared Task: Recognizing Nested Named Entities}},
8
+ author={Artemova, Ekaterina and Zmeev, Maksim and Loukachevitch,
9
+ Natalia and Rozhkov, Igor and Batura, Tatiana and Braslavski,
10
+ Pavel and Ivanov, Vladimir and Tutubalina, Elena},
11
+ journal={Computational Linguistics and Intellectual Technologies:
12
+ Proceedings of the International Conference "Dialog"},
13
+ year={2022}
14
+ }
15
+ '''.strip()
16
+ _DESCRIPTION = 'A Russian Dataset with Nested Named Entities'
17
+ _HOMEPAGE = 'https://github.com/dialogue-evaluation/RuNNE'
18
+ _VERSION = '1.0.0'
19
+
20
+
21
+ class RuNNEBuilder(datasets.GeneratorBasedBuilder):
22
+ _DATA_URLS = {
23
+ 'train': 'data/train.jsonl',
24
+ 'test': 'data/test.jsonl',
25
+ 'dev': 'data/dev.jsonl'
26
+ }
27
+ _ENTITY_TYPES_URLS = {
28
+ 'ent_types': 'ent_types.txt'
29
+ }
30
+ VERSION = datasets.Version(_VERSION)
31
+ BUILDER_CONFIGS = [
32
+ datasets.BuilderConfig('data',
33
+ version=VERSION,
34
+ description='Data'),
35
+ datasets.BuilderConfig('ent_types',
36
+ version=VERSION,
37
+ description='Entity types list')
38
+ ]
39
+ DEFAULT_CONFIG_NAME = 'data'
40
+
41
+ def _info(self) -> datasets.DatasetInfo:
42
+ if self.config.name == 'data':
43
+ features = datasets.Features({
44
+ 'id': datasets.Value('int32'),
45
+ 'text': datasets.Value('string'),
46
+ 'entities': datasets.Sequence(datasets.Value('string'))
47
+ })
48
+ else:
49
+ features = datasets.Features({
50
+ 'type': datasets.Value('string')
51
+ })
52
+ return datasets.DatasetInfo(
53
+ description=_DESCRIPTION,
54
+ features=features,
55
+ homepage=_HOMEPAGE,
56
+ citation=_CITATION
57
+ )
58
+
59
+ def _split_generators(self, dl_manager: datasets.DownloadManager):
60
+ if self.config.name == 'data':
61
+ files = dl_manager.download(self._DATA_URLS)
62
+ return [
63
+ datasets.SplitGenerator(
64
+ name=datasets.Split.TRAIN,
65
+ gen_kwargs={'filepath': files['train']},
66
+ ),
67
+ datasets.SplitGenerator(
68
+ name=datasets.Split.TEST,
69
+ gen_kwargs={'filepath': files['test']},
70
+ ),
71
+ datasets.SplitGenerator(
72
+ name='dev',
73
+ gen_kwargs={'filepath': files['dev']},
74
+ ),
75
+ ]
76
+ else:
77
+ files = dl_manager.download(self._ENTITY_TYPES_URLS)
78
+ return [datasets.SplitGenerator(
79
+ name='ent_types',
80
+ gen_kwargs={'filepath': files['ent_types']},
81
+ )]
82
+
83
+ def _generate_examples(self, filepath):
84
+ if self.config.name == 'data':
85
+ with open(filepath, encoding='utf-8') as f:
86
+ for line in f:
87
+ doc = json.loads(line)
88
+ yield doc['id'], doc
89
+ else:
90
+ with open(filepath, encoding='utf-8') as f:
91
+ for i, line in enumerate(f):
92
+ entity_type = line.strip()
93
+ if entity_type:
94
+ yield i, {'type': entity_type}
data/dev.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/test.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/train.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
ent_types.txt ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AGE
2
+ AWARD
3
+ CITY
4
+ COUNTRY
5
+ CRIME
6
+ DATE
7
+ DISEASE
8
+ DISTRICT
9
+ EVENT
10
+ FACILITY
11
+ FAMILY
12
+ IDEOLOGY
13
+ LANGUAGE
14
+ LAW
15
+ LOCATION
16
+ MONEY
17
+ NATIONALITY
18
+ NUMBER
19
+ ORDINAL
20
+ ORGANIZATION
21
+ PENALTY
22
+ PERCENT
23
+ PERSON
24
+ PRODUCT
25
+ PROFESSION
26
+ RELIGION
27
+ STATE_OR_PROVINCE
28
+ TIME
29
+ WORK_OF_ART