write.word2vec | R Documentation |
Save a word2vec model as a binary file to disk or as a text file
write.word2vec(x, file, type = c("bin", "txt"), encoding = "UTF-8")
x |
an object of class |
file |
the path to the file where to store the model |
type |
either 'bin' or 'txt' to write respectively the file as binary or as a text file. Defaults to 'bin'. |
encoding |
encoding to use when writing a file with type 'txt' to disk. Defaults to 'UTF-8' |
a logical indicating if the save process succeeded
word2vec
path <- system.file(package = "word2vec", "models", "example.bin")
model <- read.word2vec(path)
## Save the model to hard disk as a binary file
path <- "mymodel.bin"
write.word2vec(model, file = path)
## Save the model to hard disk as a text file (uses package udpipe)
library(udpipe)
path <- "mymodel.txt"
write.word2vec(model, file = path, type = "txt")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.