-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtoJapanese2.Rd
70 lines (61 loc) · 2.49 KB
/
toJapanese2.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/to_lang2.R
\name{toJapanese2}
\alias{toJapanese2}
\title{Translate texts into Japanese using DeepL API Free}
\usage{
toJapanese2(
text,
source_lang = NULL,
split_sentences = TRUE,
preserve_formatting = FALSE,
get_detect = FALSE,
auth_key = "your_key"
)
}
\arguments{
\item{text}{character vector to be translated. Only UTF8-encoded plain text is supported.
An element can contain several sentences, but should not exceed 30kbytes.}
\item{source_lang}{language of the text to be translated. If parameter \code{is.null}, the API
guesses the language of the source. If input is of length 1, the same source language is
applied to all elements.}
\item{split_sentences}{if \code{TRUE}, the translation engine splits the input into sentences.
If only one sentence is translated, it is recommended to set to \code{FALSE} to prevent
the engine from unintentionally splitting the sentence.}
\item{preserve_formatting}{if \code{TRUE}, the translation engine tries to preserve some aspects
(e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning
of the sentence) of the formatting.}
\item{get_detect}{if \code{TRUE}, the language detected for the source text is included in
the response.}
\item{auth_key}{Authentication key.}
}
\value{
If \code{get_detect} is set to \code{FALSE} a \code{character vector} containing the
translation is returned. Otherwise, a (\code{tibble}) is returned with the following columns:
\itemize{
\item \code{translation} the translated text.
\item \code{source_lang} detected or specified language of the input text.
}
}
\description{
\code{toJapanese2} translates a text from an available language into Japanese
using DeepL API Free. Use \code{available_languages2} to list all supported languages.
An authentication key is required to use this service. With the DeepL API Free package,
developers can translate up to 500,000 characters per month for free.
}
\details{
To get an authentication key, you need to register for a DeepL API Free
account (\url{https://www.deepl.com/pro#developer}).
}
\examples{
\dontrun{
# Translate a single text
toJapanese2("Hallo Welt!", auth_key = "my_key")
# Translate multiple texts and return the detected language
texts <- c("My name is Fred.", "Je suis médecin.", "Ich komme aus der Schweiz.")
toJapanese2(texts, get_detect = T, auth_key = "x")
}
}
\references{
\href{https://www.deepl.com/pro#developer}{DeepL API documentations}
}