thivy/norwegian-ner-combined
Norwegian NER Combined Dataset Dataset Description This dataset combines the NorNE (Norwegian Named Entities) and WikiANN Norwegian datasets for Named Entity Recognition (NER) in Norwegian (Bokmål and Nynorsk). Key Features ✅ 49,870 training samples (NorNE + WikiANN combined) ✅ 14,289 validation samples ✅ 13,450 test samples ✅ 4 entity types: PER, ORG, LOC, MISC ✅ Quality filtered: 12 problematic samples removed from NorNE ✅ Entity remapping: 9… See the full description on the dataset page: https://huggingface.co/datasets/thivy/norwegian-ner-combined.
Norwegian NER Combined Dataset
Dataset Description
This dataset combines the NorNE (Norwegian Named Entities) and WikiANN Norwegian datasets for Named Entity Recognition (NER) in Norwegian (Bokmål and Nynorsk).
Key Features
- ✅ 49,870 training samples (NorNE + WikiANN combined)
- ✅ 14,289 validation samples
- ✅ 13,450 test samples
- ✅ 4 entity types: PER, ORG, LOC, MISC
- ✅ Quality filtered: 12 problematic samples removed from NorNE
- ✅ Entity remapping: 9 original types → 4 core types
Languages
- Norwegian Bokmål (nob)
- Norwegian Nynorsk (nno)
Entity Types
Dataset Sources
1. NorNE (Norwegian Named Entities)
- Repository: https://github.com/ltgoslo/norne
- Format: Universal Dependencies (CoNLL-U)
- Variants: Bokmål and Nynorsk
- Annotation: Manual annotation by Language Technology Group, University of Oslo
2. WikiANN (Pan-lingual NER)
- Source: HuggingFace Datasets (
wikiann, Norwegian subset) - Origin: Wikipedia articles
- Annotation: Automatic annotation from Wikipedia markup
Data Processing
Quality Filtering
12 problematic samples removed from NorNE:
Examples of filtered samples:
"Sharia"- Single word, missing annotation"Ombudsmannen"- Single word, no context"Verdensarv ."- 2 tokens, no entities, critical loss increase
Entity Type Remapping
Original NorNE had 9 entity types, remapped to 4 standard types:
GPE_ORG → ORG (Geo-political organizations)
GPE_LOC → LOC (Geo-political locations)
PROD → O (Dropped: Products)
DRV → O (Dropped: Derived terms)
EVT → O (Dropped: Events)
Kept:
- PER (Person)
- ORG (Organization)
- LOC (Location)
- MISC (Miscellaneous)Why? These 4 types align with standard NER benchmarks and had sufficient training data from WikiANN.
Dataset Structure
Data Splits
Data Fields
- `id` (string): Unique identifier (e.g.,
"train_0") - `tokens` (list[string]): Tokenized sentence
- `ner_tags` (list[int]): NER tags in IOB2 format
Label Schema (IOB2)
0: O (Outside any entity)
1: B-LOC (Beginning of Location)
2: B-MISC (Beginning of Miscellaneous)
3: B-ORG (Beginning of Organization)
4: B-PER (Beginning of Person)
5: I-LOC (Inside Location)
6: I-MISC (Inside Miscellaneous)
7: I-ORG (Inside Organization)
8: I-PER (Inside Person)Usage
Load Dataset
from datasets import load_dataset
# Load the dataset
dataset = load_dataset("thivy/norwegian-ner-combined")
# Access splits
train_data = dataset["train"]
val_data = dataset["validation"]
test_data = dataset["test"]
# Example
print(train_data[0])Output:
{
'id': 'train_0',
'tokens': ['Oslo', 'er', 'hovedstaden', 'i', 'Norge', '.'],
'ner_tags': [1, 0, 0, 0, 1, 0] # B-LOC, O, O, O, B-LOC, O
}Training Example
from transformers import AutoTokenizer, AutoModelForTokenClassification, TrainingArguments, Trainer
# Load model and tokenizer
model_name = "NbAiLab/nb-bert-base"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForTokenClassification.from_pretrained(
model_name,
num_labels=9 # 9 labels in IOB2 format
)
# Load dataset
dataset = load_dataset("thivy/norwegian-ner-combined")
# Tokenize and align labels
def tokenize_and_align_labels(examples):
tokenized_inputs = tokenizer(
examples["tokens"],
truncation=True,
is_split_into_words=True
)
labels = []
for i, label in enumerate(examples["ner_tags"]):
word_ids = tokenized_inputs.word_ids(batch_index=i)
label_ids = []
for word_idx in word_ids:
if word_idx is None:
label_ids.append(-100)
else:
label_ids.append(label[word_idx])
labels.append(label_ids)
tokenized_inputs["labels"] = labels
return tokenized_inputs
tokenized_datasets = dataset.map(tokenize_and_align_labels, batched=True)
# Train
training_args = TrainingArguments(
output_dir="./norwegian-ner-model",
evaluation_strategy="epoch",
learning_rate=2e-5,
num_train_epochs=3,
per_device_train_batch_size=8,
)
trainer = Trainer(
model=model,
args=training_args,
train_dataset=tokenized_datasets["train"],
eval_dataset=tokenized_datasets["validation"],
)
trainer.train()Training Results
A model trained on this dataset achieved:
Model: Coming soon Base Model: NbAiLab/nb-bert-base
Training Configuration
- Learning Rate: 3.5e-5 (cosine with restarts)
- Epochs: 20 (early stopped at 11)
- Batch Size: 8
- Weight Decay: 0.15
- Optimizer: AdamW
Dataset Statistics
Entity Distribution (Training Set)
Sample Length Distribution
Min tokens: 1
Max tokens: 512
Mean tokens: 15.2
Median tokens: 12Limitations
- Domain: Primarily news text and Wikipedia
- Formality: More formal Norwegian, less conversational
- Entity coverage: MISC category is underrepresented
- Temporal: Data may not reflect recent entities/organizations
Ethical Considerations
- News articles may contain biased language
- Person names in dataset are public figures
- Geographic and organizational names may be politically sensitive
Citation
NorNE Dataset
@inproceedings{jorgensen-etal-2020-norne,
title = "{N}or{NE}: Annotating Named Entities for {N}orwegian",
author = "J{\o}rgensen, Fredrik and
Aasen, Tobias and
R{\o}nningstad, Anne-Katrine and
Indreb{\o}, Kristin Hagen and
Lyse, Gunn Inger",
booktitle = "Proceedings of the 12th Language Resources and Evaluation Conference",
month = may,
year = "2020",
address = "Marseille, France",
publisher = "European Language Resources Association",
pages = "4547--4556",
}WikiANN Dataset
@inproceedings{pan-etal-2017-cross,
title = "Cross-lingual Name Tagging and Linking for 282 Languages",
author = "Pan, Xiaoman and
Zhang, Boliang and
May, Jonathan and
Nothman, Joel and
Knight, Kevin and
Ji, Heng",
booktitle = "Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
year = "2017",
}nb-bert-base Model
@misc{kummervold2021operationalizing,
title={Operationalizing a National Digital Library: The Case for a Norwegian Transformer Model},
author={Per E Kummervold and Javier de la Rosa and Freddy Wetjen and Svein Arne Brygfjeld},
year={2021},
eprint={2104.09617},
archivePrefix={arXiv},
primaryClass={cs.CL}
}License
- NorNE: CC-BY 4.0
- WikiANN: CC-BY-SA 3.0
- This Dataset: CC-BY 4.0 (inheriting from NorNE)
Contact
For questions or issues with this dataset:
- GitHub: finetune-ner-norne-wikian
- HuggingFace: @thivy
Acknowledgments
- Language Technology Group (LTG) at University of Oslo for the NorNE dataset
- National Library of Norway AI Lab (NBAiLab) for nb-bert-base model
- HuggingFace for the Transformers library and dataset infrastructure
