Advertisement
Guest User

Untitled

a guest
Oct 24th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. import spacy
  2.  
  3. nlp = spacy.load('en_vectors_web_lg')
  4.  
  5. text1 = 'The medical field is moving forward rapidly.'
  6. text2 = 'Medicine is vital to the industry.'
  7. text3 = 'Reggie Miller is a basketball player.'
  8.  
  9. doc1 = nlp(text1)
  10. doc2 = nlp(text2)
  11. doc3 = nlp(text3)
  12.  
  13. for doc in (doc2, doc3):
  14. print(doc1.similarity(doc))
  15.  
  16. # Prints out:
  17. # 0.8917278032126783
  18. # .616120289899652
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement