Skip to content

translate

translate(text, target_language)

Description

Translate text into target_language

Usage

Call or Deploy translate ?
Call translate directly

The easiest way to use bigfunctions

  • translate function is deployed in 39 public datasets for all of the 39 BigQuery regions.
  • It can be called by anyone. Just copy / paste examples below in your BigQuery console. It just works!
  • (You need to use the dataset in the same region as your datasets otherwise you may have a function not found error)

Public BigFunctions Datasets

Region Dataset
eu bigfunctions.eu
us bigfunctions.us
europe-west1 bigfunctions.europe_west1
asia-east1 bigfunctions.asia_east1
... ...
Deploy translate in your project

Why deploy?

  • You may prefer to deploy translate in your own project to build and manage your own catalog of functions.
  • This is particularly useful if you want to create private functions (for example calling your internal APIs).
  • Get started by reading the framework page

Deployment

translate function can be deployed with:

pip install bigfunctions
bigfun get translate
bigfun deploy translate

Examples

select bigfunctions.eu.translate("Salut \ud83d\udc4b Florian. Merci d\u0027\u0027avoir contribu\u00e9 !", "en")
select bigfunctions.us.translate("Salut \ud83d\udc4b Florian. Merci d\u0027\u0027avoir contribu\u00e9 !", "en")
select bigfunctions.europe_west1.translate("Salut \ud83d\udc4b Florian. Merci d\u0027\u0027avoir contribu\u00e9 !", "en")
+-------------------------------------------+
| translated_text                           |
+-------------------------------------------+
| Hello 👋 Florian. Thanks for contributing! |
+-------------------------------------------+

Use cases

A company has a database of customer reviews in various languages. They want to analyze the sentiment of these reviews but their sentiment analysis tool only works on English text. They can use the translate function within BigQuery to translate all reviews into English before processing them with the sentiment analysis tool.

SELECT review_id, sentiment(bigfunctions.<region>.translate(review_text, 'en')) AS sentiment_score
FROM `project.dataset.reviews`;

Replacing <region> with the appropriate BigQuery region for their dataset (e.g., us, eu, europe-west1). This query translates each review_text into English and then calculates the sentiment score using the hypothetical sentiment function. This allows the company to perform sentiment analysis on all reviews regardless of the original language.


Need help or Found a bug?
Get help using translate

The community can help! Engage the conversation on Slack

We also provide professional suppport.

Report a bug about translate

If the function does not work as expected, please

  • report a bug so that it can be improved.
  • or open the discussion with the community on Slack.

We also provide professional suppport.


Show your ❤ by adding a ⭐ on