Queries custom text libraries. You can use text libraries for text anti-spam. The effect of managing custom text libraries by calling API operations is the same as that of managing custom text libraries in the Alibaba Cloud Content Moderation console.

Operation 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 structure. You can also select an existing HTTP request. For more information, see SDK overview.

Billing method: This operation is free of charge.

QPS limit

You can send up to 10 requests per second to call this operation by using your Alibaba Cloud account. If you send an excessive number of requests, throttling is implemented, and your business may be affected.

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.
Parameter Type Required Example Description
ServiceModule String Yes open_api

The name of the service module. Set the value to open_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.
Parameter Type Example Description
Id Integer 2147 The primary key ID of the text library.
ModifiedTime String 2018-09-04 14:17:56 +0800 The last time when the text library was modified.
Name String test1sdkdk The name of the text library.
Code String 710001 The code of the text library.
Note The code of the text library appears in the Alibaba Cloud Content Moderation console. The primary key ID is used to identify the text library in the operation.
Count String 3 The number of samples in the text library.
Category String BLACK The category of the text library. Valid values:
  • BLACK: a blacklist
  • WHITE: a whitelist
  • REVIEW: a review list
Source String MANUAL The source of the text library.
Note The value is fixed to MANUAL, which indicates that the text library is manually added.
BizTypes StringArray ["bizTypeA","bizTypeB"] The business type of the custom text library that you set on the Moderation Policy tab by choosing Settings > Moderation API.
ResourceType String TEXT The resource type 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 converted from audio is matched
LibType String textKeyword The type 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

MatchMode String fuzzy The matching method. Valid values:
  • fuzzy: fuzzy matching
  • precise: exact matching
Enable Boolean true Indicates whether the text library was enabled.
  • true: The text library was enabled.
  • false: The text library was disabled.

Examples

Sample requests
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": "Audio test",
        "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
}