actorizer: fixed handling of empty results due to regex filtering

master
Erik de Vries 5 years ago
parent 8e920f5f37
commit a29d04dacd

@ -83,7 +83,7 @@ actorizer <- function(out, localhost = F, ids, prefix, postfix, pre_tags, post_t
} else { } else {
sentence_ids <- actor_sentences sentence_ids <- actor_sentences
} }
if (length(sentence_ids > 0)) {
# Generating nested sentence start and end positions for actor sentences # Generating nested sentence start and end positions for actor sentences
ud <- ud %>% ud <- ud %>%
filter(sentence_id %in% sentence_ids) filter(sentence_id %in% sentence_ids)
@ -102,7 +102,7 @@ actorizer <- function(out, localhost = F, ids, prefix, postfix, pre_tags, post_t
sentence_start = list(sentence_start), sentence_start = list(sentence_start),
sentence_end = list(sentence_end) sentence_end = list(sentence_end)
) )
if (length(ud$doc_id > 0)) {
return( return(
data.frame(ud, # Sentence id, start and end position for actor sentences data.frame(ud, # Sentence id, start and end position for actor sentences
actor_start = I(list(actor_start)), # List of actor ud token start positions actor_start = I(list(actor_start)), # List of actor ud token start positions

Loading…
Cancel
Save