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