def tagged_document(list_of_list_of_words): for i, list_of_words in enumerate(list_of_list_of_words): yield Gensim.models.doc2vec.TaggedDocument(list_of_words, [i]) data_training = list(tagged_document(data))