你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
TextModerationOperations 类
TextModerationOperations 操作。
- 继承
-
builtins.objectTextModerationOperations
构造函数
TextModerationOperations(client, config, serializer, deserializer)
参数
名称 | 说明 |
---|---|
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)
参数
名称 | 说明 |
---|---|
text_content_type
必需
|
内容类型。 可能的值包括:“text/plain”、“text/html”、“text/xml”、“text/markdown” |
text_content
必需
|
内容到屏幕。 |
custom_headers
|
将添加到请求的标头 默认值: None
|
raw
|
返回直接响应以及反序列化的响应 默认值: False
|
callback
|
Callable[<xref:Bytes>, <xref:response=None>]
指定后,将使用流式传输的每个数据块调用 。 回调应采用两个参数:当前数据区块的字节和响应对象。 如果数据正在上传,响应将为“无”。 默认值: None
|
operation_config
必需
|
操作配置替代。 |
返回
类型 | 说明 |
---|---|
<xref:msrest.pipeline.ClientRawResponse>
|
如果 raw=true,则 DetectedLanguage 或 ClientRawResponse |
例外
类型 | 说明 |
---|---|
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)
参数
名称 | 说明 |
---|---|
text_content_type
必需
|
内容类型。 可能的值包括:“text/plain”、“text/html”、“text/xml”、“text/markdown” |
text_content
必需
|
内容到屏幕。 |
language
|
文本语言。 默认值: None
|
autocorrect
|
自动更正文本。 默认值: False
|
pii
|
检测个人身份信息。 默认值: False
|
list_id
|
列表 ID。 默认值: None
|
classify
|
对输入进行分类。 默认值: False
|
custom_headers
|
将添加到请求的标头 默认值: None
|
raw
|
返回直接响应以及反序列化的响应 默认值: False
|
callback
|
Callable[<xref:Bytes>, <xref:response=None>]
指定后,将使用流式传输的每个数据块调用 。 回调应采用两个参数:当前数据区块的字节和响应对象。 如果数据正在上传,响应将为“无”。 默认值: None
|
operation_config
必需
|
操作配置替代。 |
返回
类型 | 说明 |
---|---|
<xref:msrest.pipeline.ClientRawResponse>
|
如果 raw=true,则为 Screen 或 ClientRawResponse |
例外
类型 | 说明 |
---|---|
属性
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'>