Apply the trained model to new sentences. Average word embeddings and search most similar label vector.

# S3 method for Rcpp_fastrtext
predict(object, sentences, k = 1, ...)

Arguments

object

trained fastText model

sentences

character containing the sentences

k

will return the k most probable labels (default = 1)

...

not used

Value

list containing for each sentence the probability to be associated with k labels.

Examples

library(fastrtext) data("test_sentences") model_test_path <- system.file("extdata", "model_classification_test.bin", package = "fastrtext") model <- load_model(model_test_path) sentence <- test_sentences[1, "text"] print(predict(model, sentence))
#> [[1]] #> __label__OWNX #> 0.9980469 #>