--- license: apache-2.0 widget: - text: "arrive at the bank of a river or the shore of a lake or seato reach a place, especially at the end of a journey" example_title: "arriver (fr)" --- # Cross-Encoder for Word-Sense Relationship Classification This model has been trained on word sense relations extracted from WordNet. The model can be used to detect what kind of relationships (among homonymy, antonymy, hypernonymy, hyponymy, and co-hyponymy) occur between word senses: Given a pair of word sense definitions, predict the sense relationship (homonymy, antonymy, hypernonymy, hyponymy, and co-hyponymy). The training code can be found here: [https://github.com/ChangeIsKey/change-type-classification](https://github.com/ChangeIsKey/change-type-classification) Citation ``` @inproceedings{change_type_classification_cassotti_2024, author = {Pierluigi Cassotti and Stefano De Pascale and Nina Tahmasebi}, title = {Using Synchronic Definitions and Semantic Relations to Classify Semantic Change Types}, year = {2024}, } ``` ## Usage with Transformers ```python from transformers import AutoTokenizer, AutoModelForSequenceClassification import torch model = AutoModelForSequenceClassification.from_pretrained('ChangeIsKey/change-type-classifier') tokenizer = AutoTokenizer.from_pretrained('ChangeIsKey/change-type-classifier') features = tokenizer([['to quickly take something in your hand(s) and hold it firmly', 'to understand something, especially something difficult'], ['To move at a leisurely and relaxed pace, typically by foot', 'To move or travel, irrespective of the mode of transportation']], padding=True, truncation=True, return_tensors="pt") model.eval() with torch.no_grad(): scores = model(**features).logits print(scores) ``` ## Usage with SentenceTransformers The usage becomes easier when you have [SentenceTransformers](https://www.sbert.net/) installed. Then, you can use the pre-trained models like this: ```python from sentence_transformers import CrossEncoder model = CrossEncoder('ChangeIsKey/change-type-classifier', max_length=512) labels = model.predict([('to quickly take something in your hand(s) and hold it firmly', 'to understand something, especially something difficult'), ('To move at a leisurely and relaxed pace, typically by foot', 'To move or travel, irrespective of the mode of transportation')]) ```