myanesp / libretranslateR

Binding to LibreTranslate API for R: translate, detect languages, obtain the available languages to translate from and to. Enhanced with a user-friendly wizard process.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libretranslateR

CodeFactor Project Status: Active - The project has reached a stable, usable state and is being actively developed. Github last-commit Github license

Connect to LibreTranslate API from R

API Docs | LibreTranslate GitHub Repository | Official instance | List of instances

Features

  • Translate texts, strings of R objects without leaving R using an opensource engine.
  • Automatically detect languages
  • It can connect to any LibreTranslate instance, so you're not tied to anything, even you can host your own!
  • As you can install your LibreTranslate instance, offline translation is available

Installation

This package is not yet available on CRAN. So you must install from GitHub using remotes package.

if (!require("remotes")) install.packages("remotes")
remotes::install_github("myanesp/libretranslateR")
# And then load into your current session
library(libretranslateR)

Examples and usage

set_config() # Config wizard for setting the instance you're going to use and your API key

translate(q = "hola, amigos", to = "en") # Autodetect language

translate(q = "hola", from = "es", to = "fr")

get_languages() # Display available languages

detect_language("do you know what i'm talking about?") # Detect language and the level of confidence

Install your own instance

You can follow the official instructions located at LibreTranslate's repository to host your own instance. You can do it through the Python's package or through a docker container.

Planned features

  • Support for translating files
  • Transform ISO names in get_languages() to real user-friendly names
  • Automatically detect if the chosen instance needs API or not
  • Rework and rethink config process

About

Binding to LibreTranslate API for R: translate, detect languages, obtain the available languages to translate from and to. Enhanced with a user-friendly wizard process.

License:GNU Affero General Public License v3.0


Languages

Language:R 100.0%