Giter Club home page Giter Club logo

Comments (3)

Tomeriko96 avatar Tomeriko96 commented on August 20, 2024

Thank you for submitting the issue!
I will look into this soon.

In the meantime, is the method as described in this vignette viable for your use case?

See also the code below applied to your example:

text_to_translate <- c("the", "quick", "brown")
df <- data.frame(original_text = text_to_translate)

df %>%
  dplyr::mutate(translated_text = purrr::map_chr(original_text, ~ google_translate(.x, target_language = "fr", source_language = "en")))

from polyglotr.

Tomeriko96 avatar Tomeriko96 commented on August 20, 2024

The function has now been vectorized, see commit abbaf0b. Pushing updates to CRAN is planned for the end of July.

In the meantime, you can check it when using the development version on GitHub:

devtools::install_github("polyglotr")
library(polyglotr)

text_to_translate <- c("the", "quick", "brown")
google_translate (text_to_translate, "fr", "en")

>
[[1]]
[1] "le"

[[2]]
[1] "rapide"

[[3]]
[1] "brun"

And for the dataframe:

df <- as.data.frame(text_to_translate)

df %>% 
  mutate(translated_text = google_translate(text_to_translate, "fr", "en"))
>
  text_to_translate translated_text
1               the              le
2             quick          rapide
3             brown            brun


from polyglotr.

Tomeriko96 avatar Tomeriko96 commented on August 20, 2024

Version 1.2.0 has been published to CRAN, which includes the fix for vectorization.

from polyglotr.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.