EVOLUTION-MANAGER
Edit File: aspell.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Spell Check Interface</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for aspell {utils}"><tr><td>aspell {utils}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Spell Check Interface</h2> <h3>Description</h3> <p>Spell check given files via Aspell, Hunspell or Ispell. </p> <h3>Usage</h3> <pre> aspell(files, filter, control = list(), encoding = "unknown", program = NULL, dictionaries = character()) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>files</code></td> <td> <p>a character vector with the names of files to be checked.</p> </td></tr> <tr valign="top"><td><code>filter</code></td> <td> <p>an optional filter for processing the files before spell checking, given as either a function (with formals <code>ifile</code> and <code>encoding</code>), or a character string specifying a built-in filter, or a list with the name of a built-in filter and additional arguments to be passed to it. See <b>Details</b> for available filters. If missing or <code>NULL</code>, no filtering is performed.</p> </td></tr> <tr valign="top"><td><code>control</code></td> <td> <p>a list or character vector of control options for the spell checker.</p> </td></tr> <tr valign="top"><td><code>encoding</code></td> <td> <p>the encoding of the files. Recycled as needed.</p> </td></tr> <tr valign="top"><td><code>program</code></td> <td> <p>a character string giving the name (if on the system path) or full path of the spell check program to be used, or <code>NULL</code> (default). By default, the system path is searched for <code>aspell</code>, <code>hunspell</code> and <code>ispell</code> (in that order), and the first one found is used.</p> </td></tr> <tr valign="top"><td><code>dictionaries</code></td> <td> <p>a character vector of names or file paths of additional R level dictionaries to use. Elements with no path separator specify R system dictionaries (in subdirectory ‘<span class="file">share/dictionaries</span>’ of the R home directory). The file extension (currently, only ‘<span class="file">.rds</span>’) can be omitted.</p> </td></tr> </table> <h3>Details</h3> <p>The spell check programs employed must support the so-called Ispell pipe interface activated via command line option <span class="option">-a</span>. In addition to the programs, suitable dictionaries need to be available. See <a href="http://aspell.net">http://aspell.net</a>, <a href="http://hunspell.sourceforge.net/">http://hunspell.sourceforge.net/</a> and <a href="http://lasr.cs.ucla.edu/geoff/ispell.html">http://lasr.cs.ucla.edu/geoff/ispell.html</a>, respectively, for obtaining the Aspell, Hunspell and (International) Ispell programs and dictionaries. </p> <p>The currently available built-in filters are <code>"Rd"</code> (corresponding to <code><a href="../../tools/html/RdTextFilter.html">RdTextFilter</a></code>), <code>"Sweave"</code> (corresponding to <code><a href="../../tools/html/SweaveTeXFilter.html">SweaveTeXFilter</a></code>), <code>"R"</code>, <code>"pot"</code>, <code>"dcf"</code> and <code>"md"</code>. </p> <p>Filter <code>"R"</code> is for R code and extracts the message string constants in calls to <code><a href="../../base/html/message.html">message</a></code>, <code><a href="../../base/html/warning.html">warning</a></code>, <code><a href="../../base/html/stop.html">stop</a></code>, <code><a href="../../base/html/message.html">packageStartupMessage</a></code>, <code><a href="../../base/html/gettext.html">gettext</a></code>, <code><a href="../../base/html/sprintf.html">gettextf</a></code>, and <code><a href="../../base/html/gettext.html">ngettext</a></code> (the unnamed string constants for the first five, and <code>fmt</code> and <code>msg1</code>/<code>msg2</code> string constants, respectively, for the latter two). </p> <p>Filter <code>"pot"</code> is for message string catalog ‘<span class="file">.pot</span>’ files. Both have an argument <code>ignore</code> allowing to give regular expressions for parts of message strings to be ignored for spell checking: e.g., using <code>"[ \t]'[^']*'[ \t[:punct:]]"</code> ignores all text inside single quotes. </p> <p>Filter <code>"dcf"</code> is for files in Debian Control File format. The fields to keep can be controlled by argument <code>keep</code> (a character vector with the respective field names). By default, <span class="samp">Title</span> and <span class="samp">Description</span> fields are kept. </p> <p>Filter <code>"md"</code> is for files in <a href="https://en.wikipedia.org/wiki/Markdown">Markdown</a> format (‘<span class="file">.md</span>’ and ‘<span class="file">.Rmd</span>’ files), and needs packages <a href="https://CRAN.R-project.org/package=commonmark"><span class="pkg">commonmark</span></a> and <a href="https://CRAN.R-project.org/package=xml2"><span class="pkg">xml2</span></a> to be available. </p> <p>The print method for the objects returned by <code>aspell</code> has an <code>indent</code> argument controlling the indentation of the positions of possibly mis-spelled words. The default is 2; Emacs users may find it useful to use an indentation of 0 and visit output in grep-mode. It also has a <code>verbose</code> argument: when this is true, suggestions for replacements are shown as well. </p> <p>It is possible to employ additional R level dictionaries. Currently, these are files with extension ‘<span class="file">.rds</span>’ obtained by serializing character vectors of word lists using <code><a href="../../base/html/readRDS.html">saveRDS</a></code>. If such dictionaries are employed, they are combined into a single word list file which is then used as the spell checker's personal dictionary (option <span class="option">-p</span>): hence, the default personal dictionary is not used in this case. </p> <h3>Value</h3> <p>A data frame inheriting from <code>aspell</code> (which has a useful print method) with the information about possibly mis-spelled words. </p> <h3>References</h3> <p>Kurt Hornik and Duncan Murdoch (2011), Watch your spelling! <em>The R Journal</em> <b>3</b>(2), 22–28. <a href="https://journal.r-project.org/archive/2011-2/RJournal_2011-2_Hornik+Murdoch.pdf">https://journal.r-project.org/archive/2011-2/RJournal_2011-2_Hornik+Murdoch.pdf</a>. </p> <h3>See Also</h3> <p><a href="aspell-utils.html">aspell-utils</a> for utilities for spell checking packages. </p> <p>Package <span class="pkg">Aspell</span> on Omegahat (<a href="http://www.omegahat.net/Aspell">http://www.omegahat.net/Aspell</a>) for a fine-grained R interface to the Aspell library. </p> <h3>Examples</h3> <pre> ## Not run: ## To check all Rd files in a directory, (additionally) skipping the ## \references sections. files <- Sys.glob("*.Rd") aspell(files, filter = list("Rd", drop = "\\references")) ## To check all Sweave files files <- Sys.glob(c("*.Rnw", "*.Snw", "*.rnw", "*.snw")) aspell(files, filter = "Sweave", control = "-t") ## To check all Texinfo files (Aspell only) files <- Sys.glob("*.texi") aspell(files, control = "--mode=texinfo") ## End(Not run) ## List the available R system dictionaries. Sys.glob(file.path(R.home("share"), "dictionaries", "*.rds")) </pre> <hr /><div style="text-align: center;">[Package <em>utils</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>