def load_from_file ( cls , filename_prefix ) : filename = cls . _filename ( filename_prefix ) lines , _ = cls . _read_lines_from_file ( filename ) # Strip wrapping single quotes vocab_list = [ line [ 1 : - 1 ] for line in lines ] return cls ( vocab_list = vocab_list )
how to pick out vocab of a file python
Extracts list of subwords from file .
def load_from_file(cls, filename_prefix):
    """Extracts list of subwords from file."""
    filename = cls._filename(filename_prefix)
    lines, _ = cls._read_lines_from_file(filename)
    # Strip wrapping single quotes
    vocab_list = [line[1:-1] for line in lines]
    return cls(vocab_list=vocab_list)