зеркало из https://github.com/microsoft/wpa.git
refactor: remove widyr dependency
This commit is contained in:
Родитель
6386f99651
Коммит
9b74d2175f
14
R/tm_cooc.R
14
R/tm_cooc.R
|
@ -26,15 +26,16 @@
|
|||
#' @import ggplot2
|
||||
#' @import ggraph
|
||||
#' @importFrom igraph graph_from_data_frame
|
||||
#' @importFrom widyr pairwise_count
|
||||
#' @importFrom tidytext unnest_tokens
|
||||
#'
|
||||
#' @family Text-mining
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' tm_cooc(mt_data,lmult = 0.01)
|
||||
#' }
|
||||
#' # Demo using a subset of `mt_data`
|
||||
#' mt_data %>%
|
||||
#' dplyr::slice(1:20) %>%
|
||||
#' tm_cooc(lmult = 0.01)
|
||||
#'
|
||||
#' @export
|
||||
tm_cooc <- function(data,
|
||||
stopwords = NULL,
|
||||
|
@ -50,10 +51,7 @@ tm_cooc <- function(data,
|
|||
# Calculate frequency of pairs
|
||||
title_word_pairs <-
|
||||
text_df %>%
|
||||
widyr::pairwise_count(word,
|
||||
line,
|
||||
sort = TRUE,
|
||||
upper = FALSE)
|
||||
pairwise_count(id = "line", word = "word")
|
||||
|
||||
# Graph networks
|
||||
set.seed(seed)
|
||||
|
|
|
@ -29,9 +29,11 @@ There is an option to remove stopwords by passing a data frame into the \code{st
|
|||
argument.
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
tm_cooc(mt_data,lmult = 0.01)
|
||||
}
|
||||
# Demo using a subset of `mt_data`
|
||||
mt_data \%>\%
|
||||
dplyr::slice(1:20) \%>\%
|
||||
tm_cooc(lmult = 0.01)
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other Text-mining:
|
||||
|
|
Загрузка…
Ссылка в новой задаче