Description Usage Arguments Examples
Train word embeddings from a training corpus with the additional ability to obtain word vectors for out-of-vocabulary words.
1 2 3 |
... |
Any option, from the official documentation. |
file |
Path to a saved model. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | docs <- prepare_documents(corpus)
# fit model
ft <- model_fasttext(size = 4L, window = 3L, min_count = 1L)
# build vocabulary
ft$build_vocab(sentences = unname(docs))
# train
ft$train(sentences = unname(docs), total_examples = length(docs), epochs = 10L)
# most similar
ft$wv$most_similar(positive = c('computer', 'human'), negative = c('interface'))
# odd one out
ft$wv$doesnt_match(c("human", "computer", "interface", "tree"))
# similarity score
ft$wv$similarity('computer', 'human')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.