View source: R/embed-all-the-things.R
starspace_dictionary | R Documentation |
Get the dictionary of a Starspace model
starspace_dictionary(object)
object |
an object of class |
a list with elements
ntokens: The number of tokens in the data
nwords: The number of words which are part of the dictionary
nlabels: The number of labels which are part of the dictionary
labels: A character vector with the labels
dictionary_size: The size of the dictionary (nwords + nlabels)
dictionary: A data.frame with all the words and labels from the dictionary. This data.frame has columns term, is_word and is_label indicating for each term if it is a word or a label
data(dekamer, package = "ruimtehol")
dekamer <- subset(dekamer, depotdat < as.Date("2017-02-01"))
dekamer$text <- strsplit(dekamer$question, "\\W")
dekamer$text <- lapply(dekamer$text, FUN = function(x) x[x != ""])
dekamer$text <- sapply(dekamer$text,
FUN = function(x) paste(x, collapse = " "))
dekamer$question_theme_main <- gsub(" ", "-", dekamer$question_theme_main)
set.seed(123456789)
model <- embed_tagspace(x = tolower(dekamer$text),
y = dekamer$question_theme_main,
early_stopping = 0.8,
dim = 10, minCount = 5)
dict <- starspace_dictionary(model)
str(dict)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.