Created
October 5, 2019 23:54
-
-
Save colinpollock/c555ea2b88866e0187b94c3d9e542cba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spacy | |
nlp = spacy.load('en_vectors_web_lg') | |
text1 = 'The medical field is moving forward rapidly.' | |
text2 = 'Medicine is vital to the industry.' | |
text3 = 'Reggie Miller is a basketball player.' | |
doc1 = nlp(text1) | |
doc2 = nlp(text2) | |
doc3 = nlp(text3) | |
for doc in (doc2, doc3): | |
print(doc1.similarity(doc)) | |
# Prints out: | |
# 0.8917278032126783 | |
# .616120289899652 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment