AspellConfig-class {Aspell}R Documentation

Classes for representing opaque data types in the aspell library.

Description

These classes are used to provide R objects that refer to C-level data structures in the native aspell library. These provide access to the configuration facilities for aspell, the word speller itself and the higher-level document speller.

The AspellConfig class provides syntactic sugar for accessing options in the underlying configuration object. One can use the \$ and [ operators to retrieve the value of one (\$) or several ([) named elements in a single call. This treats the configuration object like a list or vector. One can also assign a value to an option using conf$option <- value.

The AspellSpeller also provides syntactic sugar for accessing properties and functionality of the speller. The \$ operator allows one to setup a call to spell check one or more words, e.g. sp$spell("duncan"). Similarly, one can also retrieve the AspellConfig object associated with a speller via sp$config. Also, one can get the word lists associated with a speller using sp$session, sp$personal and sp$main. And finally, one can save the word lists associated with the speller using sp$save().

One can also add words to the acceptably spelled words and replacement/suggestion words for teaching the speller for the future. sp$session = c("duncan", "Aspell") and sp$personal = c("duncan", "SJava") are examples of assigning new words to existing word lists. Note that this appends to that list. To add to the replacement list, use sp$correct <- c(missplledword = "correct version", ....)

Objects from the Class

Objects can be constructed via createSpellConfig, getSpeller, and docChecker.

Slots

ref:
Object of class "externalptr". Each class is merely a reference to a C-level data structure. The C-code provides a way to validate the pointer type.

Methods

$
these operators provide syntactic convenience for using the configuration and speller objects.

Author(s)

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

References

http://aspell.sourceforge.net

See Also

createSpellConfig, getSpeller, docChecker

Examples


 sp = getSpeller()

 sp$config

 sp$personal
 sp$session

 sp$session <- c("Omegahat", "AspellConfig")

 sp$save()
 sp$spell("Omegahat")

 sp$correct  <- c("duncn" = "duncan")

[Package Aspell version 0.2-0 Index]