TextModerationOperations 類別

TextModerationOperations 作業。

繼承
builtins.object
TextModerationOperations

建構函式

TextModerationOperations(client, config, serializer, deserializer)

參數

名稱 Description
client
必要

服務要求的用戶端。

config
必要

服務用戶端的設定。

serializer
必要

物件模型序列化程式。

deserializer
必要

物件模型還原序列化程式。

方法

detect_language

這項作業會偵測指定輸入內容的語言。 針對組成提交文字的主要語言,傳回 ISO 639-3 代碼 。 支援超過 110 種語言。

screen_text

偵測不雅內容,並比對自訂和共用的封鎖清單。

偵測超過 100 種語言的粗話,並比對自訂和共用的封鎖清單。

detect_language

這項作業會偵測指定輸入內容的語言。 針對組成提交文字的主要語言,傳回 ISO 639-3 代碼 。 支援超過 110 種語言。

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

參數

名稱 Description
text_content_type
必要
str

內容型別。 可能的值包括:'text/plain'、'text/html'、'text/xml'、'text/markdown'

text_content
必要

要畫面的內容。

custom_headers

將新增至要求的標頭

預設值: None
raw

傳回與還原序列化回應一起的直接回應

預設值: False
callback
Callable[<xref:Bytes>, <xref:response=None>]

指定時,將會使用串流處理的每個資料區塊來呼叫 。 回呼應該採用兩個引數:目前資料區塊的位元組和回應物件。 如果資料正在上傳,回應會是 None。

預設值: None
operation_config
必要

作業組態覆寫

傳回

類型 Description
<xref:msrest.pipeline.ClientRawResponse>

DetectedLanguage 或 ClientRawResponse if raw=true

例外狀況

類型 Description

screen_text

偵測不雅內容,並比對自訂和共用的封鎖清單。

偵測超過 100 種語言的粗話,並比對自訂和共用的封鎖清單。

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)

參數

名稱 Description
text_content_type
必要
str

內容型別。 可能的值包括:'text/plain'、'text/html'、'text/xml'、'text/markdown'

text_content
必要

要畫面的內容。

language
str

文字的語言。

預設值: None
autocorrect

自動校正文字。

預設值: False
pii

偵測個人識別資訊。

預設值: False
list_id
str

清單識別碼。

預設值: None
classify

分類輸入。

預設值: False
custom_headers

將新增至要求的標頭

預設值: None
raw

傳回與還原序列化回應一起的直接回應

預設值: False
callback
Callable[<xref:Bytes>, <xref:response=None>]

指定時,將會使用串流處理的每個資料區塊來呼叫 。 回呼應該採用兩個引數:目前資料區塊的位元組和回應物件。 如果資料正在上傳,回應會是 None。

預設值: None
operation_config
必要

作業組態覆寫

傳回

類型 Description
<xref:msrest.pipeline.ClientRawResponse>

如果 raw=true,則 Screen 或 ClientRawResponse

例外狀況

類型 Description

屬性

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