havens2 commited on
Commit
16b0db0
1 Parent(s): efac442

Add loading script and README file

Browse files
Files changed (2) hide show
  1. README.md +162 -0
  2. naacl2022.py +136 -0
README.md ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ language:
5
+ - en
6
+ language_creators:
7
+ - crowdsourced
8
+ license:
9
+ - afl-3.0
10
+ multilinguality:
11
+ - monolingual
12
+ pretty_name: sci_NER_naacl
13
+ size_categories:
14
+ - 1K<n<10K
15
+ source_datasets:
16
+ - original
17
+ tags:
18
+ - acl
19
+ - sciBERT
20
+ - sci
21
+ - acl
22
+ - '11711'
23
+ task_categories:
24
+ - token-classification
25
+ task_ids:
26
+ - named-entity-recognition
27
+ ---
28
+
29
+ # Dataset Card for [Dataset Name]
30
+
31
+ ## Table of Contents
32
+ - [Table of Contents](#table-of-contents)
33
+ - [Dataset Description](#dataset-description)
34
+ - [Dataset Summary](#dataset-summary)
35
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
36
+ - [Languages](#languages)
37
+ - [Dataset Structure](#dataset-structure)
38
+ - [Data Instances](#data-instances)
39
+ - [Data Fields](#data-fields)
40
+ - [Data Splits](#data-splits)
41
+ - [Dataset Creation](#dataset-creation)
42
+ - [Curation Rationale](#curation-rationale)
43
+ - [Source Data](#source-data)
44
+ - [Annotations](#annotations)
45
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
46
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
47
+ - [Social Impact of Dataset](#social-impact-of-dataset)
48
+ - [Discussion of Biases](#discussion-of-biases)
49
+ - [Other Known Limitations](#other-known-limitations)
50
+ - [Additional Information](#additional-information)
51
+ - [Dataset Curators](#dataset-curators)
52
+ - [Licensing Information](#licensing-information)
53
+ - [Citation Information](#citation-information)
54
+ - [Contributions](#contributions)
55
+
56
+ ## Dataset Description
57
+
58
+ - **Homepage:**
59
+ - **Repository:**
60
+ - **Paper:**
61
+ - **Leaderboard:**
62
+ - **Point of Contact:**
63
+
64
+ ### Dataset Summary
65
+
66
+ This is a named entity recognition dataset annotated for the science entity recognition task, a [project](https://github.com/neubig/nlp-from-scratch-assignment-2022) from the CMU 11-711 course.
67
+
68
+ ### Supported Tasks and Leaderboards
69
+
70
+ NER task.
71
+
72
+ ### Languages
73
+
74
+ English
75
+
76
+ ## Dataset Structure
77
+
78
+ ### Data Instances
79
+
80
+ A sample of the dataset
81
+ {'id': '0',
82
+ 'tokens': ['We', 'sample', '50', 'negative', 'cases', 'from', 'T5LARGE', '+', 'GenMC', 'for', 'each', 'dataset'],
83
+ 'ner_tags':['O', 'O', 'O', 'O', 'O', 'O', 'B-MethodName', 'O', 'B-MethodName', 'O', 'O', 'O']}
84
+
85
+ ### Data Fields
86
+
87
+ id,tokens,ner_tags
88
+
89
+ - `id`: a `string` feature give the sample index.
90
+ - `tokens`: a `list` of `string` features give the sequence.
91
+ - `ner_tags`: a `list` of classification labels for each token in the sentence, with possible values including
92
+ `O` (0), `B-MethodName` (1), `I-MethodName` (2), `B-HyperparameterName` (3),`I-HyperparameterName` (4),`B-HyperparameterValue` (5),`I-HyperparameterValue` (6),`B-MetricName` (7),`I-MetricName` (8),`B-MetricValue` (9),`I-MetricValue` (10),`B-TaskName` (11),`I-TaskName` (12),`B-DatasetName` (13),`I-DatasetName` (14).
93
+
94
+
95
+ ### Data Splits
96
+
97
+ Data split into
98
+ train.txt
99
+ dev.txt
100
+ test.txt
101
+
102
+ ## Dataset Creation
103
+
104
+ ### Curation Rationale
105
+
106
+ [More Information Needed]
107
+
108
+ ### Source Data
109
+
110
+ #### Initial Data Collection and Normalization
111
+
112
+ [More Information Needed]
113
+
114
+ #### Who are the source language producers?
115
+
116
+ [More Information Needed]
117
+
118
+ ### Annotations
119
+
120
+ #### Annotation process
121
+
122
+ The data is annotated by using labelstudio, the papers are collected from TACL and ACL 2022 conferences.
123
+
124
+ #### Who are the annotators?
125
+
126
+ Xiaoyue Cui and Haotian Teng annotated the datasets.
127
+
128
+ ### Personal and Sensitive Information
129
+
130
+ [More Information Needed]
131
+
132
+ ## Considerations for Using the Data
133
+
134
+ ### Social Impact of Dataset
135
+
136
+ [More Information Needed]
137
+
138
+ ### Discussion of Biases
139
+
140
+ [More Information Needed]
141
+
142
+ ### Other Known Limitations
143
+
144
+ [More Information Needed]
145
+
146
+ ## Additional Information
147
+
148
+ ### Dataset Curators
149
+
150
+ [More Information Needed]
151
+
152
+ ### Licensing Information
153
+
154
+ [More Information Needed]
155
+
156
+ ### Citation Information
157
+
158
+ [More Information Needed]
159
+
160
+ ### Contributions
161
+
162
+ Thanks to [@xcui297](https://github.com/xcui297); [@haotianteng](https://github.com/haotianteng) for adding this dataset.
naacl2022.py ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2022 Haotian Teng
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ # Lint as: python3
17
+ """CrossWeigh: Training Named Entity Tagger from Imperfect Annotations"""
18
+
19
+ import logging
20
+
21
+ import datasets
22
+
23
+
24
+ _CITATION = """\
25
+ """
26
+
27
+ _DESCRIPTION = """\
28
+ NACL22 is a dataset labelled for Science Entity Recognition task, which is a subtask of NER task.
29
+ The text is from 2022 conference papers collected from ACL anthology.
30
+ The dataset is collected by Haotian Teng and Xiaoyue Cui.
31
+ Annotation standard can be found here https://github.com/neubig/nlp-from-scratch-assignment-2022/blob/main/annotation_standard.md
32
+ """
33
+
34
+ _URL = "https://raw.githubusercontent.com/haotianteng/nacl22/master/"
35
+ _TRAINING_FILE = "train.text"
36
+ _DEV_FILE = "dev.text"
37
+ _TEST_FILE = "test.text"#Test dataset need to be added.
38
+
39
+
40
+ class nacl22Config(datasets.BuilderConfig):
41
+ """BuilderConfig for NACL2022"""
42
+
43
+ def __init__(self, **kwargs):
44
+ """BuilderConfig for NACL2022.
45
+ Args:
46
+ **kwargs: keyword arguments forwarded to super.
47
+ """
48
+ super(nacl22Config, self).__init__(**kwargs)
49
+
50
+
51
+ class nacl22(datasets.GeneratorBasedBuilder):
52
+ """NACL2022 dataset."""
53
+
54
+ BUILDER_CONFIGS = [
55
+ nacl22Config(name="nacl22", version=datasets.Version("1.0.0"), description="nacl22 dataset"),
56
+ ]
57
+
58
+ def _info(self):
59
+ return datasets.DatasetInfo(
60
+ description=_DESCRIPTION,
61
+ features=datasets.Features(
62
+ {
63
+ "id": datasets.Value("string"),
64
+ "tokens": datasets.Sequence(datasets.Value("string")),
65
+ "ner_tags": datasets.Sequence(
66
+ datasets.features.ClassLabel(
67
+ names=[
68
+ "O",
69
+ "B-MethodName",
70
+ "I-MethodName",
71
+ "B-HyperparameterName",
72
+ "I-HyperparameterName",
73
+ "B-HyperparameterValue",
74
+ "I-HyperparameterValue",
75
+ "B-MetricName",
76
+ "I-MetricName",
77
+ "B-MetricValue",
78
+ "I-MetricValue",
79
+ "B-TaskName",
80
+ "I-TaskName",
81
+ "B-DatasetName",
82
+ "I-DatasetName",
83
+ ]
84
+ )
85
+ ),
86
+ }
87
+ ),
88
+ supervised_keys=None,
89
+ homepage="https://github.com/neubig/nlp-from-scratch-assignment-2022",
90
+ citation=_CITATION,
91
+ )
92
+
93
+ def _split_generators(self, dl_manager):
94
+ """Returns SplitGenerators."""
95
+ urls_to_download = {
96
+ "train": f"{_URL}{_TRAINING_FILE}",
97
+ "dev": f"{_URL}{_DEV_FILE}",
98
+ "test": f"{_URL}{_TEST_FILE}",
99
+ }
100
+ downloaded_files = dl_manager.download_and_extract(urls_to_download)
101
+
102
+ return [
103
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
104
+ datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
105
+ datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
106
+ ]
107
+
108
+ def _generate_examples(self, filepath):
109
+ logging.info("⏳ Generating examples from = %s", filepath)
110
+ with open(filepath, encoding="utf-8") as f:
111
+ guid = 0
112
+ tokens = []
113
+ ner_tags = []
114
+ for line in f:
115
+ if line.startswith("-DOCSTART-") or line == "" or line == "\n":
116
+ if tokens:
117
+ yield guid, {
118
+ "id": str(guid),
119
+ "tokens": tokens,
120
+ "ner_tags": ner_tags,
121
+ }
122
+ guid += 1
123
+ tokens = []
124
+ ner_tags = []
125
+ else:
126
+ # conll2003 tokens are space separated
127
+ splits = line.split(" ")
128
+ tokens.append(splits[0])
129
+ ner_tags.append(splits[-1].rstrip())
130
+ # last example
131
+ if tokens:
132
+ yield guid, {
133
+ "id": str(guid),
134
+ "tokens": tokens,
135
+ "ner_tags": ner_tags,
136
+ }