Learn R Programming

syuzhet (version 1.0.6)

get_sentences: Sentence Tokenization

Description

Parses a string into a vector of sentences.

Usage

get_sentences(text_of_file, fix_curly_quotes = TRUE, as_vector = TRUE)

Value

A Character Vector of Sentences

Arguments

text_of_file

A Text String

fix_curly_quotes

logical. If TRUE curly quotes will be converted to ASCII representation before splitting.

as_vector

If TRUE the result is unlisted. If FALSE the result stays as a list of the original text string elements split into sentences.

Examples

Run this code
(x <- c(paste0(
    "Mr. Brown comes! He says hello. i give him coffee.  i will ",
    "go at 5 p. m. eastern time.  Or somewhere in between!go there"
),
paste0(
    "Marvin K. Mooney Will You Please Go Now!", "The time has come.",
    "The time has come. The time is now. Just go. Go. GO!",
    "I don't care how."
)))

get_sentences(x)
get_sentences(x, as_vector = FALSE)


Run the code above in your browser using DataLab