asahi417 commited on
Commit
6186068
1 Parent(s): 52064fa
README.md ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license:
5
+ - other
6
+ multilinguality:
7
+ - monolingual
8
+ size_categories:
9
+ - 10K<n<100K
10
+ task_categories:
11
+ - token-classification
12
+ task_ids:
13
+ - named-entity-recognition
14
+ pretty_name: Ontonotes5
15
+ ---
16
+
17
+ # Dataset Card for "tner/ontonotes5"
18
+
19
+ ## Dataset Description
20
+
21
+ - **Repository:** [T-NER](https://github.com/asahi417/tner)
22
+ - **Paper:** [https://aclanthology.org/N06-2015/](https://aclanthology.org/N06-2015/)
23
+
24
+ ### Dataset Summary
25
+ Ontonotes5 NER dataset formatted in a part of [TNER](https://github.com/asahi417/tner) project.
26
+
27
+ ## Dataset Structure
28
+
29
+ ### Data Instances
30
+ An example of `train` looks as follows.
31
+
32
+ ```
33
+ {
34
+ 'tags': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 0, 0, 0, 0, 11, 12, 12, 12, 12, 0, 0, 7, 0, 0, 0, 0, 0],
35
+ 'tokens': ['``', 'It', "'s", 'very', 'costly', 'and', 'time', '-', 'consuming', ',', "''", 'says', 'Phil', 'Rosen', ',', 'a', 'partner', 'in', 'Fleet', '&', 'Leasing', 'Management', 'Inc.', ',', 'a', 'Boston', 'car', '-', 'leasing', 'company', '.']
36
+ }
37
+ ```
38
+
39
+ ### Label ID
40
+ The label2id dictionary can be found at [here](https://huggingface.co/datasets/tner/onotonotes5/raw/main/dataset/label.json).
41
+ ```python
42
+ {
43
+ "O": 0,
44
+ "B-CARDINAL": 1,
45
+ "B-DATE": 2,
46
+ "I-DATE": 3,
47
+ "B-PERSON": 4,
48
+ "I-PERSON": 5,
49
+ "B-NORP": 6,
50
+ "B-GPE": 7,
51
+ "I-GPE": 8,
52
+ "B-LAW": 9,
53
+ "I-LAW": 10,
54
+ "B-ORG": 11,
55
+ "I-ORG": 12,
56
+ "B-PERCENT": 13,
57
+ "I-PERCENT": 14,
58
+ "B-ORDINAL": 15,
59
+ "B-MONEY": 16,
60
+ "I-MONEY": 17,
61
+ "B-WORK_OF_ART": 18,
62
+ "I-WORK_OF_ART": 19,
63
+ "B-FAC": 20,
64
+ "B-TIME": 21,
65
+ "I-CARDINAL": 22,
66
+ "B-LOC": 23,
67
+ "B-QUANTITY": 24,
68
+ "I-QUANTITY": 25,
69
+ "I-NORP": 26,
70
+ "I-LOC": 27,
71
+ "B-PRODUCT": 28,
72
+ "I-TIME": 29,
73
+ "B-EVENT": 30,
74
+ "I-EVENT": 31,
75
+ "I-FAC": 32,
76
+ "B-LANGUAGE": 33,
77
+ "I-PRODUCT": 34,
78
+ "I-ORDINAL": 35,
79
+ "I-LANGUAGE": 36
80
+ }
81
+ ```
82
+
83
+ ### Data Splits
84
+
85
+ | name |train|validation|test|
86
+ |---------|----:|---------:|---:|
87
+ |conll2003|14041| 3250|3453|
88
+
89
+ ### Citation Information
90
+
91
+ ```
92
+ @inproceedings{hovy-etal-2006-ontonotes,
93
+ title = "{O}nto{N}otes: The 90{\%} Solution",
94
+ author = "Hovy, Eduard and
95
+ Marcus, Mitchell and
96
+ Palmer, Martha and
97
+ Ramshaw, Lance and
98
+ Weischedel, Ralph",
99
+ booktitle = "Proceedings of the Human Language Technology Conference of the {NAACL}, Companion Volume: Short Papers",
100
+ month = jun,
101
+ year = "2006",
102
+ address = "New York City, USA",
103
+ publisher = "Association for Computational Linguistics",
104
+ url = "https://aclanthology.org/N06-2015",
105
+ pages = "57--60",
106
+ }
107
+ ```
dataset/label.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"O": 0, "B-CARDINAL": 1, "B-DATE": 2, "I-DATE": 3, "B-PERSON": 4, "I-PERSON": 5, "B-NORP": 6, "B-GPE": 7, "I-GPE": 8, "B-LAW": 9, "I-LAW": 10, "B-ORG": 11, "I-ORG": 12, "B-PERCENT": 13, "I-PERCENT": 14, "B-ORDINAL": 15, "B-MONEY": 16, "I-MONEY": 17, "B-WORK_OF_ART": 18, "I-WORK_OF_ART": 19, "B-FAC": 20, "B-TIME": 21, "I-CARDINAL": 22, "B-LOC": 23, "B-QUANTITY": 24, "I-QUANTITY": 25, "I-NORP": 26, "I-LOC": 27, "B-PRODUCT": 28, "I-TIME": 29, "B-EVENT": 30, "I-EVENT": 31, "I-FAC": 32, "B-LANGUAGE": 33, "I-PRODUCT": 34, "I-ORDINAL": 35, "I-LANGUAGE": 36}
dataset/test.json ADDED
The diff for this file is too large to render. See raw diff
 
dataset/train00.json ADDED
The diff for this file is too large to render. See raw diff
 
dataset/train01.json ADDED
The diff for this file is too large to render. See raw diff
 
dataset/train02.json ADDED
The diff for this file is too large to render. See raw diff
 
dataset/train03.json ADDED
The diff for this file is too large to render. See raw diff
 
dataset/valid.json ADDED
The diff for this file is too large to render. See raw diff
 
ontonotes5.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ NER dataset compiled by T-NER library https://github.com/asahi417/tner/tree/master/tner """
2
+ import json
3
+ from itertools import chain
4
+ import datasets
5
+
6
+ logger = datasets.logging.get_logger(__name__)
7
+ _DESCRIPTION = """[ontonotes5 NER dataset](https://aclanthology.org/N06-2015/)"""
8
+ _NAME = "ontonotes5"
9
+ _VERSION = "1.0.0"
10
+ _CITATION = """
11
+ @inproceedings{hovy-etal-2006-ontonotes,
12
+ title = "{O}nto{N}otes: The 90{\%} Solution",
13
+ author = "Hovy, Eduard and
14
+ Marcus, Mitchell and
15
+ Palmer, Martha and
16
+ Ramshaw, Lance and
17
+ Weischedel, Ralph",
18
+ booktitle = "Proceedings of the Human Language Technology Conference of the {NAACL}, Companion Volume: Short Papers",
19
+ month = jun,
20
+ year = "2006",
21
+ address = "New York City, USA",
22
+ publisher = "Association for Computational Linguistics",
23
+ url = "https://aclanthology.org/N06-2015",
24
+ pages = "57--60",
25
+ }
26
+ """
27
+
28
+ _HOME_PAGE = "https://github.com/asahi417/tner"
29
+ _URL = f'https://huggingface.co/datasets/tner/{_NAME}/raw/main/dataset'
30
+ _URLS = {
31
+ str(datasets.Split.TEST): [f'{_URL}/test.json'],
32
+ str(datasets.Split.TRAIN): [f'{_URL}/train{i:02d}.json' for i in range(4)],
33
+ str(datasets.Split.VALIDATION): [f'{_URL}/valid.json'],
34
+ }
35
+
36
+
37
+ class Ontonotes5Config(datasets.BuilderConfig):
38
+ """BuilderConfig"""
39
+
40
+ def __init__(self, **kwargs):
41
+ """BuilderConfig.
42
+
43
+ Args:
44
+ **kwargs: keyword arguments forwarded to super.
45
+ """
46
+ super(Ontonotes5Config, self).__init__(**kwargs)
47
+
48
+
49
+ class Ontonotes5(datasets.GeneratorBasedBuilder):
50
+ """Dataset."""
51
+
52
+ BUILDER_CONFIGS = [
53
+ Ontonotes5Config(name=_NAME, version=datasets.Version(_VERSION), description=_DESCRIPTION),
54
+ ]
55
+
56
+ def _split_generators(self, dl_manager):
57
+ downloaded_file = dl_manager.download_and_extract(_URLS)
58
+ return [datasets.SplitGenerator(name=i, gen_kwargs={"filepaths": downloaded_file[str(i)]})
59
+ for i in [datasets.Split.TRAIN, datasets.Split.VALIDATION, datasets.Split.TEST]]
60
+
61
+ def _generate_examples(self, filepaths):
62
+ _key = 0
63
+ for filepath in filepaths:
64
+ logger.info(f"generating examples from = {filepath}")
65
+ with open(filepath, encoding="utf-8") as f:
66
+ _list = [i for i in f.read().split('\n') if len(i) > 0]
67
+ for i in _list:
68
+ data = json.loads(i)
69
+ yield _key, data
70
+ _key += 1
71
+
72
+ def _info(self):
73
+ return datasets.DatasetInfo(
74
+ description=_DESCRIPTION,
75
+ features=datasets.Features(
76
+ {
77
+ "tokens": datasets.Sequence(datasets.Value("string")),
78
+ "tags": datasets.Sequence(datasets.Value("int")),
79
+ }
80
+ ),
81
+ supervised_keys=None,
82
+ homepage=_HOME_PAGE,
83
+ citation=_CITATION,
84
+ )