All Products
Search
Document Center

Content Moderation:DescribeKeywordLib

Last Updated:Aug 11, 2023

Queries custom text libraries. You can use text libraries for text anti-spam. The information about custom text libraries returned by the API operation is consistent with that about custom text libraries in the Alibaba Cloud Content Moderation console.

Description

Operation: DescribeKeywordLib

You can call this operation to query custom text libraries. 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 SDK overview.

Billing: This operation is free of charge.

QPS limit

You can call this operation up to 10 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

For more information about the common request parameters that must be included in all Content Moderation API requests, see Common parameters.

The following table describes the parameters in the request body.
ParameterTypeRequiredExampleDescription
ServiceModuleStringYesopen_api

The name of the service module. Set the value to open_api. A value of open_api indicates that you want to query the text libraries used in the Content Moderation API.

Response parameters

For more information about common response parameters that this operation returns, see Common response parameters.

The KeywordLibList parameter in the response body is a JSON array. The following table describes the parameters that each element of the JSON array contains.
ParameterTypeExampleDescription
IdInteger2147The ID of the text library.
ModifiedTimeString2018-09-04 14:17:56 +0800The time when the text library was last modified.
NameStringtest1sdkdkThe name of the text library.
CodeString710001The code of the text library.
Note In the left-side navigation pane of the console, choose Machine audit > Risk Libraries. On the page that appears, you can view the codes of text libraries. A code is used to identify a text library in the console, whereas an ID is used to identify a text library when you call API operations.
CountString3The number of text entries in the text library.
CategoryStringBLACKThe category of the text library. Valid values:
  • BLACK: If the text hits a text entry in the text library, the text contains violations. You can delete or block the text.
  • WHITE: If the text hits a text entry in the text library, the text is normal and does not need further operations.
  • REVIEW: If the text hits a text entry in the text library, the text needs a manual review.
SourceStringMANUALIndicates how the custom text library was created. Valid values:
  • MANUAL: The text library was manually created.
  • FEEDBACK: Content Moderation automatically created the text library.
BizTypesStringArray["bizTypeA","bizTypeB"]The business scenario. For more information, see CreateBizType.
ResourceTypeStringTEXTThe category of the text library. Valid values:
  • TEXT: a literal text library.
  • IMAGE: a text library against which text extracted from images is matched.
  • VOICE: a text library against which text recognized from audio is matched.
LibTypeStringtextKeywordThe category of the text library in each moderation scenario. Valid values:
  • Text anti-spam
    • textKeyword: a text library against which terms in text are matched.
    • similarText: a text library against which text patterns are matched.
  • Detection of ads in images

    textKeyword: a text library against which terms extracted from images are matched.

  • Audio anti-spam

    voiceText: a text library against which terms converted from audio are matched.

MatchModeStringfuzzyThe matching method. Valid values:
  • fuzzy: fuzzy match
  • precise: exact match
EnableBooleantrueThe status of the text library.
  • true: The text library is enabled.
  • false: The text library is disabled.
    Note If you want to enable a disabled text library, you can call the CreateKeywordLib operation to change the status of the text library. For more information, see UpdateKeywordLib.

Examples

Sample request
http(s)://green.cn-shanghai.aliyuncs.com/?
Action=DescribeKeywordLib&ServiceModule=open_api
&<Common request parameters>
Sample success responses
{
  "requestId": "795D8871-4889-4C0F-A8B1-C7D2B990FF61",
  "data": {
    "TotalCount": 11,
    "KeywordLibList": [
      {
        "Name": "test1sdkdk",
        "Source": "MANUAL",
        "BizTypes": [],
        "Category": "BLACK",
        "ServiceModule": "open_api",
        "Count": 3,
        "ResourceType": "TEXT",
        "Id": 2147,
        "ModifiedTime": "2018-09-04 14:17:56 +0800",
        "Code": "710001",
        "LibType": "textKeyword",
        "MatchMode":"fuzzy",
        "Enable":"true"
      },
      {
        "Name": "Test001",
        "Source": "MANUAL",
        "BizTypes": [],
        "Category": "BLACK",
        "ServiceModule": "open_api",
        "Count": 3,
        "ResourceType": "VOICE",
        "Id": 2693,
        "ModifiedTime": "2018-09-03 17:11:04 +0800",
        "Code": "932001",
        "LibType": "voiceText",
        "MatchMode":"fuzzy",
        "Enable":"true"
      }
    ]
  },
  "code": 200,
  "success": true
}