getSpeller: Create a new speller object

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/aspell.R

Description

To check the spelling of a word, one needs a speller instance. A speller instance has information about which dictionaries to use, what filters to apply to eliminate words, what suggestsions to make for misspelled words, etc. Each speller instance is independent of the others and this allows one to use separate spellers for each document or reuse an existing speller for multiple documents. This function returns an opaque reference to the C-level speller instance.

Usage

1
getSpeller(conf = createSpellConfig(), class = "AspellSpeller")

Arguments

conf

the configuration object to use for this speller. As with spellers, one might create a single configuration and reuse it to create multiple spellers.

class

the name of the class that is instantiated with the external pointer inserted into its ref slot. This allows the caller to create different classes of objects easily rather than by coercion after the creation.

Value

An object of class AspellSpeller-class.

Author(s)

Duncan Temple Lang <duncan@wald.ucdavis.edu>

References

http://aspell.sourceforge.net

See Also

aspell getSpellConfig createSpellConfig

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 speller  = getSpeller()

 words = unlist(strsplit(as.character(packageDescription("Aspell")),  "[[:space:][:punct:]]"))
 words = unique(words[words != ""])

 check = aspell(words, FALSE, speller = speller)

  # proportion of words spelled correctly
 sum(check)/length(check)

 words[!check]

omegahat/Aspell documentation built on May 24, 2019, 1:50 p.m.