Sentence Similarity With Sentence-Transformers in Python

Опубликовано: 16 Октябрь 2024
на канале: James Briggs
32,317
598

🎁 Free NLP for Semantic Search Course:
https://www.pinecone.io/learn/nlp

Hard mode:    • Sentence Similarity With Transformers...  

All we ever seem to talk about nowadays are BERT this, BERT that. I want to talk about something else, but BERT is just too good  -  so this video will be about BERT for sentence similarity.

A big part of NLP relies on similarity in highly-dimensional spaces. Typically an NLP solution will take some text, process it to create a big vector/array representing said text - then perform several transformations.

It's highly-dimensional magic.

Sentence similarity is one of the clearest examples of how powerful highly-dimensional magic can be.

The logic is this:
Take a sentence, convert it into a vector.
Take many other sentences, and convert them into vectors.
Find sentences that have the smallest distance (Euclidean) or smallest angle (cosine similarity) between them - more on that here.
We now have a measure of semantic similarity between sentences - easy!

At a high level, there's not much else to it. But of course, we want to understand what is happening in a little more detail and implement this in Python too.

🤖 70% Discount on the NLP With Transformers in Python course:
https://bit.ly/3DFvvY5

Medium article:
https://towardsdatascience.com/bert-f...

🎉 Sign-up For New Articles Every Week on Medium!
  / membership  

📖 If membership is too expensive - here's a free link:
https://towardsdatascience.com/bert-f...

👾 Discord
  / discord  

🕹️ Free AI-Powered Code Refactoring with Sourcery:
https://sourcery.ai/?utm_source=YouTu...