Discord

Checklist Slovak AI Olympiad 2026 Home Preparation · Task 3

Diacritics: Automatic Restoration of Diacritics in Slovak Text

Slovak title: Diakritika: Automatická obnova diakritiky v slovenskom texte

Restore Slovak diacritics with SlovakBERT: prepare Wikipedia training pairs, solve zero-shot with masked-language modelling, then fine-tune.

  • NLP
  • Diacritics restoration (sequence labelling / text normalisation)
  • Slovak original · English translation

The task

Slovak text is often typed without diacritics, which hampers automatic processing ('mama ma rada' can mean different things). The task is to build a system that restores diacritics using the gerulata/slovakbert model; input and output are the same Slovak text without and with diacritics.

Part 1 (30 pts): extract clean sentences from the Slovak Wikipedia dump (skwiki 20251120), strip diacritics with a given character map, and build at least 10,000 (no-diacritics, original) sentence pairs with a train/validation split and a JSON statistics file. Part 2 (20 pts): restore diacritics zero-shot with SlovakBERT's masked-language-model head, without any fine-tuning. Part 3 (50 pts): fine-tune SlovakBERT on the Part 1 data only (e.g. token classification, seq2seq or character level).

Abridged and translated by SOTA from the official Slovak materials. The official statement has the exact rules, and it wins wherever this summary differs.

In English

This task was published in Slovak. SOTA translated it into English on 17 September 2026.

Read the task statement in English 1968 words

Task 3: Diacritics – Automatic Restoration of Diacritics in Slovak Text

English translation by SOTA – AI Community of the Slovak original, uloha3-diakritika.pdf ("Úloha 3: Diakritika: Automatická obnova diakritiky v slovenskom texte"), from the Olympiáda v umelej inteligencii (Slovak Olympiad in Artificial Intelligence), 2025/26, home round. The original task belongs to its authors. Slovak example sentences are kept as they are, because they are the data of the task; English glosses in square brackets were added by the translator. Organisers who would like this translation removed can email [email protected].

Story

Morning. A bus. A mobile phone in your hand. A friend texts you:

"Ahoj, mozes mi pozicat poznamky z matiky? Zabudol som si zosit doma a ucitelka sa bude pytat. Dakujem!"

["Hi, can you lend me your maths notes? I left my exercise book at home and the teacher is going to ask. Thanks!"]

You understand him, of course. But what if a computer received a message like this? Or what if you wanted to publish this text in the school magazine?

Writing without diacritics is common in Slovakia – especially when typing quickly on a mobile phone, in chats, or when we use a keyboard without Slovak characters. The problem arises when we need to process such a text automatically, translate it, or simply make it more readable.

The sentence "mama ma rada" can mean:

  • "mama má rada" (mum likes doing something) [ = "has"; má rada = "likes"]
  • "mama ma rada" (mum likes doing something with me, say "dressing" me) [ma = "me"]
  • "mamá mä rada" (well, this one is not correct at all…)

Your task is therefore relatively straightforward: to create an intelligent system that can automatically restore diacritics in Slovak text. In doing so, you will use the power of modern language models – specifically SlovakBERT, the first (not all that) large language model trained specifically for Slovak.

Task overview

The task consists of three parts that build on one another:

Part Name Points Description
1 Data preparation 30 Extracting and processing training data from the Slovak Wikipedia
2 Zero-shot approach 20 Restoring diacritics without fine-tuning, using only the pretrained SlovakBERT
3 Fine-tuned model 50 Training your own model on the data from Part 1

Common input: Text in Slovak with the diacritics removed.

Common output: The same text with the diacritics correctly restored.

Example

Input:

Slovensko je krajina v strednej Europe. Hlavne mesto je Bratislava.

Expected output:

Slovensko je krajina v strednej Európe. Hlavné mesto je Bratislava.

["Slovakia is a country in Central Europe. The capital is Bratislava."]


Part 1: Data preparation (30 points)

Task

Your first task is to prepare training data for a diacritics-restoration model. As the source you will use the Slovak Wikipedia dumps, which are freely available at:

https://dumps.wikimedia.org/skwiki/20251120/

Specifically, you need the file skwiki-latest-pages-articles.xml.bz2.

Requirements
  1. Download and process the Slovak Wikipedia dump
  2. Extract clean text from the articles (remove wiki markup, templates, references, infoboxes)
  3. Split the text into sentences (sentence segmentation)
  4. Create pairs (text_without_diacritics, text_with_diacritics):
    • Original text = text with diacritics
    • Input = the same text with the diacritics systematically removed
  5. Prepare a train/val split (we recommend 90/10)
Minimum requirements
  • At least 10 000 sentence pairs
  • Sentences should have a reasonable length (we recommend 50-2000 characters)
  • The data must be reproducible (be sure to document your procedure)
Removing diacritics

To create the input data, remove all diacritics according to this map:

á → a    Á → A
ä → a    Ä → A
č → c    Č → C
ď → d    Ď → D
é → e    É → E
í → i    Í → I
ĺ → l    Ĺ → L
ľ → l    Ľ → L
ň → n    Ň → N
ó → o    Ó → O
ô → o    Ô → O
ŕ → r    Ŕ → R
š → s    Š → S
ť → t    Ť → T
ú → u    Ú → U
ý → y    Ý → Y
ž → z    Ž → Z
What to submit
  1. Code for processing the data (.py or .ipynb)
  2. Statistics in JSON format:
{
  "total_sentence_pairs": 125000,
  "train_pairs": 112500,
  "val_pairs": 12500,
  "avg_sentence_length_chars": 87.3,
  "total_characters": 10937500,
  "diacritic_characters_count": 892341,
  "unique_words": 234567
}
  1. Short documentation (a README or comments in the code) explaining:
    • which steps you used to clean the data
    • how you dealt with problematic cases (special characters, foreign words, etc.)
Scoring of Part 1
Criterion Points
Working extraction pipeline 10
Meeting the minimum of 10k sentence pairs 10
Data quality and documentation 5
Reproducibility of the code 5
Tips
  • The mwparserfromhell library or the wikiextractor tool can help with parsing wiki markup
  • Watch out for:
    • Foreign-language quotations and names
    • Mathematical formulae
    • Tables and lists
    • Incomplete sentences
Data licence

The data from the Slovak Wikipedia are available under the CC-BY-SA 3.0 licence. When they are used, the source must be credited.


Part 2: Zero-shot approach (20 points)

Task

In this part you are to restore diacritics without any fine-tuning of the model. You will use the pretrained SlovakBERT and its masked language modelling (MLM) capability.

Constraints
  • You must use the model gerulata/slovakbert from HuggingFace
  • You must not fine-tune the model – no changes to the weights, no further training
  • You may use only inference operations
  • You may implement any heuristics and post-processing
Possible approaches (inspiration)

SlovakBERT is a masked language model – it can predict masked tokens in context. You can make use of this, for example, as follows:

  1. Iterative prediction: Mask, one after another, the positions where a diacritic could be, and let the model predict the best token
  2. Diffusion approach: Start with the text without diacritics and iteratively refine the predictions
  3. Candidate scoring: For each word, generate candidates with different diacritics and choose the most probable one

These are only suggestions – creative solutions are welcome!

Beware of tokenisation

SlovakBERT uses subword tokenisation. The word "krásny" ["beautiful"] may be split into several tokens. You must take this into account when working with diacritics.

from transformers import AutoTokenizer, AutoModelForMaskedLM

tokenizer = AutoTokenizer.from_pretrained("gerulata/slovakbert")
model = AutoModelForMaskedLM.from_pretrained("gerulata/slovakbert")

# Tokenisation example
tokens = tokenizer.tokenize("krásny")
# Possible output: ['krá', 'sny']
What to submit
  1. Code of the solution (.py or .ipynb)
  2. Predictions on the test set in the format:
<id>\t<predikovaný_text>
1 Slovensko je krajina v strednej Európe.
2 Hlavné mesto je Bratislava.
...

[predikovaný_text = predicted text]

Scoring

What is scored is the accuracy on characters that may carry diacritics (see the Evaluation section).

The results will be shown on a separate leaderboard.

Part 3: Fine-tuned model (50 points)

Task: Now you can use the full power of machine learning. Your task is to train a model to restore diacritics using the data you prepared in Part 1.

Constraints
  • You must use the model gerulata/slovakbert as the base
  • You may use only the data from Part 1 (no external corpora other than skwiki)
  • Computing resources: Google Colab free tier (T4 GPU, ~12GB RAM, ~12h session)
Possible formulations of the problem
  1. Token classification: For each token, predict whether it has a diacritic and which one
  2. Sequence-to-sequence: The input is the text without diacritics, the output is the text with diacritics (requires an encoder-decoder)
  3. Character-level: Work at the level of characters, not tokens
Example: Token classification
from transformers import AutoModelForTokenClassification

# Define labels for each type of diacritic
# For example: O (no change), A_ACUTE (a→á), A_UMLAUT (a→ä), ...

model = AutoModelForTokenClassification.from_pretrained(
    "gerulata/slovakbert",
    num_labels=NUM_LABELS
)
Recommendations
  • Start with a simple baseline and improve it step by step
  • Monitor the performance on the validation set
  • Experiment with:
    • Learning rate (we recommend 1e-5 to 5e-5)
    • Batch size (according to the available memory)
    • Number of epochs (typically 3-10)
    • Different formulations of the problem
What to submit
  1. Training code (.py or .ipynb)
  2. Predictions on the test set (the same format as in Part 2)
  3. Short report (optional, but recommended):
    • Which approach you chose and why
    • Which experiments you tried
    • Results on the validation set
Scoring

What is scored is the accuracy on characters that may carry diacritics (see the Evaluation section).

The results will be shown on a separate leaderboard (separately from Part 2).

Evaluation

Metric

The main metric is the accuracy on positions that may carry diacritics:

accuracy=correctly predicted characterstotal number of positions that may carry diacritics\text{accuracy} = \frac{\text{correctly predicted characters}}{\text{total number of positions that may carry diacritics}}

(In the original: accuracy = správne_predikované_znaky / celkový_počet_pozícií_s_možnou_diakritikou.)

Which positions are counted?

Only characters that can carry diacritics in Slovak are counted:

a, A  (may be á, ä)
c, C  (may be č)
d, D  (may be ď)
e, E  (may be é)
i, I  (may be í)
l, L  (may be ĺ, ľ)
n, N  (may be ň)
o, O  (may be ó, ô)
r, R  (may be ŕ)
s, S  (may be š)
t, T  (may be ť)
u, U  (may be ú)
y, Y  (may be ý)
z, Z  (may be ž)
Worked example

Reference: Môj pes má rád kosti. Prediction: Môj pes ma rád kosti. ["My dog likes bones."]

Positions that may carry diacritics (lowercase for simplicity):

  • o at position 2 → ref: ô, pred: ô
  • a at position 8 → ref: a, pred: a
  • a at position 10 → ref: á, pred: a
  • a at position 13 → ref: á, pred: á
  • o at position 16 → ref: o, pred: o
  • i at position 19 → ref: i, pred: i

Accuracy = 5/6 = 83.3%

Submission format

A file with the predictions in TSV (tab-separated) format:

id text
1 Môj pes má rád kosti.
2 Bratislava je hlavné mesto Slovenska.

Technical requirements

Environment
  • Python 3.10+
  • Google Colab (free tier) as the reference environment
Allowed libraries
torch
transformers
datasets
numpy
pandas
scikit-learn
tqdm
mwparserfromhell (for Part 1)

Other standard Python libraries are allowed. If you need anything special, ask the organisers.

Model

You must use gerulata/slovakbert:

from transformers import AutoTokenizer, AutoModel

tokenizer = AutoTokenizer.from_pretrained("gerulata/slovakbert")
model = AutoModel.from_pretrained("gerulata/slovakbert")

Documentation: https://huggingface.co/gerulata/slovakbert

Submission

What to submit
Part Files
Part 1 data_preparation.py (or .ipynb), stats.json, documentation
Part 2 zeroshot_solution.py, predictions_zeroshot.tsv
Part 3 finetuning_solution.py, predictions_finetuned.tsv, (optionally) a report
Where to submit

Edupage, under the corresponding task number.
Create a single .zip file (no larger than 70MB) from all the files you are submitting, and submit that file.

Useful links

Frequently asked questions (FAQ)

Q: May I use a model other than SlovakBERT? A: No, you must use gerulata/slovakbert.

Q: In Part 3, may I use data from sources other than Wikipedia? A: No, you may use only the data prepared in Part 1 from the Slovak Wikipedia.

Q: What if my solution needs more time/memory than Colab free offers? A: Optimise your solution. The competition is designed to be solvable on the free tier.

Q: How is the score determined when results are tied? A: When scores are equal, the submission time decides.

Bonus ideas (not scored)

For those who want to go further:

  • Joint correction of diacritics and typos – what if the input also contains typos?
  • Multilingual version – an extension to Czech or other languages with diacritics
  • Error analysis – which types of words/contexts are the hardest for your model?
  • Comparison with ByT5 – how would a character-level approach differ?

Send them directly to the organisers – they will surely be glad to discuss your solutions further!

Good luck!

Translated by SOTA. The Slovak original is the official version and wins wherever the two differ. Slovak example sentences stay in Slovak because they are the task data; the translator added English glosses in square brackets. The statement mentions a test set and leaderboards, but the published PDF does not say how the test data are distributed. If you organise this olympiad and would like the translation removed, email [email protected] and we will take it down.

At a glance

You get
Slovak Wikipedia dump (skwiki-latest-pages-articles.xml.bz2) and the gerulata/slovakbert model; a test set on which predictions are made (the PDF does not say how it is distributed).
You submit
One .zip (≤ 70 MB): data_preparation code, stats.json and documentation (Part 1); zeroshot_solution.py and predictions_zeroshot.tsv (Part 2); finetuning_solution.py, predictions_finetuned.tsv and an optional report (Part 3). Predictions are TSV lines 'id<TAB>text'.
Scoring
Part 1 is scored by criteria (working pipeline 10, at least 10k pairs 10, data quality and documentation 5, reproducibility 5). Parts 2 and 3 are scored by accuracy on characters that can carry diacritics (a, c, d, e, i, l, n, o, r, s, t, u, y, z and capitals), each on a separate leaderboard; ties are broken by submission time.
Rules
  • gerulata/slovakbert must be used; no fine-tuning or weight changes in Part 2.
  • Part 3 may use only the Part 1 Wikipedia data (no other corpora).
  • Reference environment: Google Colab free tier (T4 GPU, ~12 GB RAM, ~12 h session); Python 3.10+.
  • Allowed libraries: torch, transformers, datasets, numpy, pandas, scikit-learn, tqdm, mwparserfromhell (Part 1) and the Python standard library; ask the organisers for anything else.
Format
Home preparation (domáca príprava), first (pilot) edition, school year 2025/26: open-ended tasks solved at home and uploaded to EduPage as one .zip (max 70 MB) per task; registration by 10 Feb 2026, scores entered by 15 Mar 2026; contestants reaching a points threshold (usually 50% of the total) are invited to the national round.

Details

Year
2026, Online (home)
Round
Home Preparation · Task 3
Language
Slovak; English translation by SOTA
License
Not stated by the source