Views
No views yet
sentence-transformers model trained to embed word senses using definitions from WordNet. It maps a word in context (e.g., "I sat on the bank") to the same vector space as its definition.distilbert-base-uncasedmarksverdhei/wordnet-definitions-en-2021word_pooling.py code to load it.pip install sentence-transformersword_pooling.py from this repository.WordSenseTransformer class.1from word_pooling import WordSenseTransformer
2
3# Load from Hugging Face Hub
4model = WordSenseTransformer("marksverdhei/wordnet-sense-embedding")
5
6# Define inputs with the format: "'<word>': <context>"
7sentences = [
8 "'bank': I sat on the river bank.",
9 "'bank': I deposited money at the bank."
10]
11
12embeddings = model.encode(sentences)
13
14# Compare with definitions
15definitions = [
16 "'bank': A sloping land (especially the slope beside a body of water).",
17 "'bank': A financial institution that accepts deposits."
18]
19def_embeddings = model.encode(definitions)
20
21# Compute similarity...