orkgnlp.clustering.encoders.TfidfKmeansEncoder

class TfidfKmeansEncoder(vectorizer)[source]

Bases: ORKGNLPBaseEncoder

The TfidfKmeansEncoder encodes the given input to a TF-IDF vector needed to execute a Kmeans onnx model.

Parameters

vectorizer (ModelProto) – The TF-IDF vectorizer needed for the encoding.

Methods

encode

Encodes the raw_input to a model-friendly format.

release_memory

Releases the memory of all available attributes in a pipeline component.

encode(raw_input, **kwargs)[source]

Encodes the raw_input to a model-friendly format.

Parameters

raw_input (Any) – The user’s input to be encoded.

Return type

Tuple[Any, Dict[str, Any]]

Returns

The model-friendly output and kwargs.

release_memory()

Releases the memory of all available attributes in a pipeline component.