asahi417 commited on
Commit
5cdadef
1 Parent(s): 7125bde
Files changed (6) hide show
  1. README.md +110 -0
  2. dataset/label.json +1 -0
  3. dataset/test.jsonl +0 -0
  4. dataset/train.json +0 -0
  5. dataset/valid.json +0 -0
  6. fin.py +81 -0
README.md ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ - **Dataset:** Ontonotes5
24
+ - **Domain:** News
25
+ - **Number of Entity:** `8 (`CARDINAL`, `DATE`, `PERSON`, `NORP`, `GPE`, `LAW`, `PERCENT`, `ORDINAL`, `MONEY`, `WORK_OF_ART`, `FAC`, `TIME`, `QUANTITY`, `PRODUCT`, `LANGUAGE`, `ORG`, `LOC`, `EVENT`)
26
+
27
+ ### Dataset Summary
28
+ Ontonotes5 NER dataset formatted in a part of [TNER](https://github.com/asahi417/tner) project.
29
+
30
+ ## Dataset Structure
31
+
32
+ ### Data Instances
33
+ An example of `train` looks as follows.
34
+
35
+ ```
36
+ {
37
+ '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],
38
+ 'tokens': ['``', 'It', "'s", 'very', 'costly', 'and', 'time', '-', 'consuming', ',', "''", 'says', 'Phil', 'Rosen', ',', 'a', 'partner', 'in', 'Fleet', '&', 'Leasing', 'Management', 'Inc.', ',', 'a', 'Boston', 'car', '-', 'leasing', 'company', '.']
39
+ }
40
+ ```
41
+
42
+ ### Label ID
43
+ The label2id dictionary can be found at [here](https://huggingface.co/datasets/tner/onotonotes5/raw/main/dataset/label.json).
44
+ ```python
45
+ {
46
+ "O": 0,
47
+ "B-CARDINAL": 1,
48
+ "B-DATE": 2,
49
+ "I-DATE": 3,
50
+ "B-PERSON": 4,
51
+ "I-PERSON": 5,
52
+ "B-NORP": 6,
53
+ "B-GPE": 7,
54
+ "I-GPE": 8,
55
+ "B-LAW": 9,
56
+ "I-LAW": 10,
57
+ "B-ORG": 11,
58
+ "I-ORG": 12,
59
+ "B-PERCENT": 13,
60
+ "I-PERCENT": 14,
61
+ "B-ORDINAL": 15,
62
+ "B-MONEY": 16,
63
+ "I-MONEY": 17,
64
+ "B-WORK_OF_ART": 18,
65
+ "I-WORK_OF_ART": 19,
66
+ "B-FAC": 20,
67
+ "B-TIME": 21,
68
+ "I-CARDINAL": 22,
69
+ "B-LOC": 23,
70
+ "B-QUANTITY": 24,
71
+ "I-QUANTITY": 25,
72
+ "I-NORP": 26,
73
+ "I-LOC": 27,
74
+ "B-PRODUCT": 28,
75
+ "I-TIME": 29,
76
+ "B-EVENT": 30,
77
+ "I-EVENT": 31,
78
+ "I-FAC": 32,
79
+ "B-LANGUAGE": 33,
80
+ "I-PRODUCT": 34,
81
+ "I-ORDINAL": 35,
82
+ "I-LANGUAGE": 36
83
+ }
84
+ ```
85
+
86
+ ### Data Splits
87
+
88
+ | name |train|validation|test|
89
+ |---------|----:|---------:|---:|
90
+ |ontonotes5|59924| 8528|8262|
91
+
92
+ ### Citation Information
93
+
94
+ ```
95
+ @inproceedings{hovy-etal-2006-ontonotes,
96
+ title = "{O}nto{N}otes: The 90{\%} Solution",
97
+ author = "Hovy, Eduard and
98
+ Marcus, Mitchell and
99
+ Palmer, Martha and
100
+ Ramshaw, Lance and
101
+ Weischedel, Ralph",
102
+ booktitle = "Proceedings of the Human Language Technology Conference of the {NAACL}, Companion Volume: Short Papers",
103
+ month = jun,
104
+ year = "2006",
105
+ address = "New York City, USA",
106
+ publisher = "Association for Computational Linguistics",
107
+ url = "https://aclanthology.org/N06-2015",
108
+ pages = "57--60",
109
+ }
110
+ ```
dataset/label.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"O": 0, "I-ORG": 1, "I-LOC": 2, "I-PER": 3, "I-MISC": 4}
dataset/test.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
dataset/train.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
 
fin.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 = """[FIN NER dataset](https://aclanthology.org/U15-1010.pdf)"""
8
+ _NAME = "fin"
9
+ _VERSION = "1.0.0"
10
+ _CITATION = """
11
+ @inproceedings{salinas-alvarado-etal-2015-domain,
12
+ title = "Domain Adaption of Named Entity Recognition to Support Credit Risk Assessment",
13
+ author = "Salinas Alvarado, Julio Cesar and
14
+ Verspoor, Karin and
15
+ Baldwin, Timothy",
16
+ booktitle = "Proceedings of the Australasian Language Technology Association Workshop 2015",
17
+ month = dec,
18
+ year = "2015",
19
+ address = "Parramatta, Australia",
20
+ url = "https://aclanthology.org/U15-1010",
21
+ pages = "84--90",
22
+ }
23
+ """
24
+
25
+ _HOME_PAGE = "https://github.com/asahi417/tner"
26
+ _URL = f'https://huggingface.co/datasets/tner/{_NAME}/raw/main/dataset'
27
+ _URLS = {
28
+ str(datasets.Split.TEST): [f'{_URL}/test.json'],
29
+ str(datasets.Split.TRAIN): [f'{_URL}/train.json'],
30
+ str(datasets.Split.VALIDATION): [f'{_URL}/valid.json'],
31
+ }
32
+
33
+
34
+ class FinConfig(datasets.BuilderConfig):
35
+ """BuilderConfig"""
36
+
37
+ def __init__(self, **kwargs):
38
+ """BuilderConfig.
39
+
40
+ Args:
41
+ **kwargs: keyword arguments forwarded to super.
42
+ """
43
+ super(FinConfig, self).__init__(**kwargs)
44
+
45
+
46
+ class Fin(datasets.GeneratorBasedBuilder):
47
+ """Dataset."""
48
+
49
+ BUILDER_CONFIGS = [
50
+ FinConfig(name=_NAME, version=datasets.Version(_VERSION), description=_DESCRIPTION),
51
+ ]
52
+
53
+ def _split_generators(self, dl_manager):
54
+ downloaded_file = dl_manager.download_and_extract(_URLS)
55
+ return [datasets.SplitGenerator(name=i, gen_kwargs={"filepaths": downloaded_file[str(i)]})
56
+ for i in [datasets.Split.TRAIN, datasets.Split.VALIDATION, datasets.Split.TEST]]
57
+
58
+ def _generate_examples(self, filepaths):
59
+ _key = 0
60
+ for filepath in filepaths:
61
+ logger.info(f"generating examples from = {filepath}")
62
+ with open(filepath, encoding="utf-8") as f:
63
+ _list = [i for i in f.read().split('\n') if len(i) > 0]
64
+ for i in _list:
65
+ data = json.loads(i)
66
+ yield _key, data
67
+ _key += 1
68
+
69
+ def _info(self):
70
+ return datasets.DatasetInfo(
71
+ description=_DESCRIPTION,
72
+ features=datasets.Features(
73
+ {
74
+ "tokens": datasets.Sequence(datasets.Value("string")),
75
+ "tags": datasets.Sequence(datasets.Value("int32")),
76
+ }
77
+ ),
78
+ supervised_keys=None,
79
+ homepage=_HOME_PAGE,
80
+ citation=_CITATION,
81
+ )