Calculates Word Mover's Distance as described in From Word Embeddings To Document Distances by Matt Kusner, Yu Sun, Nicholas Kolkin and Kilian Weinberger.
⚠️ This package is currently only compatible with spaCy v.1x.
import spacy import wmd nlp = spacy.load('en', create_pipeline=wmd.WMD.create_spacy_pipeline) doc1 = nlp("Politician speaks to the media in Illinois.") doc2 = nlp("The president greets the press in Chicago.") print(doc1.similarity(doc2))
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.