File size: 2,988 Bytes
732b48b
 
64594a6
 
fa43853
 
 
 
 
 
 
732b48b
a54420f
732b48b
a54420f
732b48b
a54420f
732b48b
a54420f
732b48b
4c795c8
 
 
 
 
 
 
 
 
 
 
 
732b48b
 
 
 
 
 
 
a8a150f
 
732b48b
a8a150f
 
732b48b
 
 
 
 
 
 
 
 
 
 
 
 
a8a150f
 
732b48b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
license: apache-2.0
widget:
 - text: "arrive at the bank of a river or the shore of a lake or sea</s><s>to reach a place, especially at the end of a journey"
   example_title: "arriver (fr) - gen."
 - text: "The set of food items that are used to make meals at home.</s><s>The flesh of an animal used as food."
   example_title: "meat (en) - spec."  
 - text: "to make someone slightly angry or upset</s><s>to talk or act in a way that makes someone lose interest"
   example_title: "aborrecer (sp/pt) - co-hyp." 
 - text: "very poor or inferior in quality or standard; not good or well in any manner or degree</s><s>very exceptionally good or impressive, especially in a surprising or ingenious way"
   example_title: "bad (en) - auto-anton."
---
# 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)

<b> Citation </b>

```
@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')])
```