mindspore.dataset.text.Vectors

class mindspore.dataset.text.Vectors[source]

Vectors object that is used to map tokens into vectors.

classmethod from_file(file_path, max_vectors=None)[source]

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.

Returns

Vectors, Vectors build from a file.

Raises

Examples

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