unnest_sentences_: Split a column of text into sentences

View source: R/unnest_sentences.R

unnest_sentences_R Documentation

Split a column of text into sentences

Description

Split a column of text into sentences

Usage

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)

Arguments

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

Value

A data.frame of parsed sentences and sentence ids

Examples


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)

AdamSpannbauer/lexRankr documentation built on Dec. 9, 2022, 3:44 a.m.