nsentence: count the number of sentences

Description Usage Arguments Value Note Examples

View source: R/nfunctions.R

Description

Return the count of sentences in a corpus or character object.

Usage

1

Arguments

x

a character or corpus whose sentences will be counted

...

additional arguments passed to tokens

Value

count(s) of the total sentences per text

Note

nsentence() relies on the boundaries definitions in the stringi package (see stri_opts_brkiter). It does not count sentences correctly if the text has been transformed to lower case, and for this reason nsentence() will issue a warning if it detects all lower-cased text.

Examples

1
2
3
4
5
# simple example
txt <- c(text1 = "This is a sentence: second part of first sentence.",
         text2 = "A word. Repeated repeated.",
         text3 = "Mr. Jones has a PhD from the LSE.  Second sentence.")
nsentence(txt)

Example output

quanteda version 0.9.9.65
Disabling parallel computing

Attaching package: 'quanteda'

The following object is masked from 'package:utils':

    View

text1 text2 text3 
    1     2     2 

quanteda documentation built on May 29, 2017, 11:37 p.m.

Search within the quanteda package
Search all R packages, documentation and source code