class_update: added cores parameter for multicore processing of sources when using lemmas

master
Your Name 5 years ago
parent d9f936c566
commit a01a53f105

@ -18,9 +18,9 @@
################################################################################################# #################################################################################################
#################################### Update any kind of classification ########################## #################################### Update any kind of classification ##########################
################################################################################################# #################################################################################################
class_update <- function(out, localhost = T, model_final, varname, text, words, clean, ver, es_super = .rs.askForPassword('ElasticSearch WRITE')) { class_update <- function(out, localhost = T, model_final, varname, text, words, clean, ver, es_super = .rs.askForPassword('ElasticSearch WRITE'), cores = 1) {
print('updating') print('updating')
dfm <- dfm_gen(out, text = text, words = words, clean = clean) %>% dfm <- dfm_gen(out, text = text, words = words, clean = clean, cores = cores) %>%
dfm_weight(weights = model_final$idf) dfm_weight(weights = model_final$idf)
pred <- data.frame(id = out$`_id`, pred = predict(model_final$text_model, newdata = dfm, type = "class", force = T)) pred <- data.frame(id = out$`_id`, pred = predict(model_final$text_model, newdata = dfm, type = "class", force = T))
bulk <- apply(pred, 1, bulk_writer, varname = varname, type = 'set', ver = ver) bulk <- apply(pred, 1, bulk_writer, varname = varname, type = 'set', ver = ver)

Loading…
Cancel
Save