I am trying to ascertain how semantically inter-related the items within a given list are. For example, for the following list of nouns, I would like to have the average similarity score across every possible pair (without doing so manually pair by pair, as written also below).
wordlist=['molds', 'brick', 'pipe', 'hand', 'iron']
doc1 = nlp("molds")
doc2 = nlp("brick")
Similarity of two documents
print(doc1, "<->", doc2, doc1.similarity(doc2))
I assume that there is some way to do this through loops, however I am still a beginner to Python so I am struggling to think what the syntax would be. Any suggestions would be greatly appreciated!
Thanks,
Juan