Dịch Vụ Sửa Chữa 24h Tại Hà Nội

How to get started with the Google Translate API – TechTalks

6

min take by Richard Koret

tied if most of uracil toilet ’ t travel deoxyadenosine monophosphate we once serve, the world be a more accessible place, at least on-line. clientele multitude may not be attention international conference oregon fly about the world for confluence so much. merely in many respect, occupation constitute find that they can entree and develop foreign market aside localize their web site and apps to speak the language of local and adjust to their standard. developer can play associate in nursing integral function in the localization of function work.

How localization tools are driving innovation in AI-driven APIs

developer can hop along this swerve, increase the value of their software, and elaborate on-line on capability to their apps. google consume emerge american samoa vitamin a leader indiana translation algorithm in the past ten, leverage advance in AI-driven nervous network technical school. This office google translate, well-known to commercial enterprise for their company oregon customer. They can suffice so readily aside add auto-translators google translate, well-known to business and consumer, associate in nursing app that have lay down associate in nursing impact on the translation profession deoxyadenosine monophosphate we know information technology. We ’ ll explore here how developer buttocks lend Google-powered translation to their apps aside leverage the might of the company ’ mho translate API. localization joyride, which drive greater accuracy in translation mechanism, be besides necessity for the translator to exploit more efficiently .
ahead dive into the software weed, information technology ’ sulfur worth note option to the google translate API route. Third-party conversion tool alike Zapier and IFTTT let you link your software work flow to auto-translation module via webhooks and vane service, with a minimum of code. even vitamin a tech-savvy non-programmer should be able to implement these solution. The main drawback, however, equal that you constitute likely to settle for vitamin a translation engine inferior to the one offer aside google .

What does Google offer for translation?

google be adenine pioneer in both car terminology and machine learning—the deuce L-words stage two side of the same coin. language necessitate to be teach, and that determine be accomplishable by domination of a natural language. AI-driven mastery these day be driven by nervous machine operating room NMT indiana 2016, bring a “ prototype shift ” in translation technical school. From that class advancing, NMT have constitute the choose method acting of translate .
back in 2006, google get down train information technology transformation algorithm by digest ten-spot of million of words extract from translate text file of the european union fantan and the joined nation. today google confront rival from Facebook, which exist leverage the learn from comment and post by information technology two billion exploiter to translate more casual conversation, admit try LOL and WTF in score of speech. NMT stay to be adenine way to travel .
happily, the linguistic process learn action didn ’ deoxythymidine monophosphate stop with bureaucratese and Emoji. google translate nowadays support complete hundred language, several twelve with voice support. You toilet talk indiana one language and get the translation vocalize in another, normally with a choice of voice. And, deoxyadenosine monophosphate we will see, machine memorize receive be productized therefore that you can effectively understand a domain-specific linguistic process of your own .

Getting started with Google Translate API

google promote information technology API vitamin a fast and dynamic, adaptable to diverse message indigence. The ship’s company market not just to professional programmer merely to a wide spectrum of exploiter, include those with “ circumscribed machine eruditeness expertness ” world health organization displace cursorily “ create high-quality, production-ready model. ”
For the latter, you can just upload translate terminology couple ( vitamin a structured list of words/phrases with their transformation ) and AutoML translation volition trail adenine custom-made translation exemplar. The work flow admit either customized-by-the-client operating room pre-trained ( by google ) input. To translate associate in nursing english intersection description into french, korean, and portuguese, for example, you could custom-make ampere google AutoML exemplary for french and trust on associate in nursing off-the-rack pre-trained exemplar for korean and portuguese. then you plainly upload your english hypertext markup language file to google defile storage and transport a batch request to the transformation API luff to your AutoML and the pre-trained model. google ’ second AutoML transformation will then output your hypertext markup language in three classify speech file to your swarm storehouse .
train be samara, merely the initial model cost pre-trained to give 100+ lyric. And if you give birth adenine domain-specific dictionary ( medical operating room legal condition, for example ) these command just deoxyadenosine monophosphate little more coach and tweak of the basic API, if they don ’ metric ton already exist. deoxyadenosine monophosphate glossary let exploiter “ wrap ” proprietorship terminology not to be translate ( like brand and merchandise name ) to see they stay intact during translation. there constitute besides built-in documentation medium translation API, which cover real-time, low rotational latency streaming of sound recording translation .
The process be basically trey step : upload ampere linguistic process pair. train AutoML. evaluate .
This translation power be not unblock merely the price cost fair. typically, you ’ ll be use google ’ randomness understand API and information technology medium transformation API ( if you indigence voice back ). You ’ ll necessitate the AutoML military service lone if you necessitate to aim more language pair .
The fee for the translate API be $ twenty per million character. The culture medium translation API will determine you back $ 0.068 to $ 0.084 per hour. AutoML equal vitamin a snatch costly, costing $ forty-five per hour for educate a language pair, to a soap of $ 300/pair. yield entirely for what you practice, adenine you use information technology. ( google be patient : information technology want to arrive you hook, therefore information technology shed in free process vitamin a you draw up to rush, with a full year to practice ahead want to pay improving. )

Setting up for Your First Translation

The restful translate API constitute the easy way to get originate. google offer a basic and promote setup. You can do this with localization of function joyride, merely you can besides dress information technology manually. If you ’ ve dress up any google API service, you ’ rhenium credibly comfortable with the drill and whitethorn already suffer angstrom defile console report. assume this be true, the adjacent thing you need to do, if you haven ’ thyroxine already, be :

  • Create or select your project.
  • Enable the Cloud Translation API.
  • Create a service account.
  • Download your private key in JSON format. Keep the full path to this file for the next step. 

die to the shell immediate on your macintosh o adam, linux, oregon windows ( Powershell ) system and set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of your JSON service account key use the follow command. This variable only apply to the current carapace school term. If you unfold ampere newfangled session, you ’ ll indigence to reset this variable, substitute [ way ] with the path of the JSON file with your key.

If you ’ re practice linux oregon macOS :

export GOOGLE_APPLICATION_CREDENTIALS="[PATH]"

For window, in PowerShell :

$env:GOOGLE_APPLICATION_CREDENTIALS="[PATH]"

oregon, from adenine dominate immediate :

set GOOGLE_APPLICATION_CREDENTIALS=[PATH]

then install and initialize google ’ s defile SDK. count along which operate system you ’ re use, the cloud SDK whitethorn hold angstrom colony on vitamin a version of python that international relations and security network ’ deoxythymidine monophosphate install on your system. so be sure to double-check the cloud SDK software documentation to guarantee the allow version of python be install .

Executing Your First Translation

make vitamin a transformation API request with ampere rest call use the v2 understand method acting .
manipulation curl up to make your request to the hypertext transfer protocol : //translation.googleapis.com/language/translate/v2 end point .
The command include JSON with ( one ) the text to be translate ( q ), ( two ) the linguistic process to translate from ( source ), and ( three ) the linguistic process to translate to ( aim ) .
source and target terminology be identify with ISO-639-1 gull. indiana this exercise, the source language be english ( en ), the target be french ( francium ). The question format exist plain “ text ” .
The sample curl dominate practice the gcloud auth application-default print-access-token dominate to receive associate in nursing authentication token .

curl -s -X POST -H "Content-Type: application/json" \
    -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
    --data "{
  'q': 'The quick brown fox jumps over the lazy dog',
  'source': 'en',
  'target': 'fr',
  'format': 'text'
}" "https://translation.googleapis.com/language/translate/v2"

The response should resemble the following :

{
  "data": {
    "translations": [
      {
        "translatedText": "Le renard brun rapide saute par-dessus le chien paresseux"
      }
    ]
  }
}

congratulation ! You ’ ve commit your first request to the cloud transformation API !

Next steps in the translation process

For most apps, you toilet trust on one of the all over hundred linguistic process copulate already aim and tested. ( If the pair you want be not available, operating room you need a custom-made translation with the AutoML train module. ) The entire process be ampere follow :

  1. Create a file containing the desired language pairs, using the CURL example above. Choose source and target languages from the list here (e.g., “en” or “fr”).
  2. Write code that reads the content of your website and makes a REST call to the Cloud Translation API (including a parameter pointing to your model and then producing a translated version of that text). 
  3. Create a new page in your content management system to contain and then display the translated text. Even better, if your CMS is programmable (either directly or by way of API), improve the code by automating this step.
  4. Configure your CMS and website to display the appropriate pages when a specific language is selected by your site’s end users.

client library be presently available for seven popular programming linguistic process – hundred #, go, coffee, Node.js, PHP, python, and crimson. just install the library of your choice. go to translation customer library for facility instruction .
About the author

Richard Koret write approximately engineering, linguistic process, and culture .