Datasets:
Tasks:
Token Classification
Sub-tasks:
named-entity-recognition
Languages:
Norwegian
Size:
10K<n<100K
License:
Commit
·
7746025
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 +137 -0
- dataset_infos.json +1 -0
- dummy/bokmaal/1.0.0/dummy_data.zip +3 -0
- dummy/nynorsk/1.0.0/dummy_data.zip +3 -0
- dummy/samnorsk/1.0.0/dummy_data.zip +3 -0
- norwegian_ner.py +184 -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,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
language_creators:
|
5 |
+
- crowdsourced
|
6 |
+
languages:
|
7 |
+
- no
|
8 |
+
licenses:
|
9 |
+
- unknown-
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
- 10K<n<100K
|
14 |
+
source_datasets:
|
15 |
+
- original
|
16 |
+
task_categories:
|
17 |
+
- structure-prediction
|
18 |
+
task_ids:
|
19 |
+
- named-entity-recognition
|
20 |
+
---
|
21 |
+
|
22 |
+
# Dataset Card for Norwegian NER
|
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:** [Github](https://github.com/ljos/navnkjenner)
|
50 |
+
- **Repository:** [Github](https://github.com/ljos/navnkjenner)
|
51 |
+
- **Paper:**
|
52 |
+
- **Leaderboard:**
|
53 |
+
- **Point of Contact:**
|
54 |
+
|
55 |
+
### Dataset Summary
|
56 |
+
|
57 |
+
[More Information Needed]
|
58 |
+
|
59 |
+
### Supported Tasks and Leaderboards
|
60 |
+
|
61 |
+
[More Information Needed]
|
62 |
+
|
63 |
+
### Languages
|
64 |
+
|
65 |
+
[More Information Needed]
|
66 |
+
|
67 |
+
## Dataset Structure
|
68 |
+
|
69 |
+
### Data Instances
|
70 |
+
|
71 |
+
[More Information Needed]
|
72 |
+
|
73 |
+
### Data Fields
|
74 |
+
|
75 |
+
[More Information Needed]
|
76 |
+
|
77 |
+
### Data Splits
|
78 |
+
|
79 |
+
[More Information Needed]
|
80 |
+
|
81 |
+
## Dataset Creation
|
82 |
+
|
83 |
+
### Curation Rationale
|
84 |
+
|
85 |
+
[More Information Needed]
|
86 |
+
|
87 |
+
### Source Data
|
88 |
+
|
89 |
+
#### Initial Data Collection and Normalization
|
90 |
+
|
91 |
+
[More Information Needed]
|
92 |
+
|
93 |
+
#### Who are the source language producers?
|
94 |
+
|
95 |
+
[More Information Needed]
|
96 |
+
|
97 |
+
### Annotations
|
98 |
+
|
99 |
+
#### Annotation process
|
100 |
+
|
101 |
+
[More Information Needed]
|
102 |
+
|
103 |
+
#### Who are the annotators?
|
104 |
+
|
105 |
+
[More Information Needed]
|
106 |
+
|
107 |
+
### Personal and Sensitive Information
|
108 |
+
|
109 |
+
[More Information Needed]
|
110 |
+
|
111 |
+
## Considerations for Using the Data
|
112 |
+
|
113 |
+
### Social Impact of Dataset
|
114 |
+
|
115 |
+
[More Information Needed]
|
116 |
+
|
117 |
+
### Discussion of Biases
|
118 |
+
|
119 |
+
[More Information Needed]
|
120 |
+
|
121 |
+
### Other Known Limitations
|
122 |
+
|
123 |
+
[More Information Needed]
|
124 |
+
|
125 |
+
## Additional Information
|
126 |
+
|
127 |
+
### Dataset Curators
|
128 |
+
|
129 |
+
[More Information Needed]
|
130 |
+
|
131 |
+
### Licensing Information
|
132 |
+
|
133 |
+
[More Information Needed]
|
134 |
+
|
135 |
+
### Citation Information
|
136 |
+
|
137 |
+
[More Information Needed]
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bokmaal": {"description": "Named entities Recognition dataset for Norwegian.\n", "citation": "@inproceedings{johansen2019ner,\n title={Named-Entity Recognition for Norwegian},\n author={Johansen, Bjarte},\n booktitle={Proceedings of the 22nd Nordic Conference on Computational Linguistics, NoDaLiDa},\n year={2019}\n}\n", "homepage": "https://github.com/ljos/navnkjenner", "license": "", "features": {"idx": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "lemmas": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "pos_tags": {"feature": {"num_classes": 17, "names": ["NOUN", "PUNCT", "ADP", "NUM", "SYM", "SCONJ", "ADJ", "PART", "DET", "CCONJ", "PROPN", "PRON", "X", "ADV", "INTJ", "VERB", "AUX"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}, "ner_tags": {"feature": {"num_classes": 17, "names": ["O", "B-OTH", "I-OTH", "E-OTH", "S-OTH", "B-ORG", "I-ORG", "E-ORG", "S-ORG", "B-PRS", "I-PRS", "E-PRS", "S-PRS", "B-GEO", "I-GEO", "E-GEO", "S-GEO"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "norwegianner", "config_name": "bokmaal", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 9859760, "num_examples": 15696, "dataset_name": "norwegianner"}, "validation": {"name": "validation", "num_bytes": 1475216, "num_examples": 2410, "dataset_name": "norwegianner"}, "test": {"name": "test", "num_bytes": 1212939, "num_examples": 1939, "dataset_name": "norwegianner"}}, "download_checksums": {"https://github.com/ljos/navnkjenner/blob/master/data/bokmaal/no_bokmaal-ud-train.bioes?raw=true": {"num_bytes": 6873565, "checksum": "f4352a4ce6c17b437930022e52dbaa3aeed8bf99533c5bcda26d484bd66dc9c7"}, "https://github.com/ljos/navnkjenner/blob/master/data/bokmaal/no_bokmaal-ud-dev.bioes?raw=true": {"num_bytes": 1029129, "checksum": "61e863a87a6cceaaa97ce6a8b7379c5efcca8f35210bb5de102baa832112a3bb"}, "https://github.com/ljos/navnkjenner/blob/master/data/bokmaal/no_bokmaal-ud-test.bioes?raw=true": {"num_bytes": 845066, "checksum": "ef73251694533a258d2858fa535ec8895c911b9891d6bd1d5577e7ac7d67ad81"}}, "download_size": 8747760, "post_processing_size": null, "dataset_size": 12547915, "size_in_bytes": 21295675}, "nynorsk": {"description": "Named entities Recognition dataset for Norwegian.\n", "citation": "@inproceedings{johansen2019ner,\n title={Named-Entity Recognition for Norwegian},\n author={Johansen, Bjarte},\n booktitle={Proceedings of the 22nd Nordic Conference on Computational Linguistics, NoDaLiDa},\n year={2019}\n}\n", "homepage": "https://github.com/ljos/navnkjenner", "license": "", "features": {"idx": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "lemmas": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "pos_tags": {"feature": {"num_classes": 17, "names": ["NOUN", "PUNCT", "ADP", "NUM", "SYM", "SCONJ", "ADJ", "PART", "DET", "CCONJ", "PROPN", "PRON", "X", "ADV", "INTJ", "VERB", "AUX"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}, "ner_tags": {"feature": {"num_classes": 17, "names": ["O", "B-OTH", "I-OTH", "E-OTH", "S-OTH", "B-ORG", "I-ORG", "E-ORG", "S-ORG", "B-PRS", "I-PRS", "E-PRS", "S-PRS", "B-GEO", "I-GEO", "E-GEO", "S-GEO"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "norwegianner", "config_name": "nynorsk", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 9916338, "num_examples": 14174, "dataset_name": "norwegianner"}, "validation": {"name": "validation", "num_bytes": 1257235, "num_examples": 1890, "dataset_name": "norwegianner"}, "test": {"name": "test", "num_bytes": 1006733, "num_examples": 1511, "dataset_name": "norwegianner"}}, "download_checksums": {"https://github.com/ljos/navnkjenner/blob/master/data/nynorsk/no_nynorsk-ud-train.bioes?raw=true": {"num_bytes": 6910930, "checksum": "6af9021ddc9bef8f4dfddea376253324b42dd62bee7979128a5d4df5d1dc0856"}, "https://github.com/ljos/navnkjenner/blob/master/data/nynorsk/no_nynorsk-ud-dev.bioes?raw=true": {"num_bytes": 871612, "checksum": "d0a9b9d2e8b32419d8d511c0e151abf6fe6e34248445c67c674fdba6f02eed0d"}, "https://github.com/ljos/navnkjenner/blob/master/data/nynorsk/no_nynorsk-ud-test.bioes?raw=true": {"num_bytes": 702003, "checksum": "6f3dad1b5c4cad23c2148357afdc9dcbb9080824d5479faca97fa9435430da65"}}, "download_size": 8484545, "post_processing_size": null, "dataset_size": 12180306, "size_in_bytes": 20664851}, "samnorsk": {"description": "Named entities Recognition dataset for Norwegian.\n", "citation": "@inproceedings{johansen2019ner,\n title={Named-Entity Recognition for Norwegian},\n author={Johansen, Bjarte},\n booktitle={Proceedings of the 22nd Nordic Conference on Computational Linguistics, NoDaLiDa},\n year={2019}\n}\n", "homepage": "https://github.com/ljos/navnkjenner", "license": "", "features": {"idx": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "lemmas": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "pos_tags": {"feature": {"num_classes": 17, "names": ["NOUN", "PUNCT", "ADP", "NUM", "SYM", "SCONJ", "ADJ", "PART", "DET", "CCONJ", "PROPN", "PRON", "X", "ADV", "INTJ", "VERB", "AUX"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}, "ner_tags": {"feature": {"num_classes": 17, "names": ["O", "B-OTH", "I-OTH", "E-OTH", "S-OTH", "B-ORG", "I-ORG", "E-ORG", "S-ORG", "B-PRS", "I-PRS", "E-PRS", "S-PRS", "B-GEO", "I-GEO", "E-GEO", "S-GEO"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "norwegianner", "config_name": "samnorsk", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 22508485, "num_examples": 34170, "dataset_name": "norwegianner"}, "validation": {"name": "validation", "num_bytes": 2732419, "num_examples": 4300, "dataset_name": "norwegianner"}, "test": {"name": "test", "num_bytes": 2219640, "num_examples": 3450, "dataset_name": "norwegianner"}}, "download_checksums": {"https://github.com/ljos/navnkjenner/blob/master/data/samnorsk/no_samnorsk-ud-train.bioes?raw=true": {"num_bytes": 15685238, "checksum": "538def9d734936fe381e62950efad87d444e297e14103438366e0ac796e46953"}, "https://github.com/ljos/navnkjenner/blob/master/data/samnorsk/no_samnorsk-ud-dev.bioes?raw=true": {"num_bytes": 1900741, "checksum": "9a65673fa2f3deb58d2003dac52b4d30b54ad2cbd208bf46031350052dd0e5ed"}, "https://github.com/ljos/navnkjenner/blob/master/data/samnorsk/no_samnorsk-ud-test.bioes?raw=true": {"num_bytes": 1547070, "checksum": "faed2caf41bb3939481e09eaa39ae1371d0bf5ade9d5b0bec8922aa214130523"}}, "download_size": 19133049, "post_processing_size": null, "dataset_size": 27460544, "size_in_bytes": 46593593}}
|
dummy/bokmaal/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:de794359122b2a6924e50b9185cb0573c72882e8cdef8100f4cfbc1e8a2d36b6
|
3 |
+
size 1114
|
dummy/nynorsk/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9e4800068b6ee73510745b72b79b92d5bdd7102fa88352f4f2fd8d4084a66dbd
|
3 |
+
size 1041
|
dummy/samnorsk/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:366f34b6aa8f20dabeeb41c696e794201031dfe9b691db2f055fa6341a934c8c
|
3 |
+
size 1120
|
norwegian_ner.py
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""Named entities Recognition dataset for Norwegian."""
|
18 |
+
|
19 |
+
import conllu
|
20 |
+
|
21 |
+
import datasets
|
22 |
+
|
23 |
+
|
24 |
+
_CITATION = """\
|
25 |
+
@inproceedings{johansen2019ner,
|
26 |
+
title={Named-Entity Recognition for Norwegian},
|
27 |
+
author={Johansen, Bjarte},
|
28 |
+
booktitle={Proceedings of the 22nd Nordic Conference on Computational Linguistics, NoDaLiDa},
|
29 |
+
year={2019}
|
30 |
+
}
|
31 |
+
"""
|
32 |
+
|
33 |
+
_DESCRIPTION = """\
|
34 |
+
Named entities Recognition dataset for Norwegian. It is
|
35 |
+
a version of the Universal Dependency (UD) Treebank for both Bokmål and Nynorsk (UDN) where
|
36 |
+
all proper nouns have been tagged with their type according to the NER tagging scheme. UDN is a converted
|
37 |
+
version of the Norwegian Dependency Treebank into the UD scheme.
|
38 |
+
"""
|
39 |
+
|
40 |
+
# Files are stored with Git LFS then we add raw=true at the end
|
41 |
+
_URL = "https://github.com/ljos/navnkjenner/blob/master/data/"
|
42 |
+
_BOKMAAL_TRAIN = "bokmaal/no_bokmaal-ud-train.bioes?raw=true"
|
43 |
+
_BOKMAAL_DEV = "bokmaal/no_bokmaal-ud-dev.bioes?raw=true"
|
44 |
+
_BOKMAAL_TEST = "bokmaal/no_bokmaal-ud-test.bioes?raw=true"
|
45 |
+
_NYNORSK_TRAIN = "nynorsk/no_nynorsk-ud-train.bioes?raw=true"
|
46 |
+
_NYNORSK_DEV = "nynorsk/no_nynorsk-ud-dev.bioes?raw=true"
|
47 |
+
_NYNORSK_TEST = "nynorsk/no_nynorsk-ud-test.bioes?raw=true"
|
48 |
+
_SAMNORSK_TRAIN = "samnorsk/no_samnorsk-ud-train.bioes?raw=true"
|
49 |
+
_SAMNORSK_DEV = "samnorsk/no_samnorsk-ud-dev.bioes?raw=true"
|
50 |
+
_SAMNORSK_TEST = "samnorsk/no_samnorsk-ud-test.bioes?raw=true"
|
51 |
+
|
52 |
+
|
53 |
+
class NorwegiannerConfig(datasets.BuilderConfig):
|
54 |
+
"""BuilderConfig for NorwegianNER."""
|
55 |
+
|
56 |
+
def __init__(self, **kwargs):
|
57 |
+
"""BuilderConfig for Norwegianner.
|
58 |
+
|
59 |
+
Args:
|
60 |
+
**kwargs: keyword arguments forwarded to super.
|
61 |
+
"""
|
62 |
+
super(NorwegiannerConfig, self).__init__(**kwargs)
|
63 |
+
|
64 |
+
|
65 |
+
class Norwegianner(datasets.GeneratorBasedBuilder):
|
66 |
+
"""Norwegianner dataset."""
|
67 |
+
|
68 |
+
BUILDER_CONFIGS = [
|
69 |
+
NorwegiannerConfig(
|
70 |
+
name="bokmaal", version=datasets.Version("1.0.0"), description="Norwegianner bokmaal dataset"
|
71 |
+
),
|
72 |
+
NorwegiannerConfig(
|
73 |
+
name="nynorsk", version=datasets.Version("1.0.0"), description="Norwegianner nynorsk dataset"
|
74 |
+
),
|
75 |
+
NorwegiannerConfig(
|
76 |
+
name="samnorsk", version=datasets.Version("1.0.0"), description="Norwegianner samnorsk dataset"
|
77 |
+
),
|
78 |
+
]
|
79 |
+
|
80 |
+
def _info(self):
|
81 |
+
return datasets.DatasetInfo(
|
82 |
+
description=_DESCRIPTION,
|
83 |
+
features=datasets.Features(
|
84 |
+
{
|
85 |
+
"idx": datasets.Value("string"),
|
86 |
+
"text": datasets.Value("string"),
|
87 |
+
"tokens": datasets.Sequence(datasets.Value("string")),
|
88 |
+
"lemmas": datasets.Sequence(datasets.Value("string")),
|
89 |
+
"pos_tags": datasets.Sequence(
|
90 |
+
datasets.features.ClassLabel(
|
91 |
+
names=[
|
92 |
+
"NOUN",
|
93 |
+
"PUNCT",
|
94 |
+
"ADP",
|
95 |
+
"NUM",
|
96 |
+
"SYM",
|
97 |
+
"SCONJ",
|
98 |
+
"ADJ",
|
99 |
+
"PART",
|
100 |
+
"DET",
|
101 |
+
"CCONJ",
|
102 |
+
"PROPN",
|
103 |
+
"PRON",
|
104 |
+
"X",
|
105 |
+
"ADV",
|
106 |
+
"INTJ",
|
107 |
+
"VERB",
|
108 |
+
"AUX",
|
109 |
+
]
|
110 |
+
)
|
111 |
+
),
|
112 |
+
"ner_tags": datasets.Sequence(
|
113 |
+
datasets.features.ClassLabel(
|
114 |
+
names=[
|
115 |
+
"O",
|
116 |
+
"B-OTH",
|
117 |
+
"I-OTH",
|
118 |
+
"E-OTH",
|
119 |
+
"S-OTH",
|
120 |
+
"B-ORG",
|
121 |
+
"I-ORG",
|
122 |
+
"E-ORG",
|
123 |
+
"S-ORG",
|
124 |
+
"B-PRS",
|
125 |
+
"I-PRS",
|
126 |
+
"E-PRS",
|
127 |
+
"S-PRS",
|
128 |
+
"B-GEO",
|
129 |
+
"I-GEO",
|
130 |
+
"E-GEO",
|
131 |
+
"S-GEO",
|
132 |
+
]
|
133 |
+
)
|
134 |
+
),
|
135 |
+
}
|
136 |
+
),
|
137 |
+
supervised_keys=None,
|
138 |
+
homepage="https://github.com/ljos/navnkjenner",
|
139 |
+
citation=_CITATION,
|
140 |
+
)
|
141 |
+
|
142 |
+
def _split_generators(self, dl_manager):
|
143 |
+
"""Returns SplitGenerators."""
|
144 |
+
if self.config.name == "bokmaal":
|
145 |
+
urls_to_download = {
|
146 |
+
"train": f"{_URL}{_BOKMAAL_TRAIN}",
|
147 |
+
"dev": f"{_URL}{_BOKMAAL_DEV}",
|
148 |
+
"test": f"{_URL}{_BOKMAAL_TEST}",
|
149 |
+
}
|
150 |
+
elif self.config.name == "nynorsk":
|
151 |
+
urls_to_download = {
|
152 |
+
"train": f"{_URL}{_NYNORSK_TRAIN}",
|
153 |
+
"dev": f"{_URL}{_NYNORSK_DEV}",
|
154 |
+
"test": f"{_URL}{_NYNORSK_TEST}",
|
155 |
+
}
|
156 |
+
elif self.config.name == "samnorsk":
|
157 |
+
urls_to_download = {
|
158 |
+
"train": f"{_URL}{_SAMNORSK_TRAIN}",
|
159 |
+
"dev": f"{_URL}{_SAMNORSK_DEV}",
|
160 |
+
"test": f"{_URL}{_SAMNORSK_TEST}",
|
161 |
+
}
|
162 |
+
|
163 |
+
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
164 |
+
|
165 |
+
return [
|
166 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
167 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
|
168 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
|
169 |
+
]
|
170 |
+
|
171 |
+
def _generate_examples(self, filepath):
|
172 |
+
with open(filepath, "r", encoding="utf-8") as data_file:
|
173 |
+
tokenlist = list(conllu.parse_incr(data_file))
|
174 |
+
id = 0
|
175 |
+
for sent in tokenlist:
|
176 |
+
yield id, {
|
177 |
+
"idx": sent.metadata["sent_id"],
|
178 |
+
"text": sent.metadata["text"],
|
179 |
+
"tokens": [token["form"] for token in sent],
|
180 |
+
"lemmas": [token["lemma"] for token in sent],
|
181 |
+
"pos_tags": [token["upos"] for token in sent],
|
182 |
+
"ner_tags": [token["xpos"] for token in sent],
|
183 |
+
}
|
184 |
+
id += 1
|