# NOT RUN {
df <- data.frame(doc_id = 1:3,
text = c("Testing the system. Second sentence for you.",
"System testing the tidy documents df.",
"Documents will be parsed and lexranked."),
stringsAsFactors = FALSE)
# }
# NOT RUN {
library(magrittr)
df %>%
unnest_sentences(sents, text) %>%
bind_lexrank(sents, doc_id, level = "sentences")
df %>%
unnest_sentences(sents, text) %>%
bind_lexrank_("sents", "doc_id", level = "sentences")
df <- data.frame(doc_id = c(1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
2, 2, 2, 3, 3, 3, 3, 3, 3),
sent_id = c(1, 1, 1, 2, 2, 2, 2, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1),
tokens = c("testing", "the", "system", "second",
"sentence", "for", "you", "system",
"testing", "the", "tidy", "documents",
"df", "documents", "will", "be", "parsed",
"and", "lexranked"),
stringsAsFactors = FALSE)
df %>%
bind_lexrank(tokens, doc_id, sent_id, level = 'tokens')
# }
Run the code above in your browser using DataLab