File size: 2,264 Bytes
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
---
license: apache-2.0
---
# 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')])
```