All Products
Search
Document Center

Content Moderation:Multi-language services provided by Text Moderation 2.0

Last Updated:Oct 11, 2024

Text Moderation 2.0 enhances multi-language model capabilities. It supports more languages and can automatically identify languages. In consideration of the characteristics of global business, Text Moderation 2.0 adopts separate moderation policies and a separate internationalization labeling system. This topic describes the details of the multi-language services provided by Text Moderation 2.0 and how to use them.

Feature introduction

Compared with the multi-language services of Text Moderation 1.0, Text Moderation 2.0 utilizes separate moderation policies and a separate internationalization labeling system to meet the requirements of global business. In addition, it provides more features to simplify service usage and assist in manual review.

Comparison item

Text Moderation 2.0

Text Moderation 1.0

Multi-language capability

Supports 38 languages.

Supports 18 languages.

Moderation capability

Utilizes multiple models and incorporates language and regional characteristics. The moderation policies are more accurate.

Utilizes a single model and incorporates language characteristics. The moderation policies take into account accuracy and recall.

Labeling system

Utilizes a separate internationalization labeling system for global business, adds internationalization labels such as profanities and regions, and supports multiple risk labels and subcategory labels.

Inherits the labeling system from earlier versions and supports only one single risk label for a text moderation task.

Operation

You do not need to specify an input language, and Text Moderation 2.0 can automatically identify it. After moderation is complete, the language type and translated English content are returned to assist in manual review.

You need to specify an input language. No translation is returned.

Supported languages

The multi-language services of Text Moderation 2.0 support 38 languages.

Language type

Name

Language code

English

English

en

Simplified Chinese

Chinese

zh

Traditional Chinese

Traditional Chinese

zh-tw

Indonesian

Indonesian

id

Malay

Malay

ms

Thai

Thai

th

Vietnamese

Vietnamese

vi

Tagalog

Tagalog

tl

Hindi

Hindi

hi

Arabic

Arabic

ar

Turkish

Turkish

tr

French

French

fr

German

German

de

Russian

Russian

ru

Portuguese

Portuguese

pt

Spanish

Spanish

es

Italian

Italian

it

Dutch

Dutch

nl

Polish

Polish

pl

Japanese

Japanese

ja

Korean

Korean

ko

Urdu

Urdu

ur

Uighur

Uighur

ug

Bengali

Bengali

bn

Persian

Persian

fa

Swedish

Swedish

sv

Danish

Danish

da

Norwegian

Norwegian

no

Icelandic

Icelandic

is

Finnish

Finnish

fi

Belarusian

Belarusian

be

Lithuanian

Lithuanian

lt

Czech

Czech

cs

Slovak

Slovak

sk

Hungarian

Hungarian

hu

Greek

Modern Greek

el

Romanian

Romanian

ro

Irish

Irish

ga

Internationalization labels

The multi-language services of Text Moderation 2.0 adopt an internationalization labeling system. If the content contains multiple types of risks, multiple labels can be returned at the same time. Label categories include, but are not limited to, those listed in the following table.

Label type

Category

Level-1 labels

  • violence: violence

  • contraband: contraband

  • sexuality: pornography

  • profanity: profanity and abuse

  • pullinTraffic: advertising content

  • regional: regional hostility

  • C_customized: custom library that is hit

Subcategory labels (riskTips)

Subcategory labels are returned in the xxx_yyy format. Example: contraband_Drugs.

Billing methods

Text Moderation 2.0 supports the pay-as-you-go billing method.

Pay-as-you-go

After you activate the Text Moderation 2.0 service, the default billing method is pay-as-you-go. Daily fees are calculated based on the actual usage. If the service is not called, no charge is made.

Moderation type

Supported business scenario (service)

Unit price

Advanced text moderation (text_advanced)

Multi-language moderation in international business scenarios: comment_multilingual_global

USD 0.3 per thousand calls

Use the Text Moderation 2.0 service

Step 1: Activate Text Moderation 2.0

Open the service activation page to activate the Text Moderation 2.0 service.

After you activate the Text Moderation 2.0 service, the default billing method is pay-as-you-go. Daily fees are settled based on the actual usage. If the service is not called, no charge is made. After you call API operations, the billing system automatically charges you based on your usage. For more information, see Billing rules.

Step 2: Grant permissions to a RAM user

Before you call API operations or use SDKs as a Resource Access Management (RAM) user, you must grant permissions to the RAM user. You can create an AccessKey pair for your Alibaba Cloud account and the RAM user. When you call API operations, you must use the AccessKey pair to complete identity verification. For information about how to obtain an AccessKey pair, see Obtain an AccessKey pair.

  1. Log on to the RAM console as a RAM administrator.

  2. Create a RAM user.

    For more information, see Create a RAM user.

  3. Grant the AliyunYundunGreenWebFullAccess system policy to the RAM user.

    For more information, see Grant permissions to a RAM user.

    After completing the preceding operations, you can call the Content Moderation API as the RAM user.

Step 3: Install and use SDKs

The following table lists the supported regions. For more information about the API operation, see Text Moderation 2.0 service in Text Moderation 2.0 SDKs and usage guide.

Region

Public endpoint

Internal endpoint

Singapore

green-cip.ap-southeast-1.aliyuncs.com

green-cip-vpc.ap-southeast-1.aliyuncs.com

Note

If you need SDK sample code in other programming languages, you can call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

API

Usage notes

Service endpoint: https://green-cip.{region}.aliyuncs.com.

You can call the TextModeration operation to create a text moderation task. For more information about how to construct an HTTP request, see Request syntax. You can also select an existing HTTP request. For more information, see Use the Text Moderation 2.0 service.

  • Billing method

    You are charged for calling this operation. You are charged by using the pay-as-you-go billing method only for requests whose HTTP status code is 200. For more information about the billing method, see Billing methods.

QPS limit

You can call this operation up to 100 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.

Request parameters

Parameter

Type

Required

Example

Description

Service

String

Yes

comment_multilingual_global

The type of the moderation service. Valid value: comment_multilingual_global: Multi-language moderation in international business scenarios.

ServiceParameters

JSONString

Yes

The parameters required by the moderation service. The value is a JSON string. For more information about the description of each string, see ServiceParameters.

Table 1 ServiceParameters

Parameter

Type

Required

Example

Description

content

String

Yes

Content to be moderated

The text to be moderated, which must be within 600 characters in length.

accountId

String

No

10123****

The account ID, which uniquely identifies an account.

deviceId

String

No

20240307****

The device ID, which uniquely identifies a device.

deviceToken

String

No

MzQvo1d7scyZ3tl_RcJ******

The device token that is obtained by using the risk control SDK.

Response parameters

Parameter

Type

Example

Description

Code

Integer

200

The returned HTTP status code. For more information, see Error codes.

Data

JSONObject

The moderation results. For more information, see Data.

Message

String

OK

The message that is returned in response to the request.

RequestId

String

AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****

The request ID.

Table 2 Data

Parameter

Type

Example

Description

Labels

String

sexual_content

Labels. Multiple labels are separated by commas (,). Valid values:

  • violence: violence

  • contraband: contraband

  • sexuality: pornography

  • profanity: profanity and abuse

  • pullinTraffic: advertising content

  • regional: regional hostility

  • C_customized: custom library that is hit

Reason

String

{"customizedWords": "HXXXXX","detectedLanguage": "en","riskTips": "sexuality_Suggestive","riskWords": "pxxxxy","translatedContent": "pxxxxy sxxxx,HXXXXX","customizedLibs": "ZXXXXX"}

The JSON string used to locate the cause. Valid values:

  • riskLevel: the risk level, which is returned based on the risk level recommended by the system. Valid values:

    • high

    • medium

    • low

    Note

    The following handling suggestions are recommended: Customers handle high-risk content directly. Manual review should be performed on medium-risk content. Low-risk content can be handled when more risky content is detected. Customers can handle the content on which no risk is detected based on their business requirements.

  • riskTips: subcategory label.

  • riskWords: risky words.

  • customizedWords: customized words.

  • customizedLibs: customized libraries.

  • translatedContent: translated content.

AccountId

String

10123****

The ID of the Alibaba Cloud account.

Note

If you specify the accountId parameter in the request, the value of the accountId parameter is returned in the response.

DeviceId

String

20240307****

The device ID.

Note

If you specify the deviceId parameter in the request, the value of the deviceId parameter is returned in the response.

Examples

Sample requests

{
    "Service": "comment_multilingual_global",
    "ServiceParameters": {
        "content": "testing content",
        "accountId": "10123****"
    }
}

Sample responses:

  • If both the terms in a custom term library and risky words are detected, the following sample code is returned:

{
    "Code": 200,
    "Data": {
        "Labels": "C_customized,profanity",
        "Reason": "{\"riskLevel\":\"high\",\"customizedWords\":\"HXXXXX\",\"detectedLanguage\":\"en\",\"riskTips\":\"sexuality_Suggestive\",\"riskWords\":\"pxxxxy\",\"translatedContent\":\"pxxxxy sxxxx,HXXXXX\",\"customizedLibs\":\"ZXXXXX\"}"
    },
    "Message": "OK",
    "RequestId": "AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****"
}
  • If only the terms in a custom term library are detected, the following sample code is returned:

{
    "Code": 200,
    "Data": {
        "Labels": "C_customized",
        "Reason": "{\"riskLevel\":\"high\",\"customizedWords\":\"HXXXXX\",\"detectedLanguage\":\"en\",\"translatedContent\":\"HXXXXX\",\"customizedLibs\":\"ZXXXXX\"}"
    },
    "Message": "OK",
    "RequestId": "AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****"
}
  • If only risky words are detected, the following sample code is returned:

{
    "Code": 200,
    "Data": {
        "Labels": "sexuality",
        "Reason": "{\"riskLevel\":\"high\",\"detectedLanguage\":\"ar\",\"riskTips\":\"sexuality_Suggestive\",\"riskWords\":\"pxxxxy\",\"translatedContent\":\"pxxxxy sxxxx\"}"
    },
    "Message": "OK",
    "RequestId": "AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****"
}
  • If neither terms in a custom term library nor risky words are detected, the following sample code is returned:

{
    "Code": 200,
    "Data": {
        "Labels": "",
        "Reason": "{\"detectedLanguage\":\"en\",\"translatedContent\":\"AXXXXXX\"}"
    },
    "Message": "OK",
    "RequestId": "AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****"
}

Error codes

HTTP status code

Error code

Description

200

OK

The request is successful.

400

BAD_REQUEST

The request is incorrect. It may be caused by invalid request parameters. Check the request parameters carefully.

407

NOT_SUPPORT

The language is not identified or not supported.

408

PERMISSION_DENY

It may be that your account is not authorized, your account is overdue, your account is not activated, or your account is banned.

500

GENERAL_ERROR

Error. A temporary error may occur on the server. We recommend that you try again. If the error code persists, submit a ticket on Support and Services.

581

TIMEOUT

The operation timed out. We recommend that you try again. If the error code persists, submit a ticket on Support and Services.

588

EXCEED_QUOTA

The QPS exceeds the quota.