(flist_txt, subset_pct)
return all_sent
load all the senteces from a list of txt files using standard file io
load all the senteces from a list of txt files using standard file io
load all the senteces from a list of txt files using standard file io
def load_txt_sent(flist_txt, subset_pct):
    """
    load all the senteces from a list of txt files using standard file io
    """
    # Subset dataset based on percentage of bytes
    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')
            # Discard the last sentence since it is most likely partial
            if subset_size <= 0:
                sent = sent[:-1]
            all_sent += sent

    return all_sent
def load_txt_sent ( flist_txt , subset_pct ) : # Subset dataset based on percentage of bytes 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' ) # Discard the last sentence since it is most likely partial if subset_size <= 0 : sent = sent [ : - 1 ] all_sent += sent return all_sent