View source: R/unnest_sentences.R
unnest_sentences_ | R Documentation |
Split a column of text into sentences
unnest_sentences_(tbl, output, input, doc_id = NULL, output_id = "sent_id", drop = TRUE) unnest_sentences(tbl, output, input, doc_id = NULL, output_id = "sent_id", drop = TRUE)
tbl |
dataframe containing column of text to be split into sentences |
output |
name of column to be created to store parsed sentences |
input |
name of input column of text to be parsed into sentences |
doc_id |
column of document ids; if not provided it will be assumed that each row is a different document |
output_id |
name of column to be created to store sentence ids |
drop |
whether original input column should get dropped |
A data.frame of parsed sentences and sentence ids
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) unnest_sentences(df, sents, text) unnest_sentences_(df, "sents", "text") ## Not run: library(magrittr) df %>% unnest_sentences(sents, text) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.