Description Usage Arguments Examples
Sentence is splitted in words (using space characters), and word embeddings are averaged.
1 | get_sentence_representation(model, sentences)
|
model |
|
sentences |
character containing the sentences |
1 2 3 4 5 | library(fastrtext)
model_test_path <- system.file("extdata", "model_unsupervised_test.bin", package = "fastrtext")
model <- load_model(model_test_path)
m <- get_sentence_representation(model, "this is a test")
print(m)
|
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 0.04612118 0.07081816 -0.07836571 -0.03498457 -0.1260475 -0.03846126
[,7] [,8] [,9] [,10] [,11] [,12]
[1,] -0.05836035 0.02865069 -0.05015307 -0.002549595 0.125826 0.09850598
[,13] [,14] [,15] [,16] [,17] [,18]
[1,] 0.03725819 -0.204474 -0.1268664 0.09527765 0.0002416307 -0.04993055
[,19] [,20] [,21] [,22] [,23] [,24]
[1,] -0.05817759 -0.07298152 0.0365562 0.04674883 0.07480677 0.01359343
[,25] [,26] [,27] [,28] [,29] [,30]
[1,] 0.1026248 -0.001181135 -0.04816237 0.04646675 -0.08025771 -0.01841679
[,31] [,32] [,33] [,34] [,35] [,36]
[1,] -0.03391957 -0.08540537 0.002494644 0.03391271 -0.1044328 0.09995933
[,37] [,38] [,39] [,40] [,41] [,42]
[1,] 0.01462616 0.04985919 -0.1210374 0.08914699 0.02266166 -0.01673295
[,43] [,44] [,45] [,46] [,47] [,48]
[1,] 0.1396751 0.03683152 -0.03243222 -0.06931502 -0.08348826 -0.2490283
[,49] [,50] [,51] [,52] [,53] [,54]
[1,] 0.1284788 -0.05054322 -0.005058374 -0.0004271297 -0.05233428 -0.06522101
[,55] [,56] [,57] [,58] [,59] [,60]
[1,] -0.02700687 0.05636992 -0.06143151 0.06006534 -0.01606821 -0.1515405
[,61] [,62] [,63] [,64] [,65] [,66]
[1,] -0.07340391 -0.0851608 0.1319344 -0.03932073 -0.02184493 0.06531155
[,67] [,68] [,69] [,70]
[1,] 0.0173919 0.05111243 0.07462564 0.09093123
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.