text_plain_output_1.png
import csv

import gensim

with open('../input/tokenized-words-cord19-challenge/data.csv', newline='') as f:
    reader = csv.reader(f)
    data = list(reader)

model2 = gensim.models.Word2Vec(data, min_count=1, size=100, window=5, sg=1)

def truncate(n, decimals=0):
    multiplier = 10 ** decimals
    return int(n * multiplier) / multiplier
print('Cosine similarity using Skip Gram model between:')
a = truncate(model2.similarity('risk', 'smoking'), 2)
b = truncate(model2.similarity('risk', 'heart'), 2)
c = truncate(model2.similarity('risk', 'pregnant'), 2)
d = truncate(model2.similarity('risk', 'cancer'), 2)
e = truncate(model2.similarity('risk', 'diabetes'), 2)
f = truncate(model2.similarity('risk', 'age'), 2)
g = truncate(model2.similarity('risk', 'asthma'), 2)
h = truncate(model2.similarity('risk', 'HIV'), 2)
i = truncate(model2.similarity('risk', 'transplant'), 2)
j = truncate(model2.similarity('risk', 'obesity'), 2)
k = truncate(model2.similarity('risk', 'immunocompromised'), 2)
l = truncate(model2.similarity('risk', 'underweight'), 2)
m = truncate(model2.similarity('risk', 'liver'), 2)
n = truncate(model2.similarity('risk', 'bronchitis'), 2)
o = truncate(model2.similarity('risk', 'COPD'), 2)
print('risk and smoking : ', a)
print('risk and heart : ', b)
print('risk and pregnant  : ', c)
print('risk and cancer : ', d)
print('risk and diabetes : ', e)
print('risk and age : ', f)
print('risk and asthma : ', g)
print('risk and HIV : ', h)
print('risk and transplant : ', i)
print('risk and obesity : ', j)
print('risk and immunocompromised : ', k)
print('risk and underweight : ', l)
print('risk and liver : ', m)
print('risk and bronchitis : ', n)
print('risk and COPD : ', o)