Description Usage Arguments Author(s) References See Also Examples
This is a simple and primitive interface to using the aspell library for spell checking an entire document. This allows the caller to provide a function to respond to each mis-spelled word. This function can attempt to predict the appropriate word or can prompt the user to select a word. These two approaches are possible using the basic mechanisms in R and Aspell.
The methods for this generic function work for connections
by “slurping” the entire text via readLines
and passing the resulting string into the regular spellDoc
function.
1 | spellDoc(doc, wordHandler = DocSpeller(), checker = docChecker(speller), speller = getSpeller(conf), conf = createSpellConfig())
|
doc |
the identifier for a document. This is the name of
a file, text giving the contents of the file or a connection object
from which we can read the contents via |
wordHandler |
a function that is called for each word that aspell identifies as mis-spelled. The function is called with the word (perhaps with surrounding whitespace), the token giving the offset and length of the word with respect ot the document, the text of the document itself, and the speller object which can be used to lookup suggestions for the mis-spelled words. |
checker |
an object of class |
speller |
a |
conf |
a |
Duncan Temple Lang <duncan@wald.ucdavis.edu>
1 2 3 4 5 6 7 8 | # Create a simple configuration
conf = createSpellConfig()
# Add HTML as a filter
conf$"add-filter" = "html"
# spell check the document TODO.html
spellDoc(system.file("TODO.html", package = "Aspell"), function(word, tok, txt, ...) print(word), conf = conf)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.