inst/doc/Movie_Reviews.R

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  eval = FALSE
)

## ----setup--------------------------------------------------------------------
#  library(polyglotr)
#  library(purrr)
#  library(dplyr)
#  library(text2vec)

## ----reviews------------------------------------------------------------------
#  df <- head(movie_review, 10)
#  glimpse(df)
#  
#  ## show reviews
#  df$review

## ----translated---------------------------------------------------------------
#  # Translate the review column to French
#  translated_reviews <- df %>%
#    dplyr::mutate(french_review = purrr::map_chr(review, ~ google_translate(.x, target_language = "fr", source_language = "en")))

## ----results------------------------------------------------------------------
#  glimpse(translated_reviews)
#  
#  translated_reviews$french_review

Try the polyglotr package in your browser

Any scripts or data that you put into this service are public.

polyglotr documentation built on Sept. 11, 2024, 6:35 p.m.