def load_txt_sent(flist_txt, subset_pct):
 total_size = sum(map(os.path.getsize, flist_txt))
 subset_size = int(((subset_pct / 100.0) * total_size))
 all_sent = []
 for txt_file in flist_txt:
  if (subset_size > 0):
   with open(txt_file, 'r') as f:
    data = f.read(subset_size)
   subset_size -= sys.getsizeof(data)
   sent = data.split('\n')
   if (subset_size <= 0):
    sent = sent[:(-1)]
   all_sent += sent
 return all_sent

def load_txt_sent ( flist_txt , subset_pct ) : total_size = sum ( map ( os . path . getsize , flist_txt ) ) subset_size = int ( ( ( subset_pct / 100.0 ) * total_size ) ) all_sent = [ ] for txt_file in flist_txt : if ( subset_size > 0 ) : with open ( txt_file , 'r' ) as f : data = f . read ( subset_size ) subset_size -= sys . getsizeof ( data ) sent = data . split ( '\n' ) if ( subset_size <= 0 ) : sent = sent [ : ( - 1 ) ] all_sent += sent return all_sent
load all the senteces from a list of txt files using standard file io .