Skip to content

Commit

Permalink
Fix a bug of wsi which may make word set with length less than n_topi…
Browse files Browse the repository at this point in the history
…clabel_words
  • Loading branch information
chainsawriot committed May 17, 2021
1 parent 0a935ff commit 44015e0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions R/oolong_tm.R
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@
.slice_sample <- function(x, n_topiclabel_words, n_correct_ws) {
res <- split(.safe_sample(x), ceiling(seq_along(x) / n_topiclabel_words))
names(res) <- NULL
## Filter out things that are not of the length n_topiclabel_words to prevent .safe_sample below select the last one
res <- res[purrr::map_lgl(res, ~length(.) == n_topiclabel_words)]
labels <- purrr::map_chr(res, ~(paste(., collapse = ", ")))
.safe_sample(labels, n_correct_ws)
}
Expand Down

0 comments on commit 44015e0

Please sign in to comment.