可能发生的事情
我猜您使用的是 Watson Discovery 提供的 Default Configuration。 Default Configuration 将扩充应用于输入数据中的单个字段,该字段名为 text。默认情况下,HTML、PDF 和 Microsoft Word 的转换器会将文档的正文输出到 JSON 字段 text。当您将 JSON 发送到 Watson Discovery 时,不会进行任何转换 - 字段名称会直接传递。
你可以尝试什么
- 调整您的输入 JSON,使其具有一个名为
text 的顶级字段,其中包含您要丰富的文本。
- 制作并使用自定义配置,其中
enrichments 下的一个或多个条目(其值为 source_field)是您希望 Watson Discovery 丰富的 JSON 中的字段名称。
Watson Discovery Tooling 对于试验自定义配置非常有帮助。
示例
具体说明一下。这是Default Configuration 的enrichments 部分:
"enrichments": [{
"destination_field": "enriched_text",
"source_field": "text",
"enrichment": "alchemy_language",
"options": {
"extract": "keyword, entity, doc-sentiment, taxonomy, concept, relation",
"sentiment": true,
"quotations": true
}
}]
如果您的 JSON 在名为 paragraphs 的字段中包含英文文本,并且您希望 Watson Discovery 为该字段提供丰富内容,则可以使用以下配置:
"enrichments": [{
"destination_field": "enriched_paragraphs",
"source_field": "paragraphs",
"enrichment": "alchemy_language",
"options": {
"extract": "keyword, entity, doc-sentiment, taxonomy, concept, relation",
"sentiment": true,
"quotations": true
}
}]