1

I built a custom model and a glossary in Google AutoML language translation. Is there a way to use both the custom model and the glossary at the same time? If so, what should the request.json look like?

Andi Wu
  • 11
  • 1

3 Answers3

2

You can totally use both glossary and AutoML at the same time. Make a post request:

POST https://translation.googleapis.com/v3/projects/project-number-or-id/locations/us-central1:translateText

With this payload. Model should point to your AutoML model path, and glossaryConfig should point to your glossary id.

{
  "model": "projects/project-number-or-id/locations/us-central1/models/TRL1395675701985363739",
  "sourceLanguageCode": "en",
  "targetLanguageCode": "ru",
  "contents": "Dr. Watson, please discard your trash. You've shared unsolicited email with me. Let's talk about spam and importance ranking in a confidential mode.",
  "glossaryConfig": {
    "glossary": "projects/project-number/locations/us-central1/glossaries/glossary-id"
  }
}
Dale Markowitz
  • 191
  • 1
  • 1
  • 9
  • Hi Dale, I'm facing exactly the same problem. I need to combine the AutoML trained model with a Glossary. From the google documentation I saw that it is not possible to combine them. Also this library https://www.npmjs.com/package/@google-cloud/automl doesn't give the possibility to give as input parameter a glossary. Do you have any suggestion? – Paolo Feb 25 '21 at 09:06
0

I don't know how to request,but I use another way instead.

  • get the translation from "glossary".
  • use translation as custom model source text.

Just like this: text = "You want to translate" → text2(use glossary) → final_result (custom model)

Hope to help you a little

yueli
  • 3
  • 2
0

"You want to translate" → text2(use glossary) → final_result (custom model) sounds interesting. I'll give it a try.

Andi Wu
  • 11
  • 1