Smart Translation - 智能翻译

整体流程

image

提交预翻译任务

  • 通过API 接口提交预翻译任务。

POST /aitranslation/create.json
{
    "accessKey": "{{accessKey}}",
    "appName": "testing",
    "appId": "16",
    "projectName": "testing-16",
    "sourceLang": "zh-CN",
    "targetLang": "en-US",
    "requestDataList": [{
        "dataId": "1",
        "dataType": "url",
        "fileName": "test.docx",
        "fileUrl": "https://alifanyi-pixar-hz.oss-cn-hangzhou.aliyuncs.com/oss-34360168-qJBteAyaIO84ZQoZx3DwyB8.docx?spm=a2o10q.20481151.0.0.47462c756iXGy2&Expires=1640000716&OSSAccessKeyId=************"
    }],
    "mtConfigClientDTO":
    {
        "mtUse": true,
        "mtConnecterKey": "pixar_normal",
        "appName":"pixar_default",
        "mtType": "system"
    }
}

获取预翻译结果

  • 通过appName 和 AppId 获取预翻译结果。

GET /aitranslation/result.json
{
     "data": {
          "responseDataList": [
               {
                    "fileName": "test_en-US_202112200318.docx",
                    "dataId": "1",
                    "traceFileUrl": "https://alifanyi-pixar-hz.oss-cn-hangzhou.aliyuncs.com/oss-20211220031735777SPCX75RZjK4OVdA.json?Expires=1671535056&OSSAccessKeyId=************",
                    "dataType": "url",
                    "fileUrl": "https://alifanyi-pixar-hz.oss-cn-hangzhou.aliyuncs.com/oss-202112200318102449Qay79xuaXwUWNq.docx?Expires=1671535090&OSSAccessKeyId=************"
               }
          ],
          "bizId": "16"
     },
     "success": true
}

提交字数统计任务

POST /wwc/create.json
{
    "accessKey": "{{accessKey}}",
    "appName": "testing",
    "appId": "16",
    "sourceLang": "zh-CN",
    "targetLang": "en-US",
    "requestDataList": [{
        "dataId": "1",
        "dataType": "url",
        "fileName": "test.docx",
        "fileUrl": "https://alifanyi-pixar-hz.oss-cn-hangzhou.aliyuncs.com/oss-34360168-qJBteAyaIO84ZQoZx3DwyB8.docx?spm=a2o10q.20481151.0.0.47462c756iXGy2&Expires=1640000716&OSSAccessKeyId=************"
    }]
}

获取字数统计结果

GET /wwc/result.json
accessKey={{accessKey}}
appName={{appName}}
appId={{appId}}

{
    "data":{
        "total": {
            "unitCount": 0,
            "segmentCount": 0
        },
        "dataDetail":{},
        "progress": 0.0,
        "finished": false,
        "updateTime": 1640240875097
    },
    "success": true
}

模型列表

GET /aitranslation/models.json

参数说明

参数名称

参数含义

参数类型

是否必填

accessKey

访问密钥

string

pageNum

页码

int

pageSize

页大小

int

status

模型状态

init - 待训练 training - 训练中 trained - 训练完成 deploying - 发布中 deployed - 已发布 disabled - 不可用

list

domain

领域

List<string>

返回结果

{
    "data":
    {
        "total": 1,
        "records":
        [
         
            {
                "languagePairs":
                [
                    {
                        "targetLanguage":
                        {
                            "code": "en",
                            "name": "en-US",
                            "id": 1
                        },
                        "sourceLanguage":
                        {
                            "code": "zh",
                            "name": "zh-CN",
                            "id": 2
                        }
                    }
                ],
                "termbases":
                [
                    {
                        "modifiedTime": 1675655625000,
                        "languages":
                        [
                            "zh-CN",
                            "en-US"
                        ],
                        "creatorId": 22,
                        "creatorName": "user22",
                        "modifierId": 22,
                        "name": "ES术语库(动漫)",
                        "createdTime": 1675655403000,
                        "id": 58270001,
                        "modifierName": "user22"                    }
                ],
                "domain": "knn_general",
                "name": "模型列表接口",
                "type": "knn",
                "key": "710001",
                "tmGroups":
                [
                    {
                        "unitCount": 1187,
                        "creatorId": 22,
                        "creatorName": "杰凯思科技(北京)有限公司",
                        "modifierId": 22,
                        "labels":
                        {
                            "tmType":
                            [
                                "temporary"
                            ],
                            "language_direction":
                            [
                                "zh-CN2en-US",
                                "en-US2zh-CN",
                                "zh-CN2zh-CN",
                                "en-US2en-US"
                            ]
                        },
                        "translationMemoryGroupId": 1760005,
                        "modifiedDate": 1675422198000,
                        "name": "昱升测试",
                        "modifierName": "user22"
                    }
                ]
            }
        ],
        "pageSize": 10,
        "pageNum": 1
    },
    "success": true
}

返回结果说明

参数名称

参数含义

参数类型

total/pageNum/pageSize

分页信息

int

name

模型名称

string

type

模型类型

string

key

模型标识

string

domain

模型领域

string

tmGroups

模型关联的语料库信息

object list

termbases

模型关联的术语库信息

object list

languagePairs

模型支持的语向

object list

文本实时翻译

GET /aitranslation/predict.json

参数:
sourceLanguage={{sourceLanguageCode, 如zh-CN}}
targetLanguage={{targetLanguageCode,如 en-US}}
accessKey={{accessKey}}
sourceText=公司党委认为另有需要董事会、经理层决策的重大问题,可向董事会、经理层提出;
type=knn(模型类型,knn-在线学习,ai-自学习模型,system-阿里内部机翻模型)
key=2840001(模型唯一标识)

返回:
{
  "data": "The party committee of the company may present any major issue when it considers to be necessary for the board of directors and the managers to deliberate on.",
  "success": true
}

参数说明

参数名称

参数含义

参数类型

是否必填

accessKey

访问密钥

string

sourceLanguage

源语言

string

targetLanguage

目标语言

string

type

模型类型,模型列表接口返回的 type,可选值:

ai - alynx训练的自学习模型

knn - 在线学习模型

system - 阿里内部模型

string

key

模型唯一标识,模型列表返回的 key,对不同类型模型,key的值分别如下:

ai,knn
该值为alynx创建的模型ID
------
system - 领域相关,可选值如下:
通用 - pixar_default
电商 - pixar_offer
社交 - pixar_message
科技 - pixar_general
金融 - pixar_finance
医疗 - pixar_medical

string

sourceText

待翻译原文

string