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 blacklists.

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

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 blacklists.

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

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'>