Universe

sense2vec

Use NLP to go beyond vanilla word2vec

sense2vec (Trask et. al, 2015) is a nice twist on word2vec that lets you learn more interesting, detailed and context-sensitive word vectors. For an interactive example of the technology, see our sense2vec demo that lets you explore semantic similarities across all Reddit comments of 2015.

Example

import spacy from sense2vec import Sense2VecComponent nlp = spacy.load('en') s2v = Sense2VecComponent('/path/to/reddit_vectors-1.1.0') nlp.add_pipe(s2v) doc = nlp(u"A sentence about natural language processing.") assert doc[3].text == u'natural language processing' freq = doc[3]._.s2v_freq vector = doc[3]._.s2v_vec most_similar = doc[3]._.s2v_most_similar(3) # [(('natural language processing', 'NOUN'), 1.0), # (('machine learning', 'NOUN'), 0.8986966609954834), # (('computer vision', 'NOUN'), 0.8636297583580017)]

View more
Author info

Explosion AI

GitHubexplosion/sense2vec

Categories pipeline standalone visualizers

Submit your project

If you have a project that you want the spaCy community to make use of, you can suggest it by submitting a pull request to the spaCy website repository. The Universe database is open-source and collected in a simple JSON file. For more details on the formats and available fields, see the documentation. Looking for inspiration your own spaCy plugin or extension? Check out the project idea label on the issue tracker.

Read the docsJSON source