Ejemplo n.º 1
0
 def __iter__(self):
     files = {filename[:-4] for filename in os.listdir(self.dirname)}
     for doc_id, fname in enumerate(files):
         d = Document(doc_id, os.path.join(self.dirname,
                                           fname + '.txt'))
         for sentence in d.read_sentences():
             yield sentence
Ejemplo n.º 2
0
 def __iter__(self):
     files = {filename[:-4] for filename in os.listdir(self.dirname)}
     for doc_id, fname in enumerate(files):
         print(str(doc_id) + '||||' + fname)  #这句是我加的,查看读取的文件进度,否则等的心急
         d = Document(doc_id, os.path.join(self.dirname,
                                           fname + '.txt'))
         for sentence in d.read_sentences():
             yield sentence
Ejemplo n.º 3
0
 def __iter__(self):
     files = {filename[:-4] for filename in os.listdir(self.dirname)}
     for doc_id, fname in enumerate(files):
         d = Document(doc_id, os.path.join(self.dirname, fname + '.txt'))
         for sentence in d.read_sentences():
             yield sentence