From 115297f597c98efad034173800d231df32a1a657 Mon Sep 17 00:00:00 2001 From: Erik de Vries Date: Mon, 12 Aug 2019 13:50:31 +0200 Subject: [PATCH] actor_aggregation,aggregator,aggregator_elastic: moved out of package directory to Old actor_fetcher: moved sentiment validation code block --- {R => Old}/actor_aggregation.R | 0 {R => Old}/aggregator.R | 0 {R => Old}/aggregator_elastic.R | 0 R/actor_fetcher.R | 11 ++++++----- 4 files changed, 6 insertions(+), 5 deletions(-) rename {R => Old}/actor_aggregation.R (100%) rename {R => Old}/aggregator.R (100%) rename {R => Old}/aggregator_elastic.R (100%) diff --git a/R/actor_aggregation.R b/Old/actor_aggregation.R similarity index 100% rename from R/actor_aggregation.R rename to Old/actor_aggregation.R diff --git a/R/aggregator.R b/Old/aggregator.R similarity index 100% rename from R/aggregator.R rename to Old/aggregator.R diff --git a/R/aggregator_elastic.R b/Old/aggregator_elastic.R similarity index 100% rename from R/aggregator_elastic.R rename to Old/aggregator_elastic.R diff --git a/R/actor_fetcher.R b/R/actor_fetcher.R index 02e7923..972c045 100644 --- a/R/actor_fetcher.R +++ b/R/actor_fetcher.R @@ -97,6 +97,12 @@ actor_fetcher <- function(out, sent_dict = NULL, cores = 1, localhost = NULL, va ) out_row <- select(out_row, -`_source.ud`) } + + if (validation == T) { + codes_sent <- filter(ud_sent, sentence_id == out_row$`_source.codes.sentence.id`[1]) + return(cbind(out_row, codes = codes_sent)) + } + ### Unnest out_row to individual actor ids out_row <- out_row %>% unnest(`_source.computerCodes.actorsDetail`, .preserve = colnames(.)) %>% @@ -152,11 +158,6 @@ actor_fetcher <- function(out, sent_dict = NULL, cores = 1, localhost = NULL, va ) out_row <- bind_rows(lapply(seq(1,nrow(out_row),1),sent_scorer, out_row = out_row, ud_sent = ud_sent)) %>% cbind(., text = text_sent) - if (validation == T) { - codes_sent <- filter(ud_sent, sentence_id == out_row$`_source.codes.sentence.id`[1]) %>% - select(-sentence_id) - out_row <- cbind(out_row, codes = codes_sent) - } } out_row <- out_row %>% mutate(