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.

Usage note

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: 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. A value of open_api indicates that you want to query the text libraries used in 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.
Parameter Type Example Description
Id Integer 2147 The ID of the text library.
ModifiedTime String 2018-09-04 14:17:56 +0800 The time when the text library was last modified.
Name String test1sdkdk The name of the text library.
Code String 710001 The code of the text library.
Note In the left-side navigation pane of the console, click 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.
Count String 3 The number of text entries in the text library.
Category String BLACK The category of the text library. Valid values:
  • BLACK: a blacklist. If the text hits a text entry in the text library, the text contains violations. You can delete or block the text.
  • WHITE: a whitelist. If the text hits a text entry in the text library, the text is normal and does not need further operations.
  • REVIEW: a review list. If the text hits a text entry in the text library, the text needs a manual review.
Source String MANUAL The source of the custom text library. Valid values:
  • MANUAL: The text library was manually created.
  • FEEDBACK: Content Moderation automatically created the text library.
BizTypes StringArray ["bizTypeA","bizTypeB"] The business scenario of the custom text library. The name of the business scenario is specified when you create a business scenario on the BizType Manage tab. To go to the tab, choose Settings > Machine audit in the left-side navigation pane.
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 recognized 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 match
  • precise: exact match
Enable Boolean true The status of the text library.
  • true: enabled
  • false: 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 requests
http(s)://green.cn-shanghai.aliyuncs.com/?
Action=DescribeKeywordLib&ServiceModule=open_api
&<Common request parameters>
Sample 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
}