spec2vec.serialization.model_importing module¶
- class spec2vec.serialization.model_importing.Word2VecLight(model: dict, weights: Union[ndarray, csr_matrix, csc_matrix])[source]¶
Bases:
objectA lightweight version of
Word2Vec. The objects of this class follow the interface of the originalWord2Vecto the point necessary to calculate Spec2Vec scores. The model cannot be used for further training.- __init__(model: dict, weights: Union[ndarray, csr_matrix, csc_matrix])[source]¶
- Parameters
model – A dictionary containing the model’s metadata.
weights – A numpy array or a scipy sparse matrix containing the model’s weights.
- spec2vec.serialization.model_importing.import_model(model_file, weights_file) Word2VecLight[source]¶
Read a lightweight version of a
Word2Vecmodel from disk.- Parameters
model_file – A path of json file to load the model.
weights_file – A path of .npy file to load the model’s weights.
- Returns
Word2VecLight– a lightweight version of aWord2Vec