I have recently started with NLP. As part of cosine similarities calculation I have to complete the following task:
# Convert the sentences into bag-of-words vectors.
sent_1 = dictionary.doc2bow(sent_1)
sent_2 = dictionary.doc2bow(sent_2)
sent_3 = dictionary.doc2bow(sent_3)
I have more than 10000 different sentences (documents), so I want to generete a code which iterates automatically over documents. I have tried the following but it does not work:
sent_X = []
for i in documents:
sent_X .append(dictionary.doc2bow(simple_preprocess(i)))
Thanks