google_translate_long_text {polyglotr} | R Documentation |
Translate long text using Google Translate
Description
This function translates long text from one language to another using Google Translate. It splits the text into smaller chunks if necessary to handle large inputs.
Usage
google_translate_long_text(
text,
target_language = "en",
source_language = "auto",
chunk_size = 1000
)
Arguments
text |
The long text to translate. Should be a single string. |
target_language |
The language to translate the text into. Default is "en" for English. |
source_language |
The language of the input text. Default is "auto" for automatic detection. |
chunk_size |
The maximum number of characters to send in a single translation request. Default is 1000. |
Value
A single string containing the translated text.
Examples
long_text <- paste(rep("This is a long text to translate.", 100), collapse = " ")
google_translate_long_text(
long_text, target_language = "de",
source_language = "en",
chunk_size = 500)
[Package polyglotr version 1.5.1 Index]