Skip to content

Similarity using Sense2Vec along with Spacy #53

@armsp

Description

@armsp

I am not able to leverage the similarity examples from the blog or issue #24 to my case. I just wanted to get the "sense" of "bear" i.e Homonyms in an example like "The bear growled. She could not bear the pain."

import spacy
nlp = spacy.load("en_core_web_md")
from sense2vec import Sense2VecComponent
text = "The bear growled. She could not bear the pain."
s2v = Sense2VecComponent('./reddit_vectors-1.1.0')
nlp.add_pipe(s2v)
doc = nlp(text)

After this i can't get any official reference for the similarity API that took two vectors. I have tried with the following but i get errors-

s2v._.similarity(doc[1]._.s2v_vec,doc[6]._.s2v_vec)
nlp._.similarity(doc[1]._.s2v_vec,doc[6]._.s2v_vec)

Metadata

Metadata

Assignees

No one assigned

    Labels

    usageGeneral usage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions