This topic describes how to call the DescribeKeywordLib operation to query the custom text libraries that have been created. 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.

Description

Operation: DescribeKeywordLib

You can call this operation to query custom text libraries.

Request parameters

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

The following table describes the parameters in the request body.
Parameter Type Required Description
ServiceModule String Yes The name of the service module to which the text library is applied. Valid value: open_api (indicates the Content Moderation API).

Response parameters

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

The data 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 Required Description
Id Numeric Yes The primary key ID of the text library.
ModifiedTime String Yes The last time when the text library was modified.
Name String Yes The name of the text library.
Code String Yes 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 Yes The number of terms in the text library.
Category String Yes The category of the text library. Valid values:
  • BLACK: a blacklist.
  • WHITE: a whitelist.
  • REVIEW: a review list.
Source String Yes The source of the text library.
Note The value is fixed to MANUAL, which indicates that the text library is manually added.
ServiceModule String Yes The name of the service module to which the text library is applied. Valid value: open_api (indicates the Content Moderation API).
BizTypes List No The business type of the custom text library that you set on the Moderation Policy tab (by choosing Settings > Moderation API).
ResourceType String Yes 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 Yes 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 No The matching method. Valid values:
  • fuzzy: fuzzy matching.
  • precise: exact matching.
Enable Boolean No Indicates whether the text library was enabled. A value of true indicates that the text library was enabled, and a value of false indicates that the text library was disabled.

Examples

Sample requests
{
  "ServiceModule": open_api
}
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
}