The Similarity Method
Let's see how we can use spaCy to calculate the semantic similairty.
In spaCy, every container type object has a similarity method that allows us to calculate the semantic similarity of other container objects by comparing their word vectors.
We can calculate the semantic similarity between two container objects, even though they are different types of containers. For instance, we can compare a Token
object to a Doc
object and a Doc
object to a Span
object. The following example computes how similar two Span
objects are:
Get hands-on with 1400+ tech skills courses.