Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- path= r'C:\Users\vrozenbaum\Documents\Inter_POC\IACC\clust'
- #tagging the files
- class DocIterator(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):
- yield TaggedDocument(words=doc.split(), tags=[self.labels_list[idx]])
- labels = [f for f in listdir(path) if f.endswith('-out.csv')]
- print(labels)
- data = []
- for doc in labels:
- data.append(open(join(path, doc), 'r',errors='ignore').read())
- it = DocIterator(data, labels)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement