Skip to contents

Loads a previously saved embeddings matrix from an RDS file and attaches it to the corpus. Only embeddings for works present in the corpus are loaded; mismatches are reported.

Usage

sm_embed_load(corpus, path, call = rlang::caller_env())

Arguments

corpus

An sm_corpus object.

path

Character; file path to read embeddings from (an .rds file created by sm_embed_save()).

call

Caller environment for error reporting.

Value

The input corpus with corpus$embeddings updated.

See also

Examples

if (FALSE) { # \dontrun{
corpus <- sm_example_corpus(with_embeddings = FALSE)
corpus <- sm_embed_load(corpus, "my_embeddings.rds")
dim(corpus$embeddings)
} # }