Views
No views yet
FacebookAI/xlm-roberta-large. It embeds a target word in its sentence context: the target
span is wrapped in <t> … </t> markers, and two usages are compared by cosine
similarity. A pair is predicted to share a sense when cosine similarity exceeds
the stored threshold.threshold.json).1# from https://github.com/... (contrastive_encoder_training)
2from word_transformer import load_model, predict_pairs
3
4model, threshold_info = load_model("french") # local dir or hub id
5pairs = [{
6 "sentence1": "They walked along the bank of the river.",
7 "sentence2": "She deposited the check at the bank.",
8 "start1": 22, "end1": 26, # exclusive end: sentence1[22:26] == "bank"
9 "start2": 21, "end2": 25,
10}]
11predictions, cosine_sims = predict_pairs(model, threshold_info["threshold"], pairs)
12# predictions[i] == 1 -> same sense, 0 -> different sense| base model | FacebookAI/xlm-roberta-large |
| language | French |
| paper | Multilinguality Does not Make Sense (EMNLP 2025) |
| threshold | 0.7097 |
| validation accuracy | 0.7831 |
encode() (target-word embedding), so it is not
a drop-in SentenceTransformer; load it with the word_transformer.py helper
above.