mindspore.dataset.text.Vectors

class mindspore.dataset.text.Vectors[源代码]

Vectors object that is used to map tokens into vectors.

classmethod from_file(file_path, max_vectors=None)[源代码]

Build a vector from a file.

Parameters
  • file_path (str) – Path of the file that contains the vectors.

  • 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

>>> vector = text.Vectors.from_file("/path/to/vectors/file", max_vectors=None)