[英]Link Google automl translation custom model with glossary
我已經使用 Google automl 構建了自定義翻譯 model 和詞匯表。 這導致了兩種不同的路徑,一種用於使用 model,另一種用於詞匯表。 我想知道是否可以將 model 和詞匯表鏈接起來,以獲得將模型+詞匯表與不同的翻譯工具(在我的例子中是 Wordbee)連接起來的單一路徑。 我現在可以連接 model 但不能連接詞匯表。
我知道我可以一起使用 model 和詞匯表發出 POST 請求和請求 JSON,但我想要的是在可能的情況下將 model 和相應的詞匯表集成到一個具有單一路徑的外部工具中。 就像是
projects/project-number/locations/us-central1/model+glossary-id
提前致謝
我認為您基本上可以將詞匯表的 JSON 和 model 請求結合起來。
HTTP方法和URL是一樣的。
https://cloud.google.com/translate/docs/advanced/glossary#translate_v3_get_glossary-drest
HTTP方法和URL:
POST https://translation.googleapis.com/v3/projects/PROJECT_NUMBER_OR_ID/locations/us-central1:translateText
請求 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
HTTP方法和URL:
POST https://translation.googleapis.com/v3/projects/project-number-or-id/locations/us-central1:translateText
請求 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."] }
你最終會得到這樣的結果。
{
"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.