机器翻译 - alimt CLI 命令参考

更新时间:
复制 MD 格式

本文列出机器翻译 - alimt 在阿里云 CLI 中的可用命令,并提供各命令的语法和参数说明。

前提条件

  • 已安装阿里云 CLI。安装方法请参见安装/更新 CLI。

  • 执行需要身份认证的命令前,请确认已配置阿里云 CLI 凭证,且凭证对应的身份拥有所需权限。配置方法请参见配置与管理身份凭证。

地域与接入点

凭证配置中的默认地域可用 --region <regionId> 覆盖。

未指定接入地址时,CLI 按产品规则尝试解析,需要指定时可按地域和网络类型查看 Endpoint,再使用 --endpoint <endpoint>。

版本信息

属性

值

CLI 版本

3.5.4

API 版本

2018-10-12

可用命令

单击命令名称,查看命令描述、语法和参数说明。

命令详情

语法逐行列出命令参数:<类型> 是需要替换的值占位符,方括号表示可选参数,# 表示列表项序号;[options] 表示 CLI 通用选项,见“全局选项”。可选对象或列表内标为必填的字段,仅在提供该对象或列表项时必填。完整参数定义见各命令的参数说明。

CreateAsyncTranslate

命令描述

机器异步翻译创建任务接口,支持100万以下字符翻译

语法

aliyun alimt CreateAsyncTranslate
    --ApiType <string>
    --FormatType <string>
    --Scene <string>
    --SourceLanguage <string>
    --SourceText <string>
    --TargetLanguage <string>
    [options]

参数

参数

类型

必填

说明

--ApiType

String

是

版本类型,必须选择一个版本
通用版本:translate_standard
专业版本:translate_ecommerce

--FormatType

String

是

翻译文本的格式,html( 网页格式。设置此参数将对待翻译文本以及翻译后文本按照html格式进行处理)、text(文本格式。设置此参数将对传入待翻译文本以及翻译后结果不做文本格式处理,统一按纯文本格式处理

--Scene

String

是

场景,支持:通用(general)、商品标题(title)、商品详情(description)、买卖家沟通(message)、医疗(medical)、社交(social)、科技(tech)

--SourceLanguage

String

是

原文语言,语言code参考 (https://help.aliyun.com/document_detail/158269.html?spm=a2c4g.11186623.6.542.7da22b9fayuNoj)

--SourceText

String

是

需要翻译的内容

--TargetLanguage

String

是

目标语言,语言code参考

示例

aliyun alimt CreateAsyncTranslate --region cn-hangzhou --SourceLanguage en --ApiType translate_standard --SourceText 'Opinion:_We_have_finally_gotten_some_relief_at_the_pump._But_it_may_not_last_long' --Scene general --TargetLanguage zh --FormatType text --version 2018-10-12 --method POST --force

CreateDocTranslateTask

命令描述

创建文档翻译任务

语法

aliyun alimt CreateDocTranslateTask
    [--CallbackUrl <string>]
    [--ClientToken <string>]
    --FileUrl <string>
    [--Scene <string>]
    --SourceLanguage <string>
    --TargetLanguage <string>
    [options]

参数

参数

类型

必填

说明

--CallbackUrl

String

否

翻译结果回调URL,服务器会向回调地址发起post请求
请求body
raw json
参数名 说明
task_id 任务id
status 状态
errCode 错误码
errMsg 错误信息
translateFileUrl 文件下载地址,过期时间1小时
IP白名单
59.82.61.52
203.119.241.30
203.119.241.98
59.82.84.90
203.119.241.56
59.82.61.75
回调服务示例:该服务用于回调方式获取翻译结果
```
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class CallbackController {
@RequestMapping(value = "callback", method = RequestMethod.POST)
public void callback(@RequestBody String body) {
try {
JSONObject result = JSON.parseObject(body);
if (200 != result.getInteger("errCode")) {
System.out.println("fail " + result.getString("erMsg"));
return;
}
System.out.println("task_id:" + result.getString("task_id"));
System.out.println("status:" + result.getString("status"));
System.out.println("translateFileUrl:" + result.getString("translateFileUrl"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
```









































--ClientToken

String

否

提供幂等能力,3分钟内,相同的值只会生效一次

--FileUrl

String

是

文档URL

--Scene

String

否

场景,支持:通用(general)、商品标题(title)、商品详情(description)、买卖家沟通(message)、医疗(medical)、社交(social)、科技(tech)

--SourceLanguage

String

是

原文语言,语言code参考 (https://help.aliyun.com/document_detail/158269.html?spm=a2c4g.11186623.6.542.7da22b9fayuNoj)

--TargetLanguage

String

是

目标语言,语言code参考 (https://help.aliyun.com/document_detail/158269.html?spm=a2c4g.11186623.6.542.7da22b9fayuNoj)

示例

aliyun alimt CreateDocTranslateTask --region cn-hangzhou --SourceLanguage en --FileUrl 'http://fileUrl' --TargetLanguage zh --version 2018-10-12 --method POST --force

CreateImageTranslateTask

命令描述

创建异步图片翻译,图片翻译包含文字识别、文本翻译、文字回填等能力

语法

aliyun alimt CreateImageTranslateTask
    [--ClientToken <string>]
    --Extra <string>
    --SourceLanguage <string>
    --TargetLanguage <string>
    --UrlList <string>
    [options]

参数

参数

类型

必填

说明

--ClientToken

String

否

提供幂等能力,3分钟内,相同的值只会生效一次

--Extra

String

是

以下JSON内容格式,不关注的都可以不用传递,都是可选参数
样例JSON格式内容:
```
{
"have_ocr": "false",
"without_text": "false",
"have_psd": "true",
"ignore_entity": "false"
}
```
- have_ocr,控制是否返回 OCR 结果,true:需要,false:不需要
without_text,控制是否需要擦除图片中的文字,true:需要,false:不需要
have_psd,控制是否返回图片编辑器数据,渲染编辑器,true:需要,false:不需要
ignore_entity,是否忽略实体识别,true:忽略,false:不忽略












--SourceLanguage

String

是

图片原始语种

--TargetLanguage

String

是

图片翻译目标语种

--UrlList

String

是

图片翻译链接,多张图片通过英文逗号分隔,图片数量不能超过20张

示例

aliyun alimt CreateImageTranslateTask --region cn-hangzhou --SourceLanguage zh --UrlList 'http://xxx,http://yyy' --TargetLanguage en --version 2018-10-12 --method POST --force

GetAsyncTranslate

命令描述

获取文本异步翻译任务内容

语法

aliyun alimt GetAsyncTranslate
    --JobId <string>
    [options]

参数

参数

类型

必填

说明

--JobId

String

是

异步任务ID。您调用CreateAsyncTranslate创建异步任务返回的JobId

示例

aliyun alimt GetAsyncTranslate --region cn-hangzhou --JobId '77056ab7-7be1-4c2a-91a1-f20f63894048' --version 2018-10-12 --method POST --force

GetBatchTranslate

命令描述

机器批量翻译,支持多段文本进行翻译

语法

aliyun alimt GetBatchTranslate
    --ApiType <string>
    --FormatType <string>
    --Scene <string>
    --SourceLanguage <string>
    --SourceText <string>
    --TargetLanguage <string>
    [options]

参数

参数

类型

必填

说明

--ApiType

String

是

版本类型,必须选择一个版本
通用版本:translate_standard
专业版本:translate_ecommerce

--FormatType

String

是

翻译文本的格式,html( 网页格式。设置此参数将对待翻译文本以及翻译后文本按照html格式进行处理)、text(文本格式。设置此参数将对传入待翻译文本以及翻译后结果不做文本格式处理,统一按纯文本格式处理

--Scene

String

是

专业版本支持的场景:商品标题(title),商品描述(description),商品沟通(communication),医疗(medical),社交(social)
通用版本支持的场景:general

--SourceLanguage

String

是

原文语言参考语言code (https://help.aliyun.com/document_detail/158269.html?spm=a2c4g.11186623.2.8.53746614hvrF2G)

--SourceText

String

是

json 数据格式
key:唯一的标记id,用于翻译结果拿到对应的id,对应上原文
value:待翻译的内容
具体格式如下:
`
{
"11": "hello boy",
"12": "go home",
"13": "we can"
}
`
待翻译的条数不能超过50
单条翻译字符数不能超过1000字符
总字符数不能超过8000字符
key不会计入翻译的字符
待翻译的内容中,标点、空格、html标签均会计入字符














--TargetLanguage

String

是

译文语言参考语言code (https://help.aliyun.com/document_detail/158269.html?spm=a2c4g.11186623.2.8.53746614hvrF2G)

示例

aliyun alimt GetBatchTranslate --region cn-hangzhou --SourceLanguage en --ApiType translate_standard --SourceText '{"11":"hello_boy","12":"go_home","13":"we_can"}' --Scene general --TargetLanguage zh --FormatType text --version 2018-10-12 --method POST --force

GetDetectLanguage

命令描述

语种识别API说明文档

语法

aliyun alimt GetDetectLanguage
    --SourceText <string>
    [options]

参数

参数

类型

必填

说明

--SourceText

String

是

待识别的语种

示例

aliyun alimt GetDetectLanguage --region cn-hangzhou --SourceText '你好' --version 2018-10-12 --method POST --force

GetDocTranslateTask

命令描述

查询文档翻译任务

语法

aliyun alimt GetDocTranslateTask
    --TaskId <string>
    [options]

参数

参数

类型

必填

说明

--TaskId

String

是

任务ID

示例

aliyun alimt GetDocTranslateTask --region cn-hangzhou --TaskId 0586df512c8b4bb382d7d9a6a01b5854 --version 2018-10-12 --force

GetImageDiagnose

命令描述

能够识别图片中的文字的语种

语法

aliyun alimt GetImageDiagnose
    [--Extra <string>]
    --Url <string>
    [options]

参数

参数

类型

必填

说明

--Extra

String

否

格式内容:{
"product_id": "1",
"platform": "ae"
}
product_id 商品id
platform 商品所属平台,支持ae/icbu/lazada




--Url

String

是

图片链接

示例

aliyun alimt GetImageDiagnose --region cn-hangzhou --Url 'http://xxxxx.oss-cn-shenzhen.aliyuncs.com/jd/41209/xxxxx.jpg' --version 2018-10-12 --method POST --force

GetImageTranslate

命令描述

包含文字识别、文本翻译、文字回填等能力

语法

aliyun alimt GetImageTranslate
    --Extra <string>
    --SourceLanguage <string>
    --TargetLanguage <string>
    --Url <string>
    [options]

参数

参数

类型

必填

说明

--Extra

String

是

以下JSON内容格式,不关注的都可以不用传递,都是可选参数
JSON 格式内容:
```
{
"have_ocr": "false",
"without_text":"true",
"have_psd": "false",
"ignore_entity": "false"
}
```
- have_ocr 通过true/false 控制是否返回ocr结果,true:需要,false:不需要
without_text 控制是否需要擦除图片中的文字,true:需要,false:不需要
have_psd 用于图片编辑器,psd数据渲染编辑器
ignore_entity 是否忽略实体识别,true:忽略实体识别,false:不忽略












--SourceLanguage

String

是

图片中的文字语种,
语向支持以及语言代码 (https://help.aliyun.com/document_detail/182310.html?spm=a2c4g.11186623.6.543.106340eblV3QUo)

--TargetLanguage

String

是

图片中文字翻译后的语种,
语向支持以及语言代码 (https://help.aliyun.com/document_detail/182310.html?spm=a2c4g.11186623.6.543.106340eblV3QUo)

--Url

String

是

需要翻译的图片链接

示例

aliyun alimt GetImageTranslate --region cn-hangzhou --SourceLanguage zh --TargetLanguage en --Url 'http://xxxxxxx.oss-cn-shenzhen.aliyuncs.com/xxxxxx.jpg' --version 2018-10-12 --method POST --force

GetImageTranslateTask

命令描述

通过任务ID获取异步图片翻译结果

语法

aliyun alimt GetImageTranslateTask
    --TaskId <string>
    [options]

参数

参数

类型

必填

说明

--TaskId

String

是

异步图片翻译任务Id

示例

aliyun alimt GetImageTranslateTask --region cn-hangzhou --TaskId xxxxxx --version 2018-10-12 --method POST --force

GetTitleDiagnose

命令描述

通过商品标题质量诊断服务,产出可视化的标题质量分,便于卖家对现有的商品标题质量有实际体感

语法

aliyun alimt GetTitleDiagnose
    --CategoryId <string>
    --Extra <string>
    --Language <string>
    --Platform <string>
    --Title <string>
    [options]

参数

参数

类型

必填

说明

--CategoryId

String

是

类目id,如没有类目数据则传入0

--Extra

String

是

可选字段
格式内容:{
"product_id": "1",
"platform": "ae"
}
product_id 商品id
platform 商品所属平台,支持ae/icbu/lazada





--Language

String

是

标题文字的语种,语向支持以及语言代码 (https://help.aliyun.com/document_detail/182310.html?spm=a2c4g.11186623.6.543.106340eblV3QUo)

--Platform

String

是

商品标题所属平台,支持ae/icbu/lazada

--Title

String

是

标题内容

示例

aliyun alimt GetTitleDiagnose --region cn-hangzhou --CategoryId 123 --Language zh --Platform ae --Title Amroe_Japan_Comic_Theme_Uzumaki_Naruto_Namikaze_Minato_3D_Visual_Cartoon_7_Color_USB_Touch --version 2018-10-12 --method POST --force

GetTitleGenerate

命令描述

基于电商大数据,自动优化商品标题

语法

aliyun alimt GetTitleGenerate
    [--Attributes <string>]
    --CategoryId <string>
    [--Extra <string>]
    [--HotWords <string>]
    --Language <string>
    --Platform <string>
    --Title <string>
    [options]

参数

参数

类型

必填

说明

--Attributes

String

否

商品属性,请如示例传入JSON数据

--CategoryId

String

是

类目ID,如没有类目数据则传入0

--Extra

String

否

格式内容:{
"product_id": "1",
"platform": "ae"
}
product_id 商品id
platform 商品所属平台




--HotWords

String

否

热词

--Language

String

是

标题语种,语向支持以及语言代码 (https://help.aliyun.com/document_detail/182310.html)

--Platform

String

是

商品标题所属平台,支持ae/icbu

--Title

String

是

标题内容

示例

aliyun alimt GetTitleGenerate --region cn-hangzhou --CategoryId 127896018 --Language en --Platform ae --Title 10pcs_80ml_Kitchen_Disposable --version 2018-10-12 --method POST --force

GetTitleIntelligence

命令描述

通过类目、平台、关键词,自动生成商品标题

语法

aliyun alimt GetTitleIntelligence
    --CatLevelThreeId <int>
    --CatLevelTwoId <int>
    [--Extra <string>]
    --Keywords <string>
    --Platform <string>
    [options]

参数

参数

类型

必填

说明

--CatLevelThreeId

Integer

是

三级类目Id,如没有类目数据则传入0

  • 约束:

    • 最大值:99999999999

    • 最小值:0

--CatLevelTwoId

Integer

是

二级类目Id,如没有类目数据则传入0

  • 约束:

    • 最大值:99999999999

    • 最小值:0

--Extra

String

否

扩展信息,json数据格式,可选字段

--Keywords

String

是

关键词,多个词英文逗号分隔比如:hello,apple

--Platform

String

是

商品所在平台 ae、icbu、lazada

示例

aliyun alimt GetTitleIntelligence --region cn-hangzhou --CatLevelTwoId 222 --Platform ae --CatLevelThreeId 111 --version 2018-10-12 --method POST --force

GetTranslateImageBatchResult

命令描述

获取图片异步批量翻译的结果

语法

aliyun alimt GetTranslateImageBatchResult
    --TaskId <string>
    [options]

参数

参数

类型

必填

说明

--TaskId

String

是

调用图片异步批量翻译接口获得的任务 ID

示例

aliyun alimt GetTranslateImageBatchResult --region cn-hangzhou --TaskId 'EEA28E6D-4828-5031-BD8C-8FF1B3216842' --version 2018-10-12 --method POST --force

GetTranslateReport

命令描述

根据API名及开始结束时间获取API调用报表,并根据传入的group按照天或者小时聚合计算后返回

语法

aliyun alimt GetTranslateReport
    --ApiName <string>
    --BeginTime <string>
    --EndTime <string>
    --Group <string>
    [options]

参数

参数

类型

必填

说明

--ApiName

String

是

API名称
机器翻译通用版:translate_standard
机器翻译专业版:translate_ecommerce
语种识别:predict_detect
通用图片翻译:it_general
电商图片翻译:it_ecommerce
文档翻译:dt_page
身份证翻译:ct_idcard
驾照翻译:ct_driving







--BeginTime

String

是

起始时间,格式为 YYYY-MM-DD HH:mm:ss

--EndTime

String

是

结束时间,格式为 YYYY-MM-DD HH:mm:ss

--Group

String

是

分组

示例

aliyun alimt GetTranslateReport --region cn-hangzhou --Group 'hour或者day' --EndTime '2021-03-01_23:59:59' --ApiName translate_standard --BeginTime '2021-03-01_00:00:00' --version 2018-10-12 --method POST --force

OpenAlimtService

命令描述

商品服务开通

语法

aliyun alimt OpenAlimtService
    [--Type <string>]
    [options]

参数

参数

类型

必填

说明

--Type

String

否

机器翻译 alimt
定制化翻译服务 type = automl
证件翻译 type=ct
文档翻译 type=dt
语种识别type=id



示例

aliyun alimt OpenAlimtService --region cn-hangzhou --Type id --version 2018-10-12 --method POST --force

Translate

命令描述

调用机器翻译专业版获取翻译结果

语法

aliyun alimt Translate
    [--Context <string>]
    --FormatType <string>
    --Scene <string>
    --SourceLanguage <string>
    --SourceText <string>
    --TargetLanguage <string>
    [options]

参数

参数

类型

必填

说明

--Context

String

否

上下文信息,可选填

--FormatType

String

是

翻译文本的格式,html( 网页格式。设置此参数将对待翻译文本以及翻译后文本按照html格式进行处理)、text(文本格式。设置此参数将对传入待翻译文本以及翻译后结果不做文本格式处理,统一按纯文本格式处理

--Scene

String

是

场景可选取值:商品标题(title),商品描述(description),商品沟通(communication),医疗(medical),社交(social),金融(finance)

--SourceLanguage

String

是

原文语言,参考语言code (https://help.aliyun.com/document_detail/215387.html)</ph>

--SourceText

String

是

待翻译内容

  • 约束:

    • 最大长度:256000

--TargetLanguage

String

是

译文语言,参考语言code (https://help.aliyun.com/document_detail/215387.html)</ph>

示例

aliyun alimt Translate --region cn-hangzhou --SourceLanguage zh --SourceText '你好' --Scene title --TargetLanguage en --FormatType text --version 2018-10-12 --method POST --force

TranslateCertificate

命令描述

进行证件翻译

语法

aliyun alimt TranslateCertificate
    --CertificateType <string>
    --ImageUrl <string>
    [--ResultType <string>]
    --SourceLanguage <string>
    --TargetLanguage <string>
    [options]

参数

参数

类型

必填

说明

--CertificateType

String

是

翻译的证件类型:身份证(idcard),驾驶证(driving_license)

--ImageUrl

String

是

oss文件地址:一个可以不用赋权就能访问的HTTP地址

--ResultType

String

否

翻译结果类型:文本(text),图片(image),不传值默认:text

--SourceLanguage

String

是

原图语言

--TargetLanguage

String

是

译文语言

示例

aliyun alimt TranslateCertificate --region cn-hangzhou --SourceLanguage zh --CertificateType driving_license --ImageUrl 'http://imageurl' --TargetLanguage en --version 2018-10-12 --method POST --force

TranslateECommerce

命令描述

调用机器翻译专业版获取翻译结果

已弃用:true

语法

aliyun alimt TranslateECommerce
    [--Context <string>]
    --FormatType <string>
    --Scene <string>
    --SourceLanguage <string>
    --SourceText <string>
    --TargetLanguage <string>
    [options]

参数

参数

类型

必填

说明

--Context

String

否

context信息

--FormatType

String

是

翻译文本的格式,html( 网页格式。设置此参数将对待翻译文本以及翻译后文本按照html格式进行处理)、text(文本格式。设置此参数将对传入待翻译文本以及翻译后结果不做文本格式处理,统一按纯文本格式处理

--Scene

String

是

场景可选取值:商品标题(title),商品描述(description),商品沟通(communication),医疗(medical),社交(social),金融(finance)

--SourceLanguage

String

是

原文语言参考语言code (https://help.aliyun.com/document_detail/158269.html?spm=a2c4g.11186623.2.8.53746614hvrF2G)

--SourceText

String

是

待翻译内容

--TargetLanguage

String

是

目标语种,支持的语种参考 (https://help.aliyun.com/document_detail/163584.html)

示例

aliyun alimt TranslateECommerce --region cn-hangzhou --SourceLanguage en --SourceText Hello --Scene social --TargetLanguage zh --FormatType text --version 2018-10-12 --method POST --force

TranslateGeneral

命令描述

通用翻译接口调用说明

语法

aliyun alimt TranslateGeneral
    [--Context <string>]
    --FormatType <string>
    --Scene <string>
    --SourceLanguage <string>
    --SourceText <string>
    --TargetLanguage <string>
    [options]

参数

参数

类型

必填

说明

--Context

String

否

上下文信息,可选填

--FormatType

String

是

翻译文本的格式,html( 网页格式。设置此参数将对待翻译文本以及翻译后文本按照html格式进行处理)、text(文本格式。设置此参数将对传入待翻译文本以及翻译后结果不做文本格式处理,统一按纯文本格式处理

--Scene

String

是

通用版本默认是:general

--SourceLanguage

String

是

原文语言,参考语言code (https://help.aliyun.com/document_detail/215387.html)</ph>

--SourceText

String

是

需要翻译的内容

--TargetLanguage

String

是

译文语言,参考语言code (https://help.aliyun.com/document_detail/215387.html)</ph>

示例

aliyun alimt TranslateGeneral --region cn-hangzhou --SourceLanguage zh --SourceText '你好' --TargetLanguage en --FormatType text --version 2018-10-12 --method POST --force

TranslateImage

命令描述

将图片上的文字从一种语言翻译成另一种语言,并输出一张尽可能忠于原图的新图片

语法

aliyun alimt TranslateImage
    [--Ext <string>]
    [--Field <string>]
    [--ImageBase64 <string>]
    [--ImageUrl <string>]
    [--SourceLanguage <string>]
    [--TargetLanguage <string>]
    [options]

参数

参数

类型

必填

说明

--Ext

String

否

扩展信息, JSON String 格式,里面可以包含的字段如下。
needEditorData: 取值为字符串 true/false,默认为false,是否需要在结果中返回图片翻译译后编辑器数据,仅用于自行接入图片翻译译后编辑器 (https://help.aliyun.com/document_detail/2507676.html)时,获取数据使用
ignoreEntityRecognize:取值为字符串 true/false,默认为 false,电商领域图片翻译会自动判断文字是否在图片中的商品主体上,如果在,则略过翻译;使用本字段来控制是否进行上述判断,本字段对通用图片翻译无效

--Field

String

否

翻译领域, 可选值如下。
general: 通用图片翻译
e-commerce: 电商领域图片翻译
默认及未识别领域均按通用图片翻译处理


--ImageBase64

String

否

原图 Base64,跟 URL 不能同时为空,优先取 Base64

--ImageUrl

String

否

原图 URL,跟 Base64 不能同时为空,优先取 Base64

--SourceLanguage

String

否

源语种,支持的语种参考 (https://help.aliyun.com/document_detail/163584.html),必填(请忽略表格中“是否必填”中的“否”)

--TargetLanguage

String

否

目标语种,支持的语种参考 (https://help.aliyun.com/document_detail/163584.html),必填(请忽略表格中“是否必填”中的“否”)

示例

aliyun alimt TranslateImage --region cn-hangzhou --SourceLanguage zh --Ext '{"needEditorData":"false","ignoreEntityRecognize":"true"}' --Field general --ImageUrl 'https://example.com/example.jpg' --TargetLanguage en --ImageBase64 '/9j/4...H/9k=' --version 2018-10-12 --method POST --force

TranslateImageBatch

命令描述

异步将一批图片上的文字从一种语言翻译成另一种语言,并分别输出新的图片

语法

aliyun alimt TranslateImageBatch
    [--CustomTaskId <string>]
    [--Ext <string>]
    [--Field <string>]
    --ImageUrls <string>
    --SourceLanguage <string>
    --TargetLanguage <string>
    [options]

参数

参数

类型

必填

说明

--CustomTaskId

String

否

自定义任务 ID,用于防止短时间误操作重复请求;3 分钟内,相同自定义任务 ID 的请求只会被处理一次

--Ext

String

否

扩展信息, JSON String 格式,里面可以包含的字段如下。
needEditorData:取值为字符串 true/false,默认为false,是否需要在结果中返回图片翻译译后编辑器数据,仅用于自行接入图片翻译译后编辑器 (https://help.aliyun.com/document_detail/2507676.html)时,获取数据使用
ignoreEntityRecognize:取值为字符串 true/false,默认为 false,电商领域图片翻译会自动判断文字是否在图片中的商品主体上,如果在,则略过翻译;使用本字段来控制是否进行上述判断,本字段对通用图片翻译无效

--Field

String

否

翻译领域, 可选值如下。
general:通用图片翻译
e-commerce:电商领域图片翻译
默认及未识别领域均按通用图片翻译处理


--ImageUrls

String

是

原图 URL,多张图片使用半角逗号进行分割;单次请求 URL 总数不能超过 20,且相同的 URL 只会被处理一次

--SourceLanguage

String

是

源语种,支持的语种及对应的代码请参考语言code (https://help.aliyun.com/document_detail/163584.html)

--TargetLanguage

String

是

目标语种,支持的语种及对应的代码请参考语言code (https://help.aliyun.com/document_detail/163584.html)

示例

aliyun alimt TranslateImageBatch --region cn-hangzhou --SourceLanguage zh --ImageUrls 'https://example.com/1.jpg,https://example.com/2.jpg,https://example.com/3.jpg' --TargetLanguage en --version 2018-10-12 --method POST --force

TranslateSearch

命令描述

搜索翻译

语法

aliyun alimt TranslateSearch
    --FormatType <string>
    --Scene <string>
    --SourceLanguage <string>
    --SourceText <string>
    --TargetLanguage <string>
    [options]

参数

参数

类型

必填

说明

--FormatType

String

是

翻译文本的格式。text 表示按纯文本处理,html 表示按 HTML 格式处理

--Scene

String

是

翻译场景,搜索查询场景取值为 query

--SourceLanguage

String

是

原文语种代码

--SourceText

String

是

待翻译的搜索文本

--TargetLanguage

String

是

目标语种代码

示例

aliyun alimt TranslateSearch --region cn-hangzhou --SourceLanguage zh --SourceText '今天天气不错' --Scene query --TargetLanguage en --FormatType text --version 2018-10-12 --method POST --force

全局选项

以下为 CLI 通用选项,各选项的适用范围以说明为准。

选项

说明

--cli-dry-run

使用 --cli-dry-run 在执行校验后以人类可读格式输出请求详情,跳过实际运行

--cli-input-json

使用 --cli-input-json foo.json 从 JSON 对象读取产品 API 参数,命令行显式参数覆盖文件值

--cli-output

设置宿主 CLI Help、本地错误和更新检查的输出格式(json)

--cli-query

使用 --cli-query <jmespath> 通过 JMESPath 表达式过滤输出结果

--cli-sign-version

短横线命令的 OpenAPI 签名版本:当前仅支持 v4;设为空值可清空并恢复默认签名(aliyun configure set 可写入 Profile)

--language

使用 --language [en|zh] 来指定语言

--output -o

使用 --output cols=Field1,Field1 [rows=jmesPath] 使用表格方式打印输出

--profile -p

使用 --profile <profileName> 指定操作的配置集

--region

使用 --region <regionId> 来指定访问大区

--version --api-version

使用 --version <YYYY-MM-DD> 来指定访问的API版本

--yes -y

跳过安全策略的确认提示(用于非交互式/Agent 场景)