共用方式為


TextModerationOperations Class

TextModerationOperations operations.

Inheritance
builtins.object
TextModerationOperations

Constructor

TextModerationOperations(client, config, serializer, deserializer)

Parameters

Name Description
client
Required

Client for service requests.

config
Required

Configuration of service client.

serializer
Required

An object model serializer.

deserializer
Required

An object model deserializer.

Methods

detect_language

This operation will detect the language of given input content. Returns the ISO 639-3 code for the predominant language comprising the submitted text. Over 110 languages supported.

screen_text

Detect profanity and match against custom and shared blocklists.

Detects profanity in more than 100 languages and match against custom and shared blocklists.

detect_language

This operation will detect the language of given input content. Returns the ISO 639-3 code for the predominant language comprising the submitted text. Over 110 languages supported.

detect_language(text_content_type, text_content, custom_headers=None, raw=False, callback=None, **operation_config)

Parameters

Name Description
text_content_type
Required
str

The content type. Possible values include: 'text/plain', 'text/html', 'text/xml', 'text/markdown'

text_content
Required

Content to screen.

custom_headers

headers that will be added to the request

Default value: None
raw

returns the direct response alongside the deserialized response

Default value: False
callback
Callable[<xref:Bytes>, <xref:response=None>]

When specified, will be called with each chunk of data that is streamed. The callback should take two arguments, the bytes of the current chunk of data and the response object. If the data is uploading, response will be None.

Default value: None
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:msrest.pipeline.ClientRawResponse>

DetectedLanguage or ClientRawResponse if raw=true

Exceptions

Type Description

screen_text

Detect profanity and match against custom and shared blocklists.

Detects profanity in more than 100 languages and match against custom and shared blocklists.

screen_text(text_content_type, text_content, language=None, autocorrect=False, pii=False, list_id=None, classify=False, custom_headers=None, raw=False, callback=None, **operation_config)

Parameters

Name Description
text_content_type
Required
str

The content type. Possible values include: 'text/plain', 'text/html', 'text/xml', 'text/markdown'

text_content
Required

Content to screen.

language
str

Language of the text.

Default value: None
autocorrect

Autocorrect text.

Default value: False
pii

Detect personal identifiable information.

Default value: False
list_id
str

The list Id.

Default value: None
classify

Classify input.

Default value: False
custom_headers

headers that will be added to the request

Default value: None
raw

returns the direct response alongside the deserialized response

Default value: False
callback
Callable[<xref:Bytes>, <xref:response=None>]

When specified, will be called with each chunk of data that is streamed. The callback should take two arguments, the bytes of the current chunk of data and the response object. If the data is uploading, response will be None.

Default value: None
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:msrest.pipeline.ClientRawResponse>

Screen or ClientRawResponse if raw=true

Exceptions

Type Description

Attributes

models

models = <module 'azure.cognitiveservices.vision.contentmoderator.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.9\\x64\\Lib\\site-packages\\azure\\cognitiveservices\\vision\\contentmoderator\\models\\__init__.py'>