| Title: | Translate R Help Pages to Chinese with 'DeepSeek' |
|---|---|
| Description: | Renders on-the-fly Simplified-Chinese translations of R help pages in the help pane of 'RStudio' or 'Positron', using the 'DeepSeek' chat model with reasoning (thinking mode) disabled for fast, low-cost, clean output. Works as a drop-in replacement for ? and help(). Translations are cached on disk. |
| Authors: | Xing Shi [aut, cre] |
| Maintainer: | Xing Shi <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.3.5 |
| Built: | 2026-11-25 18:29:30 UTC |
| Source: | https://github.com/cran/deephelp |
Translate and display an R help page in Chinese
deephelp(topic, package = NULL, lang = NULL, type = NULL, ...)deephelp(topic, package = NULL, lang = NULL, type = NULL, ...)
topic |
A name or character string specifying the help topic. |
package |
Optional package name. If 'NULL', loaded packages are searched. |
lang |
Target language. Defaults to the value set via [deephelp_use()]. |
type |
Output type: '"html"' (default, opens the translated page in the Help pane of RStudio or Positron) or '"text"' (prints plain text). |
... |
Currently ignored. |
An object of class '"deephelp_topic"', a list with components 'topic', 'package', 'rd' (the parsed, translated Rd object) and 'type'. It has a 'print()' method that renders the translated help page. On error, the call falls back to [utils::help()] and returns its value instead.
Clear the translation cache
deephelp_clear_cache(cache = NULL)deephelp_clear_cache(cache = NULL)
cache |
Cache directory to clear. Defaults to the current cache location. |
Invisibly 'NULL'. Called for its side effect of deleting the on-disk translation cache.
Disable automatic translation of '?' and 'help()'
deephelp_off()deephelp_off()
Invisibly 'FALSE'. Called for its side effect of disabling automatic translation.
Enable automatic translation of '?' and 'help()'
deephelp_on()deephelp_on()
Invisibly 'TRUE'. Called for its side effect of enabling automatic translation and attaching the '?'/'help()' shims.
Translate fuzzy help-search results ('??', 'help.search')
deephelp_search(pattern, package = NULL, ...)deephelp_search(pattern, package = NULL, ...)
pattern |
Keyword pattern to search for. |
package |
Optional package name to restrict the search. |
... |
Passed to [utils::help.search()]. |
The value returned by [utils::help.search()], an object of class '"help_files_with_topic"' (a list including the 'matches' data frame), with the 'Title' column of 'matches' translated to the target language.
Print the current configuration
deephelp_status()deephelp_status()
Invisibly, the current configuration as a named list. Called for its side effect of printing the configuration.
deephelp_status()deephelp_status()
Configure the DeepSeek backend
deephelp_use( api_key = NULL, model = NULL, base_url = NULL, lang = NULL, cache = NULL, temperature = NULL, max_tokens = NULL, timeout = NULL, cjk_spacing = NULL, glossary = NULL )deephelp_use( api_key = NULL, model = NULL, base_url = NULL, lang = NULL, cache = NULL, temperature = NULL, max_tokens = NULL, timeout = NULL, cjk_spacing = NULL, glossary = NULL )
api_key |
DeepSeek API key. Falls back to 'getOption("deephelp.api_key")' and then the 'DEEPSEEK_API_KEY' environment variable. |
model |
Model name. Defaults to '"deepseek-flash"' (fast, cheap, non-reasoning). Use '"deepseek-v4-pro"' for higher quality at higher cost. |
base_url |
API base URL. Defaults to '"https://api.deepseek.com"'. |
lang |
Target language. Defaults to Simplified Chinese. |
cache |
Cache directory. 'NULL' uses the default location; '""' disables caching; otherwise a directory path. |
temperature |
Optional sampling temperature passed to the API. |
max_tokens |
Optional maximum number of output tokens. |
timeout |
HTTP timeout in seconds. |
cjk_spacing |
Logical. Insert consistent single spaces between Chinese and Latin letters/digits (and around code) in the translated output. Defaults to 'TRUE'. |
glossary |
Named character vector mapping English statistical terms to Chinese translations. Merged over the built-in glossary; use 'character(0)' to disable the glossary entirely. |
Invisibly, the updated configuration as a named list. Called for its side effect of updating the stored configuration and printing the new status via [deephelp_status()].