mindspore.dataset.text.FastText

class mindspore.dataset.text.FastText[source]

FastText object that is used to map tokens into vectors.

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

Build a FastText vector from a file.

Parameters
  • file_path (str) – Path of the file that contains the vectors. The shuffix of pre-trained vector sets must be *.vec.

  • 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

>>> fast_text = text.FastText.from_file("/path/to/fast_text/file", max_vectors=None)