Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement