Interface to 'TexTra' from R

A wrapper for the 'TexTra' API < https://mt-auto-minhon-mlt.ucri.jgn-x.jp/>, a web service for translating texts between different languages. 'TexTra' API account is required to use the service.


textrar

The goal of textrar is to translate texts with TexTra easily.

https://mt-auto-minhon-mlt.ucri.jgn-x.jp/

Installation

You can install from GitHub with:

  # install.packages("remotes")
remotes::install_github("matutosi/textrar")

You can also install from CRAN:

install.packages("textrar")

Example

You can use textra() to translate texts with textra easily.

Store your credentials in the user .Renviron file, which usethis::edit_r_environ() opens, and restart R. Keeping them out of your scripts keeps them out of version control.

TEXTRA_API_KEY=your_api_key
TEXTRA_API_SECRET=your_api_secret
TEXTRA_NAME=your_login_id
library(textrar)

params <- gen_params()

text <- "Hello world"
translated <- textra(text, params, model = "transLM", from = "en", to = "it")
translated
 ## [1] "Ciao mondo"

You can also pass the credentials explicitly, for example when you keep them somewhere else.

key <- "abcdefghijklmnopqrstuvw01234567890abcdef1" # API key
secret <- "xyzabcdefghijklmnopqrstuvw012345"       # API secret
name <- "login_ID"                                 # login_ID
params <- gen_params(key = key, secret = secret, name = name)

Citation

Toshikazu Matsumura (2024) textrar. Interface to TexTra from R. https://github.com/matutosi/textrar/

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("textrar")

0.9.0 by Toshikazu Matsumura, 2 months ago


https://github.com/matutosi/textrar, https://matutosi.github.io/textrar/


Browse source code at https://github.com/cran/textrar


Authors: Toshikazu Matsumura [aut, cre] (ORCID:


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports jsonlite, httr

Suggests knitr, rmarkdown, spelling, testthat, withr


See at CRAN