Learn R Programming

sylcount (version 0.2-6)

doc_counts: doc_counts

Description

Computes some basic document counts (see the 'Value' section below for details).

The function is vectorized by document, and scores are computed in parallel via OpenMP. You can control the number of threads used with the nthreads parameter.

Usage

doc_counts(s, nthreads = sylcount.nthreads())

Value

A dataframe containing:

charsthe total numberof characters
wordcharsthe number of alphanumeric characters
wordstext tokens that are probably English language words
nonwordstext tokens that are probably not English language words
sentsthe number of sentences recognized in the text
syllsthe total number of syllables (ignores all non-words)
polysthe total number of "polysyllables", or words with 3+ syllables

Arguments

s

A character vector (vector of strings).

nthreads

Number of threads to use. By default it will use the total number of cores + hyperthreads.

Details

The function is essentially just readability() without the readability scores.

See Also

readability

Examples

Run this code
library(sylcount)
a <- "I am the very model of a modern major general."
b <- "I have information vegetable, animal, and mineral."

doc_counts(c(a, b), nthreads=1)

Run the code above in your browser using DataLab