fastText#

fastText is a lightweight text embedder developed at Meta.

Dependencies#

To use fastText in Vecworks additional dependencies need to be installed. You may do so using pip:

pip install vecworks[fasttext]

API#

class vecworks.vectorizers.fasttext.fastTextVectorizer#

Wrapper class to ease use of fastText-based vectorizers in Vecworks.

Interface#

__init__(model: str | fastTextModel, backend: Literal['fasttext', 'compress-fasttext'] = 'fasttext', output: Literal['word', 'sentence'] = 'sentence')#

Initializes the vectorizer.

Parameters#

model

Either file path to a FastText model to load, or a loaded FastText model.

backend

The FastText implementation to use, one of:

output

The kind of vector that needs to be generated, either a ‘word’ vector or a ‘sentence’ vector.

transform(input: Any | Iterable[Any]) ndarray | sparray | SparseArray#

Vectorizes the given data.

Parameters#

input

Data to vectorize.