cosine-similarity

How to compare sentence similarities using embeddings from BERT

How to compare sentence similarities using embeddings from BERT Question: I am using the HuggingFace Transformers package to access pretrained models. As my use case needs functionality for both English and Arabic, I am using the bert-base-multilingual-cased pretrained model. I need to be able to compare the similarity of sentences using something such as cosine …

Total answers: 5

Calculate cosine similarity given 2 sentence strings

Calculate cosine similarity given 2 sentence strings Question: From Python: tf-idf-cosine: to find document similarity , it is possible to calculate document similarity using tf-idf cosine. Without importing external libraries, are that any ways to calculate cosine similarity between 2 strings? s1 = “This is a foo bar sentence .” s2 = “This sentence is …

Total answers: 8