Datasets:
Tasks:
Token Classification
Sub-tasks:
named-entity-recognition
Languages:
Swedish
Size:
1K<n<10K
License:
Commit
•
f0aef8b
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +192 -0
- dataset_infos.json +1 -0
- dummy/1.0.0/dummy_data.zip +3 -0
- swedish_ner_corpus.py +102 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- sv
|
8 |
+
licenses:
|
9 |
+
- cc-by-4-0
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
- 1K<n<10K
|
14 |
+
source_datasets:
|
15 |
+
- original
|
16 |
+
task_categories:
|
17 |
+
- structure-prediction
|
18 |
+
task_ids:
|
19 |
+
- named-entity-recognition
|
20 |
+
---
|
21 |
+
|
22 |
+
# Swedish NER Corpus
|
23 |
+
|
24 |
+
## Table of Contents
|
25 |
+
- [Dataset Description](#dataset-description)
|
26 |
+
- [Dataset Summary](#dataset-summary)
|
27 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
28 |
+
- [Languages](#languages)
|
29 |
+
- [Dataset Structure](#dataset-structure)
|
30 |
+
- [Data Instances](#data-instances)
|
31 |
+
- [Data Fields](#data-instances)
|
32 |
+
- [Data Splits](#data-instances)
|
33 |
+
- [Dataset Creation](#dataset-creation)
|
34 |
+
- [Curation Rationale](#curation-rationale)
|
35 |
+
- [Source Data](#source-data)
|
36 |
+
- [Annotations](#annotations)
|
37 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
38 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
39 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
40 |
+
- [Discussion of Biases](#discussion-of-biases)
|
41 |
+
- [Other Known Limitations](#other-known-limitations)
|
42 |
+
- [Additional Information](#additional-information)
|
43 |
+
- [Dataset Curators](#dataset-curators)
|
44 |
+
- [Licensing Information](#licensing-information)
|
45 |
+
- [Citation Information](#citation-information)
|
46 |
+
|
47 |
+
## Dataset Description
|
48 |
+
|
49 |
+
- **Homepage:** [https://github.com/klintan/swedish-ner-corpus]()
|
50 |
+
- **Repository:** [https://github.com/klintan/swedish-ner-corpus]()
|
51 |
+
- **Point of contact:** Andreas Klintberg (ankl@kth.se)
|
52 |
+
|
53 |
+
### Dataset Summary
|
54 |
+
|
55 |
+
Webbnyheter 2012 from Spraakbanken, semi-manually annotated and adapted for CoreNLP Swedish NER. Semi-manually defined in this case as: Bootstrapped from Swedish Gazetters then manually correcte/reviewed by two independent native speaking swedish annotators. No annotator agreement calculated.
|
56 |
+
|
57 |
+
### Supported Tasks and Leaderboards
|
58 |
+
|
59 |
+
[More Information Needed]
|
60 |
+
|
61 |
+
### Languages
|
62 |
+
|
63 |
+
Swedish
|
64 |
+
|
65 |
+
## Dataset Structure
|
66 |
+
|
67 |
+
### Data Instances
|
68 |
+
|
69 |
+
A sample dataset instance is provided below:
|
70 |
+
|
71 |
+
```json
|
72 |
+
{'id': '3',
|
73 |
+
'ner_tags': [4, 4, 0, 0, 0, 0, 0, 0, 3, 3, 0],
|
74 |
+
'tokens': ['Margaretha',
|
75 |
+
'Fahlgren',
|
76 |
+
',',
|
77 |
+
'professor',
|
78 |
+
'i',
|
79 |
+
'litteraturvetenskap',
|
80 |
+
',',
|
81 |
+
'vice-rektor',
|
82 |
+
'Uppsala',
|
83 |
+
'universitet',
|
84 |
+
'.']}
|
85 |
+
```
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
### Data Fields
|
90 |
+
|
91 |
+
- `id`: id of the sentence
|
92 |
+
- `token`: current token
|
93 |
+
- `ner_tag`: ner tag of the token
|
94 |
+
|
95 |
+
Full fields:
|
96 |
+
|
97 |
+
```json
|
98 |
+
{
|
99 |
+
"id":{
|
100 |
+
"feature_type":"Value"
|
101 |
+
"dtype":"string"
|
102 |
+
}
|
103 |
+
"tokens":{
|
104 |
+
"feature_type":"Sequence"
|
105 |
+
"feature":{
|
106 |
+
"feature_type":"Value"
|
107 |
+
"dtype":"string"
|
108 |
+
}
|
109 |
+
}
|
110 |
+
"ner_tags":{
|
111 |
+
"feature_type":"Sequence"
|
112 |
+
"dtype":"int32"
|
113 |
+
"feature":{
|
114 |
+
"feature_type":"ClassLabel"
|
115 |
+
"dtype":"int32"
|
116 |
+
"class_names":[
|
117 |
+
0:"0"
|
118 |
+
1:"LOC"
|
119 |
+
2:"MISC"
|
120 |
+
3:"ORG"
|
121 |
+
4:"PER"
|
122 |
+
]
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
126 |
+
```
|
127 |
+
|
128 |
+
### Data Splits
|
129 |
+
|
130 |
+
[More Information Needed]
|
131 |
+
|
132 |
+
## Dataset Creation
|
133 |
+
|
134 |
+
### Curation Rationale
|
135 |
+
|
136 |
+
[More Information Needed]
|
137 |
+
|
138 |
+
### Source Data
|
139 |
+
|
140 |
+
[More Information Needed]
|
141 |
+
|
142 |
+
#### Initial Data Collection and Normalization
|
143 |
+
|
144 |
+
[More Information Needed]
|
145 |
+
|
146 |
+
#### Who are the source language producers?
|
147 |
+
|
148 |
+
[More Information Needed]
|
149 |
+
|
150 |
+
### Annotations
|
151 |
+
|
152 |
+
[More Information Needed]
|
153 |
+
|
154 |
+
#### Annotation process
|
155 |
+
|
156 |
+
[More Information Needed]
|
157 |
+
|
158 |
+
#### Who are the annotators?
|
159 |
+
|
160 |
+
[More Information Needed]
|
161 |
+
|
162 |
+
### Personal and Sensitive Information
|
163 |
+
|
164 |
+
[More Information Needed]
|
165 |
+
|
166 |
+
## Considerations for Using the Data
|
167 |
+
|
168 |
+
### Social Impact of Dataset
|
169 |
+
|
170 |
+
[More Information Needed]
|
171 |
+
|
172 |
+
### Discussion of Biases
|
173 |
+
|
174 |
+
[More Information Needed]
|
175 |
+
|
176 |
+
### Other Known Limitations
|
177 |
+
|
178 |
+
[More Information Needed]
|
179 |
+
|
180 |
+
## Additional Information
|
181 |
+
|
182 |
+
### Dataset Curators
|
183 |
+
|
184 |
+
The original dataset was provided by Språkbanken which consists of news from Swedish newspapers' websites.
|
185 |
+
|
186 |
+
### Licensing Information
|
187 |
+
|
188 |
+
https://github.com/klintan/swedish-ner-corpus/blob/master/LICENSE
|
189 |
+
|
190 |
+
### Citation Information
|
191 |
+
|
192 |
+
[More Information Needed]
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"default": {"description": " Webbnyheter 2012 from Spraakbanken, semi-manually annotated and adapted for CoreNLP Swedish NER. Semi-manually defined in this case as: Bootstrapped from Swedish Gazetters then manually correcte/reviewed by two independent native speaking swedish annotators. No annotator agreement calculated.\n", "citation": "", "homepage": "https://github.com/klintan/swedish-ner-corpus", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "ner_tags": {"feature": {"num_classes": 5, "names": ["0", "LOC", "MISC", "ORG", "PER"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "swedish_ner_corpus_dataset", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2032630, "num_examples": 6886, "dataset_name": "swedish_ner_corpus_dataset"}, "test": {"name": "test", "num_bytes": 755234, "num_examples": 2453, "dataset_name": "swedish_ner_corpus_dataset"}}, "download_checksums": {"https://raw.githubusercontent.com/klintan/swedish-ner-corpus/master/train_corpus.txt": {"num_bytes": 986349, "checksum": "b0ba93840c13b882a336f5ae3b4af4cc5238203cd504acd5f44d8a7f643abf9f"}, "https://raw.githubusercontent.com/klintan/swedish-ner-corpus/master/test_corpus.txt": {"num_bytes": 398209, "checksum": "b13c8626cf6478df4b3e9a2e7fa5276fd45f757bc5af9f6bc4abc7d789af2fdd"}}, "download_size": 1384558, "post_processing_size": null, "dataset_size": 2787864, "size_in_bytes": 4172422}}
|
dummy/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b78ed0de3025ccdcad974b048802b521128d8831d0d55b8ce6e844ccc69d9c5e
|
3 |
+
size 450
|
swedish_ner_corpus.py
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 HuggingFace Datasets Authors.
|
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 |
+
import datasets
|
18 |
+
|
19 |
+
|
20 |
+
_DESCRIPTION = """\
|
21 |
+
Webbnyheter 2012 from Spraakbanken, semi-manually annotated and adapted for CoreNLP Swedish NER. Semi-manually defined in this case as: Bootstrapped from Swedish Gazetters then manually correcte/reviewed by two independent native speaking swedish annotators. No annotator agreement calculated.
|
22 |
+
"""
|
23 |
+
_HOMEPAGE_URL = "https://github.com/klintan/swedish-ner-corpus"
|
24 |
+
_TRAIN_URL = "https://raw.githubusercontent.com/klintan/swedish-ner-corpus/master/train_corpus.txt"
|
25 |
+
_TEST_URL = "https://raw.githubusercontent.com/klintan/swedish-ner-corpus/master/test_corpus.txt"
|
26 |
+
_CITATION = None
|
27 |
+
|
28 |
+
|
29 |
+
class SwedishNERCorpus(datasets.GeneratorBasedBuilder):
|
30 |
+
VERSION = datasets.Version("1.0.0")
|
31 |
+
|
32 |
+
def _info(self):
|
33 |
+
return datasets.DatasetInfo(
|
34 |
+
description=_DESCRIPTION,
|
35 |
+
features=datasets.Features(
|
36 |
+
{
|
37 |
+
"id": datasets.Value("string"),
|
38 |
+
"tokens": datasets.Sequence(datasets.Value("string")),
|
39 |
+
"ner_tags": datasets.Sequence(
|
40 |
+
datasets.features.ClassLabel(names=["0", "LOC", "MISC", "ORG", "PER"])
|
41 |
+
),
|
42 |
+
},
|
43 |
+
),
|
44 |
+
supervised_keys=None,
|
45 |
+
homepage=_HOMEPAGE_URL,
|
46 |
+
citation=_CITATION,
|
47 |
+
)
|
48 |
+
|
49 |
+
def _split_generators(self, dl_manager):
|
50 |
+
train_path = dl_manager.download_and_extract(_TRAIN_URL)
|
51 |
+
test_path = dl_manager.download_and_extract(_TEST_URL)
|
52 |
+
return [
|
53 |
+
datasets.SplitGenerator(
|
54 |
+
name=datasets.Split.TRAIN,
|
55 |
+
gen_kwargs={"datapath": train_path},
|
56 |
+
),
|
57 |
+
datasets.SplitGenerator(
|
58 |
+
name=datasets.Split.TEST,
|
59 |
+
gen_kwargs={"datapath": test_path},
|
60 |
+
),
|
61 |
+
]
|
62 |
+
|
63 |
+
def _generate_examples(self, datapath):
|
64 |
+
sentence_counter = 0
|
65 |
+
with open(datapath, encoding="utf-8") as f:
|
66 |
+
current_words = []
|
67 |
+
current_labels = []
|
68 |
+
for row in f:
|
69 |
+
row = row.rstrip()
|
70 |
+
row_split = row.split()
|
71 |
+
if len(row_split) == 2:
|
72 |
+
token, label = row_split
|
73 |
+
current_words.append(token)
|
74 |
+
current_labels.append(label)
|
75 |
+
else:
|
76 |
+
if not current_words:
|
77 |
+
continue
|
78 |
+
assert len(current_words) == len(current_labels), "word len doesnt match label length"
|
79 |
+
sentence = (
|
80 |
+
sentence_counter,
|
81 |
+
{
|
82 |
+
"id": str(sentence_counter),
|
83 |
+
"tokens": current_words,
|
84 |
+
"ner_tags": current_labels,
|
85 |
+
},
|
86 |
+
)
|
87 |
+
sentence_counter += 1
|
88 |
+
current_words = []
|
89 |
+
current_labels = []
|
90 |
+
yield sentence
|
91 |
+
|
92 |
+
# if something remains:
|
93 |
+
if current_words:
|
94 |
+
sentence = (
|
95 |
+
sentence_counter,
|
96 |
+
{
|
97 |
+
"id": str(sentence_counter),
|
98 |
+
"tokens": current_words,
|
99 |
+
"ner_tags": current_labels,
|
100 |
+
},
|
101 |
+
)
|
102 |
+
yield sentence
|