sentenceParse: Parse text into sentences

Description Usage Arguments Value Examples

Description

Parse the elements of a character vector into a dataframe of sentences with additional identifiers.

Usage

1
sentenceParse(text, docId = "create")

Arguments

text

Character vector to be parsed into sentences

docId

A vector of document IDs with length equal to the length of text. If docId == "create" then doc IDs will be created as an index from 1 to n, where n is the length of text.

Value

A data frame with 3 columns and n rows, where n is the number of sentences found by the routine. Column 1: docId document id for the sentence. Column 2: sentenceId sentence id for the sentence. Column 3: sentence the sentences found in the routine.

Examples

1
2
3
sentenceParse("Bill is trying to earn a Ph.D.", "You have to have a 5.0 GPA.")
sentenceParse(c("Bill is trying to earn a Ph.D.", "You have to have a 5.0 GPA."),
               docId=c("d1","d2"))

Example output

                        docId                    sentenceId
1 You have to have a 5.0 GPA. You have to have a 5.0 GPA._1
                        sentence
1 Bill is trying to earn a Ph.D.
  docId sentenceId                       sentence
1    d1       d1_1 Bill is trying to earn a Ph.D.
2    d2       d2_1    You have to have a 5.0 GPA.

lexRankr documentation built on May 2, 2019, 1:29 p.m.