Learn R Programming

⚠️There's a newer version (1.6.0) of this package.Take me there.

polyglotr

R package to translate text.

Overview

The polyglotr package is a language translation tool for the R programming language. It provides convenient functions to translate text using different (free) translation services. This vignette will guide you through the usage of the package and demonstrate how to translate text and files in various languages.

Currently, the package has functions to communicate with the following services:

Features

To see which functions are available, please refer to the reference page of the polyglotr package. The reference page provides a comprehensive list of functions available in the package, organized by category.

Additionally, the package includes vignettes that provide more detailed information on how to use the functions in the package.

Installation

To install the package:

# The easiest way is to get polyglotr from CRAN
install.packages("polyglotr")

# Alternatively, install the development version from GitHub
# install.packages("remotes")
remotes::install_github("Tomeriko96/polyglotr")

Usage

To demonstrate the usage of the polyglotr package, let's consider an example where we translate a list of texts into multiple languages using the create_translation_table function.

texts <- c("Hello, how are you?", 
           "I love programming!", 
           "This is a test.")

languages <- c("es", 
              "fr", 
              "de")


create_translation_table(texts, languages)


#>        Original_word                     es
#> 1 Hello, how are you?     ¿Hola, cómo estás?
#> 2 I love programming! ¡Me encanta programar!
#> 3     This is a test.    Esto es una prueba.
#>                           fr                       de
#> 1 Bonjour comment allez-vous?   Hallo, wie geht's dir?
#> 2        J'adore programmer ! Ich liebe Programmieren!
#> 3              C'est un test.        Das ist ein Test.

Copy Link

Version

Install

install.packages('polyglotr')

Monthly Downloads

744

Version

1.5.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Tomer Iwan

Last Published

August 23rd, 2024

Functions in polyglotr (1.5.2)

translate_file

Translate File
linguee_word_translation

Translate word using Linguee Translation API
qcri_translate_text

QCRI Translate Text
qcri_get_language_pairs

QCRI Get Language Pairs
translate_to_morse

Translate Text to Morse Code using the FunTranslations API
microsoft_supported_languages

Get the set of languages currently supported by the Microsoft Translator API
wmcloud_translate

Translate content using WMCloud
wikimedia_detect_language

Detect the language of a text
translate_to_morse_audio

Translate English Text to Morse Code with Audio
pons_translate

Translate text using PONS
google_transliterate

Transliterate a single word or a sentence to the required language.
google_get_supported_languages

Get Supported Languages
google_is_valid_language_code

Check if a language code is valid
create_transliteration_table

Create a Transliteration Table
google_supported_languages

Google Supported Languages
google_translate

Translate text using google translate
create_translation_table

Create a Translation Table
google_translate_long_text

Translate long text using Google Translate
language_detect

Detect Language using Google Translate API
batch_translate

Batch Translation Function
linguee_external_sources

Retrieve external sources using Linguee Translation API
qcri_api_key

Get the QCRI API key from the environment variable
pons_dictionaries

Get the list of available dictionaries from PONS API
linguee_translation_examples

Provide translation examples using Linguee Translation API
qcri_get_domains

QCRI Get Domains
mymemory_translate

Translate text using mymemory translate
wikipedia_get_language_names

Get language names
%>%

Pipe operator