Views
No views yet
text + exact target span + dictionary candidates. The output is a
dictionary-approved stressed form, candidate probabilities, and an explicit support status.
The model does not rewrite the complete sentence and does not predict stress for arbitrary
out-of-dictionary words.FacebookAI/xlm-roberta-base<target> and </target> markers, followed by a
dictionary-masked variant classifierofficial_2008)a747519e553a3532075e0f30517175ee93cdc93ce6ed448ab1ac7e912521b412GrammarDB-RELEASE-2026010.9012111python -m pip install "huggingface_hub>=0.34,<2" "safetensors>=0.5,<1" \
2 "torch>=2.7,<3" "transformers>=4.50,<5"huggingface-cli login1from huggingface_hub import snapshot_download
2
3model_dir = snapshot_download("fosters/homograph-bel-xlm-roberta-base")
4
5# inference.py is included in the downloaded model repository.
6import sys
7sys.path.insert(0, model_dir)
8from inference import HomographResolver
9
10resolver = HomographResolver.from_pretrained(model_dir, device="cpu")
11
12text = "Найталенавіцейшы музыка і паэт."
13start = text.index("музыка")
14result = resolver.predict(text, start, start + len("музыка"))
15
16print(result["stressed_form"]) # музы́ка
17print(result["confidence"])
18print(result["status"]) # okdevice="mps" can be used when the installed PyTorch build supports MPS.
Use device="cuda" on a CUDA host.1examples = [
2 ("Найталенавіцейшы музыка і паэт.", "музыка"),
3 ("Нават калі музыка ідзе фанаграмай.", "музыка"),
4 ("Але гэта вучыць цябе дысцыпліне, адказнасці.", "вучыць"),
5]
6
7for text, target in examples:
8 start = text.index(target)
9 prediction = resolver.predict(text, start, start + len(target))
10 print(target, "->", prediction["stressed_form"], prediction["confidence"])музы́ка, му́зыка, and ву́чыць.text[target_start:target_end] must equal the target.fosters/homograph-bel-contextual-v1.
It contains the exact prepared train, silver-validation, gold-validation, and gold-test
splits, the canonical dictionary, preparation manifest, and quality report.| Split | Contexts | Homographs | Observed variants | Label quality |
|---|---|---|---|---|
| Train | 102,029 | 1,941 | 2,896 | 2,128 gold; 18,390 silver-high; 81,511 silver-medium |
| Silver validation | 5,134 | 1,027 | 1,397 | Model-labelled diagnostic set |
| Gold validation | 275 | 28 | 43 | Human-reviewed |
| Gold test | 538 | 28 | 43 | Human-reviewed, reserved for final evaluation |
status; do not treat unsupported_homograph or unsupported_variant as
an automatic decision.license: other pending a final legal/provenance review.metadata.json, finetuning-v1.toml, the tokenizer, encoder config,
runtime dictionary, support index, and safetensors checkpoint. The checkpoint SHA-256 is
a72c3a5155a3cd5f926b4f34f9d743966ace4c466b7d76eb20b50e437c7d645c.