TextModerationOperations Class

TextModerationOperations operations.

Inheritance
builtins.object
TextModerationOperations

Constructor

TextModerationOperations(client, config, serializer, deserializer)

Parameters

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

text_content_type
str
Required

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

text_content
<xref:Generator>
Required

Content to screen.

custom_headers
dict
default value: None

headers that will be added to the request

raw
bool
default value: False

returns the direct response alongside the deserialized response

callback
<xref:Callable>[<xref:Bytes>, <xref:response=None>]
default value: 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.

operation_config
Required

Operation configuration overrides.

Returns

DetectedLanguage or ClientRawResponse if raw=true

Return type

Exceptions

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

text_content_type
str
Required

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

text_content
<xref:Generator>
Required

Content to screen.

language
str
default value: None

Language of the text.

autocorrect
bool
default value: False

Autocorrect text.

pii
bool
default value: False

Detect personal identifiable information.

list_id
str
default value: None

The list Id.

classify
bool
default value: False

Classify input.

custom_headers
dict
default value: None

headers that will be added to the request

raw
bool
default value: False

returns the direct response alongside the deserialized response

callback
<xref:Callable>[<xref:Bytes>, <xref:response=None>]
default value: 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.

operation_config
Required

Operation configuration overrides.

Returns

Screen or ClientRawResponse if raw=true

Return type

Exceptions

Attributes

models

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