简体   繁体   English

链接谷歌自动翻译自定义 model 与词汇表

[英]Link Google automl translation custom model with glossary

I have built a custom translation model and a glossary using Google automl.我已经使用 Google automl 构建了自定义翻译 model 和词汇表。 This resulted in two different paths, one for using the model and a different one for the glossary.这导致了两种不同的路径,一种用于使用 model,另一种用于词汇表。 I was wondering if it would be possible to link both model and glossary to get a single path to connect model+glossary with a different translation tool (in my case Wordbee).我想知道是否可以将 model 和词汇表链接起来,以获得将模型+词汇表与不同的翻译工具(在我的例子中是 Wordbee)连接起来的单一路径。 I am now able to connect the model but not the glossary.我现在可以连接 model 但不能连接词汇表。

I know I can use together model and glossary making a POST request and with a request JSON, but what I want is to integrate together model and corresponding glossary in an external tool with a single path if possible.我知道我可以一起使用 model 和词汇表发出 POST 请求和请求 JSON,但我想要的是在可能的情况下将 model 和相应的词汇表集成到一个具有单一路径的外部工具中。 Something like就像是

projects/project-number/locations/us-central1/model+glossary-id

Thanks in advance提前致谢

I think that you can essentially just combine the JSON of the glossary and model requests.我认为您基本上可以将词汇表的 JSON 和 model 请求结合起来。

The HTTP method and URL is the same. HTTP方法和URL是一样的。

https://cloud.google.com/translate/docs/advanced/glossary#translate_v3_get_glossary-drest https://cloud.google.com/translate/docs/advanced/glossary#translate_v3_get_glossary-drest

HTTP method and URL: HTTP方法和URL:

 POST https://translation.googleapis.com/v3/projects/PROJECT_NUMBER_OR_ID/locations/us-central1:translateText

Request JSON body:请求 JSON 正文:

 { "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", "ignoreCase": BOOLEAN } }

https://cloud.google.com/translate/automl/docs/predict#using-translate-api https://cloud.google.com/translate/automl/docs/predict#using-translate-api

HTTP method and URL: HTTP方法和URL:

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

Request JSON body:请求 JSON 正文:

 { "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."] }

You will end up with something like this.你最终会得到这样的结果。

{
  "model": "projects/project-number-or-id/locations/us-central1/models/TRL1395675701985363739",
  "glossaryConfig": {
   "glossary": "projects/project-number/locations/us-> central1/glossaries/glossary-id",
   "ignoreCase": BOOLEAN
  }
  "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."]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM