Universe

spaCy - sentence-transformers

Pipelines for pretrained sentence-transformers (BERT, RoBERTa, XLM-RoBERTa & Co.) directly within spaCy

This library lets you use the embeddings from sentence-transformers of Docs, Spans and Tokens directly from spaCy. Most models are for the english language but three of them are multilingual.

Example

import spacy_sentence_bert # load one of the models listed at https://github.com/MartinoMensio/spacy-sentence-bert/ nlp = spacy_sentence_bert.load_model('en_roberta_large_nli_stsb_mean_tokens') # get two documents doc_1 = nlp('Hi there, how are you?') doc_2 = nlp('Hello there, how are you doing today?') # use the similarity method that is based on the vectors, on Doc, Span or Token print(doc_1.similarity(doc_2[0:7]))
Author info

Martino Mensio

GitHubMartinoMensio/spacy-sentence-bert

Categories models pipeline

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