Ukrainian homograph cross-encoder (v19-v10)
0
2 commits
1 linked in READMEs
updated Sep 25, 2026
v19-v10)Scores how well a gloss fits one occurrence of an ambiguous Ukrainian word. The pipeline scores every candidate reading of the word, takes the best one, and so gets the word's stress: за́мок "castle" or замо́к "lock", бо́ку or боку́.
⟦ ⟧."<stressed form>: <definition>".from transformers import AutoTokenizer, AutoModelForSequenceClassification
tok = AutoTokenizer.from_pretrained("aloudreader/uk-stress-crossencoder")
model = AutoModelForSequenceClassification.from_pretrained("aloudreader/uk-stress-crossencoder").eval()
pairs = [("Старий ⟦замок⟧ стоїть на горі.", "за́мок: Укріплене житло феодала доби середньовіччя з оборонними, господарськими, культовими і т. ін. будівлями, зазвичай оточене високим кам'яним муром із кількома вежами. Великий поміщицький будинок; палац."),
("Старий ⟦замок⟧ стоїть на горі.", "замо́к: Пристрій для замикання дверей у приміщеннях, дверцят шафи, скринь, шухляд і т. ін. На замку бути — бути замкненим; бути недоступним для ворогів, добре охоронятися.")]
enc = tok([a for a, _ in pairs], [b for _, b in pairs], return_tensors="pt", padding=True)
print(model(**enc).logits.squeeze(-1)) # higher = better fit
The candidate senses, their glosses and stress signatures come from the serving manifest. It covers 15,203 forms and ships with the model as serving_manifest.json. Forms outside the manifest are not scored.
xlm-roberta-base:
v3-xenc, on 12,351 mined, sense-labelled sentences;v19-v10, on 463,867 rows.v19-v10:
As a single tier, taking the lexicon's first reading where it abstains:
It is strongest on semantic homographs, where the two readings differ in meaning (а́тлас / атла́с). In the pipeline, morphology decides grammatical alternations (се́ла / села́) and the token classifier decides frequent forms. The cross-encoder mainly answers forms that neither of those covers.
Ukrainian homograph cross-encoder (v19-v10)
0
2 commits
1 linked in READMEs
updated Sep 25, 2026
v19-v10)Scores how well a gloss fits one occurrence of an ambiguous Ukrainian word. The pipeline scores every candidate reading of the word, takes the best one, and so gets the word's stress: за́мок "castle" or замо́к "lock", бо́ку or боку́.
⟦ ⟧."<stressed form>: <definition>".from transformers import AutoTokenizer, AutoModelForSequenceClassification
tok = AutoTokenizer.from_pretrained("aloudreader/uk-stress-crossencoder")
model = AutoModelForSequenceClassification.from_pretrained("aloudreader/uk-stress-crossencoder").eval()
pairs = [("Старий ⟦замок⟧ стоїть на горі.", "за́мок: Укріплене житло феодала доби середньовіччя з оборонними, господарськими, культовими і т. ін. будівлями, зазвичай оточене високим кам'яним муром із кількома вежами. Великий поміщицький будинок; палац."),
("Старий ⟦замок⟧ стоїть на горі.", "замо́к: Пристрій для замикання дверей у приміщеннях, дверцят шафи, скринь, шухляд і т. ін. На замку бути — бути замкненим; бути недоступним для ворогів, добре охоронятися.")]
enc = tok([a for a, _ in pairs], [b for _, b in pairs], return_tensors="pt", padding=True)
print(model(**enc).logits.squeeze(-1)) # higher = better fit
The candidate senses, their glosses and stress signatures come from the serving manifest. It covers 15,203 forms and ships with the model as serving_manifest.json. Forms outside the manifest are not scored.
xlm-roberta-base:
v3-xenc, on 12,351 mined, sense-labelled sentences;v19-v10, on 463,867 rows.v19-v10:
As a single tier, taking the lexicon's first reading where it abstains:
It is strongest on semantic homographs, where the two readings differ in meaning (а́тлас / атла́с). In the pipeline, morphology decides grammatical alternations (се́ла / села́) and the token classifier decides frequent forms. The cross-encoder mainly answers forms that neither of those covers.