Tagging documents for doc2vec
I've managed to write a function that iterates over it for me:

class TaggedDocumentIterator(object):
def __init__(self, doc_list, labels_list):
    self.labels_list = labels_list
    self.doc_list = doc_list
def __iter__(self):
    for idx, doc in enumerate(self.doc_list):
        for idy in enumerate(doc):
            yield TaggedDocument(words=idy[1].split(), tags=[str(self.labels_list[idx]) + '.' + str(doc.index(idy[1]))])



docLabels = list(range(len(texts)))
data = list(texts)
sentences = TaggedDocumentIterator(data, docLabels)