你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Text Moderation - Detect Language
此操作将检测输入内容的语言。 它返回所提交文本中主要语言的 ISO 639-3 代码 。 支持超过 110 种语言。
POST {Endpoint}/contentmoderator/moderate/v1.0/ProcessText/DetectLanguage
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
Endpoint
|
path | True |
string |
支持的 Azure 认知服务终结点 (协议和主机名,例如 https://westus.api.cognitive.microsoft.com) 。 |
请求头
Media Types: "text/plain", "text/html", "text/xml", "text/markdown"
名称 | 必需 | 类型 | 说明 |
---|---|---|---|
Ocp-Apim-Subscription-Key | True |
string |
|
Content-Type | True |
string |
内容类型。 |
请求正文
Media Types: "text/plain", "text/html", "text/xml", "text/markdown"
名称 | 类型 | 说明 |
---|---|---|
Text Content |
object |
到屏幕的内容。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
检测到语言结果。 |
|
Other Status Codes |
错误响应。 |
安全性
Ocp-Apim-Subscription-Key
类型:
apiKey
在:
header
示例
Detect Language request
示例请求
POST {Endpoint}/contentmoderator/moderate/v1.0/ProcessText/DetectLanguage
"Is this a crap email abcdef@abcd.com, phone: 6657789887, IP: 255.255.255.255, 1 Microsoft Way, Redmond, WA 98052"
示例响应
{
"DetectedLanguage": "eng",
"Status": {
"Code": 3000,
"Description": "OK",
"Exception": ""
},
"TrackingId": "2826a49-b976-419e-98e8-c5532c1n78c6"
}
定义
名称 | 说明 |
---|---|
APIError |
API 返回的错误信息。 |
Detected |
检测到语言结果。 |
Error |
错误正文。 |
Status |
状态属性。 |
APIError
API 返回的错误信息。
名称 | 类型 | 说明 |
---|---|---|
Error |
错误正文。 |
DetectedLanguage
检测到语言结果。
名称 | 类型 | 说明 |
---|---|---|
DetectedLanguage |
string |
检测到的语言。 |
Status |
检测到的语言状态。 |
|
TrackingId |
string |
跟踪 ID。 |
Error
错误正文。
名称 | 类型 | 说明 |
---|---|---|
Code |
string |
|
Message |
string |
Status
状态属性。
名称 | 类型 | 说明 |
---|---|---|
Code |
integer |
状态代码。 |
Description |
string |
状态说明。 |
Exception |
string |
异常状态。 |