text_model/data.py
def read_wembed_hdf5(wembed_file, name="word_embeddings"):
    """
    Read word embedding from HDF5 file.

    Args:
        name: name of hdf5 dataset.
    """
    import h5py
    print("Reading word embeddings from hdf5 file: %s" % (wembed_file))
    with h5py.File(wembed_file, 'r') as fin:
        dataset = fin[name]
        embeddings = np.zeros([dataset.shape[0], dataset.shape[1]], dtype=NP_DTYPE)
        embeddings = dataset[...]
    print("Read word embeddings finished, vocab_size=%d, dim=%d" % \
          (embeddings.shape[0], embeddings.shape[1]))
    return embeddings

    Read word embedding from HDF5 file.

    Args:
        name: name of hdf5 dataset.
    
Read word embedding from HDF5 file.
Read word embedding from HDF5 file .
def read_wembed_hdf5(wembed_file, name="word_embeddings"):
    import h5py
    print("Reading word embeddings from hdf5 file: %s" % (wembed_file))
    with h5py.File(wembed_file, 'r') as fin:
        dataset = fin[name]
        embeddings = np.zeros([dataset.shape[0], dataset.shape[1]], dtype=NP_DTYPE)
        embeddings = dataset[...]
    print("Read word embeddings finished, vocab_size=%d, dim=%d" % \
          (embeddings.shape[0], embeddings.shape[1]))
    return embeddings
def read_wembed_hdf5 ( wembed_file , name = "word_embeddings" ) : import h5py print ( "Reading word embeddings from hdf5 file: %s" % ( wembed_file ) ) with h5py . File ( wembed_file , 'r' ) as fin : dataset = fin [ name ] embeddings = np . zeros ( [ dataset . shape [ 0 ] , dataset . shape [ 1 ] ] , dtype = NP_DTYPE ) embeddings = dataset [ ... ] print ( "Read word embeddings finished, vocab_size=%d, dim=%d" % ( embeddings . shape [ 0 ] , embeddings . shape [ 1 ] ) ) return embeddings
Read word embedding from HDF5 file.
Read word embedding from HDF5 file .
"""
    Read word embedding from HDF5 file.

    Args:
        name: name of hdf5 dataset.
    """
wembed_file
name
name of hdf5 dataset.
name of hdf5 dataset .