aspell-utils {utils} | R Documentation |
Spell Check Utilities
Description
Utilities for spell checking packages via Aspell, Hunspell or Ispell.
Usage
aspell_package_Rd_files(dir,
drop = c("\\abbr", "\\acronym",
"\\author", "\\references"),
control = list(), program = NULL,
dictionaries = character())
aspell_package_vignettes(dir,
control = list(), program = NULL,
dictionaries = character())
aspell_package_R_files(dir, ignore = character(), control = list(),
program = NULL, dictionaries = character())
aspell_package_C_files(dir, ignore = character(), control = list(),
program = NULL, dictionaries = character())
aspell_write_personal_dictionary_file(x, out, language = "en",
program = NULL)
Arguments
dir |
a character string specifying the path to a package's root directory. |
drop |
a character vector naming additional Rd sections to drop
when selecting text via |
control |
a list or character vector of control options for the spell checker. |
program |
a character string giving the name (if on the system
path) or full path of the spell check program to be used, or
|
dictionaries |
a character vector of names or file paths of
additional R level dictionaries to use. See |
ignore |
a character vector with regular expressions to be replaced by blanks when filtering the message strings. |
x |
a character vector, or the result of a call to
|
out |
a character string naming the personal dictionary file to write to. |
language |
a character string indicating a language as used by Aspell. |
Details
Functions aspell_package_Rd_files
,
aspell_package_vignettes
, aspell_package_R_files
and
aspell_package_C_files
perform spell checking on the Rd files,
vignettes, R files, and C-level messages of the package with root
directory dir
. They determine the respective files, apply the
appropriate filters, and run the spell checker.
See aspell
for details on filters.
The C-level message string are obtained from the
‘po/PACKAGE.pot’ message catalog file, with PACKAGE
the basename of dir
.
See the section on ‘C-level messages’ in
‘Writing R Extensions’ for more information.
When using Aspell, the vignette checking skips parameters and/or
options of commands \Sexpr
, \citep
, \code
,
\pkg
, \proglang
and \samp
(in addition to the
what the Aspell TeX/LaTeX filter skips by default). Further
commands can be skipped by adding --add-tex-command
options to
the control
argument. E.g., to skip both option and parameter
of \mycmd
, add --add-tex-command='mycmd op'
.
Suitable values for control
, program
,
dictionaries
, drop
and ignore
can also be
specified using a package defaults file which should go as
‘defaults.R’ into the ‘.aspell’ subdirectory of dir
,
and provides defaults via assignments of suitable named lists, e.g.,
vignettes <- list(control = "--add-tex-command='mycmd op'")
for vignettes (when using Aspell) and similarly assigning to
Rd_files
, R_files
and C_files
for Rd files, R
files and C level message defaults.
Maintainers of packages using both English and American spelling will find it convenient to pass control options --master=en_US and --add-extra-dicts=en_GB to Aspell and control options -d en_US,en_GB to Hunspell (provided that the corresponding dictionaries are installed).
Older versions of R had no support for R level dictionaries, and
hence provided the function
aspell_write_personal_dictionary_file
to create (spell check)
program-specific personal dictionary files from words to be accepted.
The new mechanism is to use R level dictionaries, i.e., ‘.rds’
files obtained by serializing character vectors of such words using
saveRDS
. For such dictionaries specified via the
package defaults mechanism, elements with no path separator can be R
system dictionaries or dictionaries in the ‘.aspell’
subdirectory.