你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

SentimentSkill 类

V1:文本分析正负情绪分析,评分为 0 到 1 范围内的浮点值。 V3:使用 文本分析 API 评估非结构化文本,并针对每个记录,根据服务在句子和文档级别找到的最高置信度分数,提供情绪标签 (,例如“负面”、“中性”和“积极”) 。

必须填充所有必需的参数才能发送到 Azure。

继承
azure.search.documents.indexes._generated.models._models_py3.SearchIndexerSkill
SentimentSkill

构造函数

SentimentSkill(**kwargs)

变量

名称 说明
odata_type
str

必需。 标识技能的具体类型。由服务器填充的常量。

name
str

在技能集中唯一标识技能的技能的名称。 未定义名称的技能将在技能数组中为其基于 1 的索引提供默认名称,前缀为字符“#”。

description
str

技能的说明,描述技能的输入、输出和用法。

context
str

表示执行操作的级别,例如文档根或文档内容 (例如 /document 或 /document/content) 。 默认值为 /document。

inputs

必需。 技能的输入可以是源数据集中的列,也可以是上游技能的输出。

outputs

必需。 技能的输出要么是搜索索引中的字段,要么是另一个技能可以用作输入的值。

default_language_code

一个值,该值指示要使用的语言代码。 默认值为 en。 可能的值包括:“da”、“nl”、“en”、“fi”、“fr”、“de”、“el”、“it”、“no”、“pl”、“pt-PT”、“ru”、“es”、“sv”、“tr”。

include_opinion_mining

如果设置为 true,则技能输出将包含用于观点挖掘文本分析的信息,即 (名词或动词) 及其相关评估 (文本中的形容词) 。 默认值为 false。

model_version
str

调用 文本分析 服务时要使用的模型版本。 如果未指定,将默认为最新可用版本。 建议不要指定此值,除非绝对必要。

skill_version

调用 文本分析 服务时要使用的技能版本。 如果未指定,它将默认为 V1。

方法

as_dict

返回可使用 json.dump 进行序列化的 dict。

高级用法可以选择使用回调作为参数:

Key 是 Python 中使用的属性名称。 Attr_desc是元数据的一个听写。 当前包含具有 msrest 类型的“type”和包含 RestAPI 编码键的“key”。 值是此对象中的当前值。

返回的字符串将用于序列化密钥。 如果返回类型是列表,则这被视为分层结果听写。

请参阅此文件中的三个示例:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

如果需要 XML 序列化,可以传递 kwargs is_xml=True。

deserialize

使用 RestAPI 语法分析 str 并返回模型。

enable_additional_properties_sending
from_dict

使用给定的键提取程序分析 dict 返回一个模型。

默认情况下,请考虑密钥提取程序 (rest_key_case_insensitive_extractor、attribute_key_case_insensitive_extractor和last_rest_key_case_insensitive_extractor)

is_xml_model
serialize

返回将从此模型发送到服务器的 JSON。

这是as_dict (full_restapi_key_transformer的别名 ,keep_readonly=False)

如果需要 XML 序列化,可以传递 kwargs is_xml=True。

as_dict

返回可使用 json.dump 进行序列化的 dict。

高级用法可以选择使用回调作为参数:

Key 是 Python 中使用的属性名称。 Attr_desc是元数据的一个听写。 当前包含具有 msrest 类型的“type”和包含 RestAPI 编码键的“key”。 值是此对象中的当前值。

返回的字符串将用于序列化密钥。 如果返回类型是列表,则这被视为分层结果听写。

请参阅此文件中的三个示例:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

如果需要 XML 序列化,可以传递 kwargs is_xml=True。

as_dict(keep_readonly: bool = True, key_transformer: ~typing.Callable[[str, ~typing.Dict[str, ~typing.Any], ~typing.Any], ~typing.Any] = <function attribute_transformer>, **kwargs: ~typing.Any) -> MutableMapping[str, Any]

参数

名称 说明
key_transformer
<xref:function>

密钥转换器函数。

keep_readonly
默认值: True

返回

类型 说明

与 dict JSON 兼容的对象

deserialize

使用 RestAPI 语法分析 str 并返回模型。

deserialize(data: Any, content_type: str | None = None) -> ModelType

参数

名称 说明
data
必需
str

使用 RestAPI 结构的 str。 默认情况下为 JSON。

content_type
str

默认情况下,如果 XML,则设置 application/xml。

默认值: None

返回

类型 说明

此模型的实例

例外

类型 说明
DeserializationError if something went wrong

enable_additional_properties_sending

enable_additional_properties_sending() -> None

from_dict

使用给定的键提取程序分析 dict 返回一个模型。

默认情况下,请考虑密钥提取程序 (rest_key_case_insensitive_extractor、attribute_key_case_insensitive_extractor和last_rest_key_case_insensitive_extractor)

from_dict(data: Any, key_extractors: Callable[[str, Dict[str, Any], Any], Any] | None = None, content_type: str | None = None) -> ModelType

参数

名称 说明
data
必需

使用 RestAPI 结构的 dict

content_type
str

默认情况下,如果 XML,则设置 application/xml。

默认值: None
key_extractors
默认值: None

返回

类型 说明

此模型的实例

例外

类型 说明
DeserializationError if something went wrong

is_xml_model

is_xml_model() -> bool

serialize

返回将从此模型发送到服务器的 JSON。

这是as_dict (full_restapi_key_transformer的别名 ,keep_readonly=False)

如果需要 XML 序列化,可以传递 kwargs is_xml=True。

serialize(keep_readonly: bool = False, **kwargs: Any) -> MutableMapping[str, Any]

参数

名称 说明
keep_readonly

如果要序列化只读属性

默认值: False

返回

类型 说明

与 dict JSON 兼容的对象