I embedding the sentences using the BERT model in the code below. I want the BERT model to pay more attention to one word in sentence embedding. One way that seems to me is to add the desired word to the end of the sentence. For example, if I want to add more attention to the word car in the sentence “My car is dirty”, I will add this word at the end of the sentence. “my car is dirty car”
Is there a better solution?
from sentence_transformers import SentenceTransformer en_model = SentenceTransformer('bert-base-uncased') mbedding_vectors = en_model.encode("My car is dirty")