asahi417 commited on
Commit
c9ce5c6
1 Parent(s): 89204dc
Files changed (5) hide show
  1. README.md +235 -0
  2. conll2003.py +19 -32
  3. dataset/test.json +0 -0
  4. dataset/train.json +0 -0
  5. dataset/valid.json +0 -0
README.md CHANGED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: CoNLL-2003
15
+ train-eval-index:
16
+ - config: conll2003
17
+ task: token-classification
18
+ task_id: entity_extraction
19
+ splits:
20
+ train_split: train
21
+ eval_split: test
22
+ col_mapping:
23
+ tokens: tokens
24
+ ner_tags: tags
25
+ ---
26
+
27
+ # Dataset Card for "conll2003"
28
+
29
+ ## Table of Contents
30
+ - [Dataset Description](#dataset-description)
31
+ - [Dataset Summary](#dataset-summary)
32
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
33
+ - [Languages](#languages)
34
+ - [Dataset Structure](#dataset-structure)
35
+ - [Data Instances](#data-instances)
36
+ - [Data Fields](#data-fields)
37
+ - [Data Splits](#data-splits)
38
+ - [Dataset Creation](#dataset-creation)
39
+ - [Curation Rationale](#curation-rationale)
40
+ - [Source Data](#source-data)
41
+ - [Annotations](#annotations)
42
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
43
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
44
+ - [Social Impact of Dataset](#social-impact-of-dataset)
45
+ - [Discussion of Biases](#discussion-of-biases)
46
+ - [Other Known Limitations](#other-known-limitations)
47
+ - [Additional Information](#additional-information)
48
+ - [Dataset Curators](#dataset-curators)
49
+ - [Licensing Information](#licensing-information)
50
+ - [Citation Information](#citation-information)
51
+ - [Contributions](#contributions)
52
+
53
+ ## Dataset Description
54
+
55
+ - **Homepage:** [https://www.aclweb.org/anthology/W03-0419/](https://www.aclweb.org/anthology/W03-0419/)
56
+ - **Repository:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
57
+ - **Paper:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
58
+ - **Point of Contact:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
59
+ - **Size of downloaded dataset files:** 4.63 MB
60
+ - **Size of the generated dataset:** 9.78 MB
61
+ - **Total amount of disk used:** 14.41 MB
62
+
63
+ ### Dataset Summary
64
+
65
+ The shared task of CoNLL-2003 concerns language-independent named entity recognition. We will concentrate on
66
+ four types of named entities: persons, locations, organizations and names of miscellaneous entities that do
67
+ not belong to the previous three groups.
68
+
69
+ The CoNLL-2003 shared task data files contain four columns separated by a single space. Each word has been put on
70
+ a separate line and there is an empty line after each sentence. The first item on each line is a word, the second
71
+ a part-of-speech (POS) tag, the third a syntactic chunk tag and the fourth the named entity tag. The chunk tags
72
+ and the named entity tags have the format I-TYPE which means that the word is inside a phrase of type TYPE. Only
73
+ if two phrases of the same type immediately follow each other, the first word of the second phrase will have tag
74
+ B-TYPE to show that it starts a new phrase. A word with tag O is not part of a phrase. Note the dataset uses IOB2
75
+ tagging scheme, whereas the original dataset uses IOB1.
76
+
77
+ For more details see https://www.clips.uantwerpen.be/conll2003/ner/ and https://www.aclweb.org/anthology/W03-0419
78
+
79
+ ### Supported Tasks and Leaderboards
80
+
81
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
82
+
83
+ ### Languages
84
+
85
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
86
+
87
+ ## Dataset Structure
88
+
89
+ ### Data Instances
90
+
91
+ #### conll2003
92
+
93
+ - **Size of downloaded dataset files:** 4.63 MB
94
+ - **Size of the generated dataset:** 9.78 MB
95
+ - **Total amount of disk used:** 14.41 MB
96
+
97
+ An example of 'train' looks as follows.
98
+
99
+ ```
100
+ {
101
+ "chunk_tags": [11, 12, 12, 21, 13, 11, 11, 21, 13, 11, 12, 13, 11, 21, 22, 11, 12, 17, 11, 21, 17, 11, 12, 12, 21, 22, 22, 13, 11, 0],
102
+ "id": "0",
103
+ "ner_tags": [0, 3, 4, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
104
+ "pos_tags": [12, 22, 22, 38, 15, 22, 28, 38, 15, 16, 21, 35, 24, 35, 37, 16, 21, 15, 24, 41, 15, 16, 21, 21, 20, 37, 40, 35, 21, 7],
105
+ "tokens": ["The", "European", "Commission", "said", "on", "Thursday", "it", "disagreed", "with", "German", "advice", "to", "consumers", "to", "shun", "British", "lamb", "until", "scientists", "determine", "whether", "mad", "cow", "disease", "can", "be", "transmitted", "to", "sheep", "."]
106
+ }
107
+ ```
108
+
109
+ The original data files have `-DOCSTART-` lines used to separate documents, but these lines are removed here.
110
+ Indeed `-DOCSTART-` is a special line that acts as a boundary between two different documents, and it is filtered out in this implementation.
111
+
112
+ ### Data Fields
113
+
114
+ The data fields are the same among all splits.
115
+
116
+ #### conll2003
117
+ - `id`: a `string` feature.
118
+ - `tokens`: a `list` of `string` features.
119
+ - `pos_tags`: a `list` of classification labels (`int`). Full tagset with indices:
120
+
121
+ ```python
122
+ {'"': 0, "''": 1, '#': 2, '$': 3, '(': 4, ')': 5, ',': 6, '.': 7, ':': 8, '``': 9, 'CC': 10, 'CD': 11, 'DT': 12,
123
+ 'EX': 13, 'FW': 14, 'IN': 15, 'JJ': 16, 'JJR': 17, 'JJS': 18, 'LS': 19, 'MD': 20, 'NN': 21, 'NNP': 22, 'NNPS': 23,
124
+ 'NNS': 24, 'NN|SYM': 25, 'PDT': 26, 'POS': 27, 'PRP': 28, 'PRP$': 29, 'RB': 30, 'RBR': 31, 'RBS': 32, 'RP': 33,
125
+ 'SYM': 34, 'TO': 35, 'UH': 36, 'VB': 37, 'VBD': 38, 'VBG': 39, 'VBN': 40, 'VBP': 41, 'VBZ': 42, 'WDT': 43,
126
+ 'WP': 44, 'WP$': 45, 'WRB': 46}
127
+ ```
128
+
129
+ - `chunk_tags`: a `list` of classification labels (`int`). Full tagset with indices:
130
+
131
+ ```python
132
+ {'O': 0, 'B-ADJP': 1, 'I-ADJP': 2, 'B-ADVP': 3, 'I-ADVP': 4, 'B-CONJP': 5, 'I-CONJP': 6, 'B-INTJ': 7, 'I-INTJ': 8,
133
+ 'B-LST': 9, 'I-LST': 10, 'B-NP': 11, 'I-NP': 12, 'B-PP': 13, 'I-PP': 14, 'B-PRT': 15, 'I-PRT': 16, 'B-SBAR': 17,
134
+ 'I-SBAR': 18, 'B-UCP': 19, 'I-UCP': 20, 'B-VP': 21, 'I-VP': 22}
135
+ ```
136
+
137
+ - `ner_tags`: a `list` of classification labels (`int`). Full tagset with indices:
138
+
139
+ ```python
140
+ {'O': 0, 'B-PER': 1, 'I-PER': 2, 'B-ORG': 3, 'I-ORG': 4, 'B-LOC': 5, 'I-LOC': 6, 'B-MISC': 7, 'I-MISC': 8}
141
+ ```
142
+
143
+ ### Data Splits
144
+
145
+ | name |train|validation|test|
146
+ |---------|----:|---------:|---:|
147
+ |conll2003|14041| 3250|3453|
148
+
149
+ ## Dataset Creation
150
+
151
+ ### Curation Rationale
152
+
153
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
154
+
155
+ ### Source Data
156
+
157
+ #### Initial Data Collection and Normalization
158
+
159
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
160
+
161
+ #### Who are the source language producers?
162
+
163
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
164
+
165
+ ### Annotations
166
+
167
+ #### Annotation process
168
+
169
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
170
+
171
+ #### Who are the annotators?
172
+
173
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
174
+
175
+ ### Personal and Sensitive Information
176
+
177
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
178
+
179
+ ## Considerations for Using the Data
180
+
181
+ ### Social Impact of Dataset
182
+
183
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
184
+
185
+ ### Discussion of Biases
186
+
187
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
188
+
189
+ ### Other Known Limitations
190
+
191
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
192
+
193
+ ## Additional Information
194
+
195
+ ### Dataset Curators
196
+
197
+ [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
198
+
199
+ ### Licensing Information
200
+
201
+ From the [CoNLL2003 shared task](https://www.clips.uantwerpen.be/conll2003/ner/) page:
202
+
203
+ > The English data is a collection of news wire articles from the Reuters Corpus. The annotation has been done by people of the University of Antwerp. Because of copyright reasons we only make available the annotations. In order to build the complete data sets you will need access to the Reuters Corpus. It can be obtained for research purposes without any charge from NIST.
204
+
205
+ The copyrights are defined below, from the [Reuters Corpus page](https://trec.nist.gov/data/reuters/reuters.html):
206
+
207
+ > The stories in the Reuters Corpus are under the copyright of Reuters Ltd and/or Thomson Reuters, and their use is governed by the following agreements:
208
+ >
209
+ > [Organizational agreement](https://trec.nist.gov/data/reuters/org_appl_reuters_v4.html)
210
+ >
211
+ > This agreement must be signed by the person responsible for the data at your organization, and sent to NIST.
212
+ >
213
+ > [Individual agreement](https://trec.nist.gov/data/reuters/ind_appl_reuters_v4.html)
214
+ >
215
+ > This agreement must be signed by all researchers using the Reuters Corpus at your organization, and kept on file at your organization.
216
+
217
+ ### Citation Information
218
+
219
+ ```
220
+ @inproceedings{tjong-kim-sang-de-meulder-2003-introduction,
221
+ title = "Introduction to the {C}o{NLL}-2003 Shared Task: Language-Independent Named Entity Recognition",
222
+ author = "Tjong Kim Sang, Erik F. and
223
+ De Meulder, Fien",
224
+ booktitle = "Proceedings of the Seventh Conference on Natural Language Learning at {HLT}-{NAACL} 2003",
225
+ year = "2003",
226
+ url = "https://www.aclweb.org/anthology/W03-0419",
227
+ pages = "142--147",
228
+ }
229
+
230
+ ```
231
+
232
+
233
+ ### Contributions
234
+
235
+ Thanks to [@jplu](https://github.com/jplu), [@vblagoje](https://github.com/vblagoje), [@lhoestq](https://github.com/lhoestq) for adding this dataset.
conll2003.py CHANGED
@@ -6,18 +6,11 @@ import datasets
6
  logger = datasets.logging.get_logger(__name__)
7
  _DESCRIPTION = """[CoNLL 2003 NER dataset](https://aclanthology.org/W03-0419/)"""
8
  _NAME = "conll2003"
9
- _HOME_PAGE = "https://github.com/asahi417/tner"
10
- _URL = 'https://huggingface.co/datasets/tner/conll2003/raw/main/dataset'
11
- _URLS = {
12
- str(datasets.Split.TEST): [f'{_URL}/test.json'],
13
- str(datasets.Split.TRAIN): [f'{_URL}/train.json'],
14
- str(datasets.Split.VALIDATION): [f'{_URL}/valid.json'],
15
- }
16
- _CITATION = """\
17
  @inproceedings{tjong-kim-sang-de-meulder-2003-introduction,
18
  title = "Introduction to the {C}o{NLL}-2003 Shared Task: Language-Independent Named Entity Recognition",
19
- author = "Tjong Kim Sang, Erik F. and
20
- De Meulder, Fien",
21
  booktitle = "Proceedings of the Seventh Conference on Natural Language Learning at {HLT}-{NAACL} 2003",
22
  year = "2003",
23
  url = "https://www.aclweb.org/anthology/W03-0419",
@@ -25,6 +18,15 @@ _CITATION = """\
25
  }
26
  """
27
 
 
 
 
 
 
 
 
 
 
28
  class Conll2003Config(datasets.BuilderConfig):
29
  """BuilderConfig"""
30
 
@@ -41,7 +43,7 @@ class Conll2003(datasets.GeneratorBasedBuilder):
41
  """Dataset."""
42
 
43
  BUILDER_CONFIGS = [
44
- Conll2003Config(name=_NAME, version=datasets.Version("1.0.0"), description=_DESCRIPTION),
45
  ]
46
 
47
  def _split_generators(self, dl_manager):
@@ -53,12 +55,11 @@ class Conll2003(datasets.GeneratorBasedBuilder):
53
  _key = 0
54
  for filepath in filepaths:
55
  logger.info(f"generating examples from = {filepath}")
56
-
57
- with open(filepath) as f:
58
- data_list = json.load(f)
59
- print(data_list)
60
- for (tokens, tags) in data_list:
61
- yield _key, {'tokens': tokens, 'tags': tags}
62
  _key += 1
63
 
64
  def _info(self):
@@ -67,21 +68,7 @@ class Conll2003(datasets.GeneratorBasedBuilder):
67
  features=datasets.Features(
68
  {
69
  "tokens": datasets.Sequence(datasets.Value("string")),
70
- "tags": datasets.Sequence(
71
- datasets.features.ClassLabel(
72
- names=[
73
- "O",
74
- "B-PER",
75
- "I-PER",
76
- "B-ORG",
77
- "I-ORG",
78
- "B-LOC",
79
- "I-LOC",
80
- "B-MISC",
81
- "I-MISC",
82
- ]
83
- )
84
- ),
85
  }
86
  ),
87
  supervised_keys=None,
 
6
  logger = datasets.logging.get_logger(__name__)
7
  _DESCRIPTION = """[CoNLL 2003 NER dataset](https://aclanthology.org/W03-0419/)"""
8
  _NAME = "conll2003"
9
+ _VERSION = "1.0.0"
10
+ _CITATION = """
 
 
 
 
 
 
11
  @inproceedings{tjong-kim-sang-de-meulder-2003-introduction,
12
  title = "Introduction to the {C}o{NLL}-2003 Shared Task: Language-Independent Named Entity Recognition",
13
+ author = "Tjong Kim Sang, Erik F. and De Meulder, Fien",
 
14
  booktitle = "Proceedings of the Seventh Conference on Natural Language Learning at {HLT}-{NAACL} 2003",
15
  year = "2003",
16
  url = "https://www.aclweb.org/anthology/W03-0419",
 
18
  }
19
  """
20
 
21
+ _HOME_PAGE = "https://github.com/asahi417/tner"
22
+ _URL = f'https://huggingface.co/datasets/tner/{_NAME}/raw/main/dataset'
23
+ _URLS = {
24
+ str(datasets.Split.TEST): [f'{_URL}/test.json'],
25
+ str(datasets.Split.TRAIN): [f'{_URL}/train.json'],
26
+ str(datasets.Split.VALIDATION): [f'{_URL}/valid.json'],
27
+ }
28
+
29
+
30
  class Conll2003Config(datasets.BuilderConfig):
31
  """BuilderConfig"""
32
 
 
43
  """Dataset."""
44
 
45
  BUILDER_CONFIGS = [
46
+ Conll2003Config(name=_NAME, version=datasets.Version(_VERSION), description=_DESCRIPTION),
47
  ]
48
 
49
  def _split_generators(self, dl_manager):
 
55
  _key = 0
56
  for filepath in filepaths:
57
  logger.info(f"generating examples from = {filepath}")
58
+ with open(filepath, encoding="utf-8") as f:
59
+ _list = [i for i in f.read().split('\n') if len(i) > 0]
60
+ for i in _list:
61
+ data = json.loads(i)
62
+ yield _key, data
 
63
  _key += 1
64
 
65
  def _info(self):
 
68
  features=datasets.Features(
69
  {
70
  "tokens": datasets.Sequence(datasets.Value("string")),
71
+ "tags": datasets.Sequence(datasets.Value("int")),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  }
73
  ),
74
  supervised_keys=None,
dataset/test.json CHANGED
The diff for this file is too large to render. See raw diff
 
dataset/train.json CHANGED
The diff for this file is too large to render. See raw diff
 
dataset/valid.json CHANGED
The diff for this file is too large to render. See raw diff