Esempio n. 1
0
 def read_texts(self):
     for file in os.listdir("."):
         stuff = read_files(file)
         if not stuff:
             continue
         text = stuff[1].split()
         for word in text:
             self.word_counts[word] +=1
         self.all_texts.append(text)
def build_data_frame(file, classification):
    rows = []
    index = []
    file_name, text = read_files(file)
    rows.append({'text': text, 'class': classification})
    index.append(file_name)

    data_frame = DataFrame(rows, index=index)
    return data_frame