mindspore.dataset.text.GloVe
- class mindspore.dataset.text.GloVe[source]
GloVe object that is used to map tokens into vectors.
- classmethod from_file(file_path, max_vectors=None)[source]
Build a GloVe vector from a file.
- Parameters
file_path (str) – Path of the file that contains the vectors. The format of pre-trained vector sets must be glove.6B.*.txt.
max_vectors (int, optional) – This can be used to limit the number of pre-trained vectors loaded. Most pre-trained vector sets are sorted in the descending order of word frequency. Thus, in situations where the entire set doesn’t fit in memory, or is not needed for another reason, passing max_vectors can limit the size of the loaded set (default=None, no limit).
Examples
>>> glove = text.GloVe.from_file("/path/to/glove/file", max_vectors=None)