joelniklaus commited on
Commit
f5277f5
1 Parent(s): 27fcb95

made fine grained labels upper case as well because of problems with seqeval otherwise

Browse files
Files changed (5) hide show
  1. README.md +45 -45
  2. convert_to_hf_dataset.py +5 -5
  3. test.jsonl +1 -1
  4. train.jsonl +1 -1
  5. validation.jsonl +1 -1
README.md CHANGED
@@ -158,51 +158,51 @@ The final coarse grained tagset (in IOB notation) is the following:
158
  The final fine grained tagset (in IOB notation) is the following:
159
 
160
  `[
161
- 'o',
162
- 'b-day',
163
- 'i-day',
164
- 'b-month',
165
- 'i-month',
166
- 'b-year',
167
- 'i-year',
168
- 'b-title',
169
- 'i-title',
170
- 'b-family name',
171
- 'i-family name',
172
- 'b-initial name',
173
- 'i-initial name',
174
- 'b-age',
175
- 'i-age',
176
- 'b-value',
177
- 'i-value',
178
- 'b-unit',
179
- 'i-unit',
180
- 'b-country',
181
- 'i-country',
182
- 'b-city',
183
- 'i-city',
184
- 'b-place',
185
- 'i-place',
186
- 'b-territory',
187
- 'i-territory',
188
- 'b-role',
189
- 'i-role',
190
- 'b-profession',
191
- 'i-profession',
192
- 'b-marital status',
193
- 'i-marital status',
194
- 'b-url',
195
- 'i-url',
196
- 'b-ethnic category',
197
- 'i-ethnic category',
198
- 'b-standard abbreviation',
199
- 'i-standard abbreviation'
200
- 'b-type',
201
- 'i-type',
202
- 'b-building',
203
- 'i-building',
204
- 'b-nationality',
205
- 'i-nationality',
206
  ]`
207
 
208
 
158
  The final fine grained tagset (in IOB notation) is the following:
159
 
160
  `[
161
+ 'O',
162
+ 'B-BUILDING',
163
+ 'I-BUILDING',
164
+ 'B-CITY',
165
+ 'I-CITY',
166
+ 'B-COUNTRY',
167
+ 'I-COUNTRY',
168
+ 'B-PLACE',
169
+ 'I-PLACE',
170
+ 'B-TERRITORY',
171
+ 'I-TERRITORY',
172
+ 'I-UNIT',
173
+ 'B-UNIT',
174
+ 'B-VALUE',
175
+ 'I-VALUE',
176
+ 'B-YEAR',
177
+ 'I-YEAR',
178
+ 'B-STANDARD ABBREVIATION',
179
+ 'I-STANDARD ABBREVIATION',
180
+ 'B-MONTH',
181
+ 'I-MONTH',
182
+ 'B-DAY',
183
+ 'I-DAY',
184
+ 'B-AGE',
185
+ 'I-AGE',
186
+ 'B-ETHNIC CATEGORY',
187
+ 'I-ETHNIC CATEGORY',
188
+ 'B-FAMILY NAME',
189
+ 'I-FAMILY NAME',
190
+ 'B-INITIAL NAME',
191
+ 'I-INITIAL NAME',
192
+ 'B-MARITAL STATUS',
193
+ 'I-MARITAL STATUS',
194
+ 'B-PROFESSION',
195
+ 'I-PROFESSION',
196
+ 'B-ROLE',
197
+ 'I-ROLE',
198
+ 'B-NATIONALITY',
199
+ 'I-NATIONALITY',
200
+ 'B-TITLE',
201
+ 'I-TITLE',
202
+ 'B-URL',
203
+ 'I-URL',
204
+ 'B-TYPE',
205
+ 'I-TYPE',
206
  ]`
207
 
208
 
convert_to_hf_dataset.py CHANGED
@@ -23,8 +23,8 @@ annotation_labels = {'ADDRESS': ['building', 'city', 'country', 'place', 'postco
23
  'TIME': [],
24
  'VEHICLE': ['build year', 'colour', 'license plate number', 'model', 'type']}
25
 
26
- # make all coarse_grained upper case and all fine_grained lower case
27
- annotation_labels = {key.upper(): [label.lower() for label in labels] for key, labels in annotation_labels.items()}
28
  print(annotation_labels)
29
  print("coarse_grained:", list(annotation_labels.keys()))
30
  print("fine_grained:",
@@ -61,7 +61,7 @@ def get_coarse_grained_for_fine_grained(label):
61
 
62
  def is_fine_grained(label):
63
  for coarse_grained, fine_grained_set in annotation_labels.items():
64
- if label.lower() in fine_grained_set:
65
  return True
66
  return False
67
 
@@ -101,7 +101,7 @@ def get_token_annotations(token, annotations):
101
  # some DATE are mislabeled as day but it is hard to correct this. So we ignore it
102
  fine_grained = label
103
 
104
- return coarse_grained.upper(), fine_grained.lower()
105
 
106
 
107
  def generate_IOB_labelset(series, casing_function):
@@ -132,7 +132,7 @@ def get_annotated_sentence(result_sentence, sentence):
132
  result_sentence["coarse_grained"].append(coarse_grained)
133
  result_sentence["fine_grained"].append(fine_grained)
134
  result_sentence["coarse_grained"] = generate_IOB_labelset(result_sentence["coarse_grained"], str.upper)
135
- result_sentence["fine_grained"] = generate_IOB_labelset(result_sentence["fine_grained"], str.lower)
136
  return result_sentence
137
 
138
 
23
  'TIME': [],
24
  'VEHICLE': ['build year', 'colour', 'license plate number', 'model', 'type']}
25
 
26
+ # make all labels upper case
27
+ annotation_labels = {key.upper(): [label.upper() for label in labels] for key, labels in annotation_labels.items()}
28
  print(annotation_labels)
29
  print("coarse_grained:", list(annotation_labels.keys()))
30
  print("fine_grained:",
61
 
62
  def is_fine_grained(label):
63
  for coarse_grained, fine_grained_set in annotation_labels.items():
64
+ if label.upper() in fine_grained_set:
65
  return True
66
  return False
67
 
101
  # some DATE are mislabeled as day but it is hard to correct this. So we ignore it
102
  fine_grained = label
103
 
104
+ return coarse_grained.upper(), fine_grained.upper()
105
 
106
 
107
  def generate_IOB_labelset(series, casing_function):
132
  result_sentence["coarse_grained"].append(coarse_grained)
133
  result_sentence["fine_grained"].append(fine_grained)
134
  result_sentence["coarse_grained"] = generate_IOB_labelset(result_sentence["coarse_grained"], str.upper)
135
+ result_sentence["fine_grained"] = generate_IOB_labelset(result_sentence["fine_grained"], str.upper)
136
  return result_sentence
137
 
138
 
test.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9c04197907b6539cf2020f34f91fb643c91dcc8590fc3b2301d765e130eb4e06
3
  size 7717849
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9498f67f080b1745b5b41feb32f66beb30e2bd2ca024306a910a7c59c3134d14
3
  size 7717849
train.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c2f305e569d60293e6a808e176c8ad82e97f2019967bb424bac3d3696d61adee
3
  size 22116076
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f2e8da9572e8bdfd699c998803d40b9680b8c6b92ea3356e8786d675cc5a19e4
3
  size 22116076
validation.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b3dea9d63c656d0db6cf306296252e1adceed09991abfb650d040b928c555684
3
  size 2874796
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a9b1a294688da296414c8042d4a18deb7a8f93006085f197074fe9a3a9b65abc
3
  size 2874796