Azure搜索为什么在Merged_content字段中不正确顺序合并OCRED文本?
我需要开发自己的WebAPI自定义技能,使我们成为读取API
。我将在我的自定义技能中使用它。我不能使用 Azure认知搜索
的内置 OCR技能
(
我的WebAPI技能的t输出看起来像这样:
// logic to get result...
// now creating output to custom skill
var textUrlFileResults = results.AnalyzeResult.ReadResults;
foreach (ReadResult page in textUrlFileResults)
{
var newValue = new
{
RecordId = value.RecordId,
Data = new
{
text = string.Join(" ", page.Lines?.Select(x => x.Text))
}
};
output.Values.Add(newValue);
}
}
return new OkObjectResult(output);
这是我的 skill> skill> skillseet
定义:
"skills": [
{
"@odata.type": "#Microsoft.Skills.Text.MergeSkill",
"name": "#1",
"context": "/document",
"insertPreTag": " ",
"insertPostTag": " ",
"inputs": [
{
"name": "text",
"source": "/document/content"
},
{
"name": "itemsToInsert",
"source": "/document/normalized_images/*/text"
},
{
"name": "offsets",
"source": "/document/normalized_images/*/contentOffset"
}
],
"outputs": [
{
"name": "mergedText",
"targetName": "merged_content"
}
]
},
{
"@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",
"name": "#2",
"description": null,
"context": "/document/normalized_images/*",
// i cut some info
"inputs": [
{
"name": "image",
"source": "/document/normalized_images/*"
}
],
"outputs": [
{
"name": "text",
"targetName": "text"
}
]
}
],
和索引中,我得到了这样的文档:
{
"@odata.context": " cutted ",
"value": [
{
"@search.score": 1,
"content": "\nText before shell\n\nText after shell\n\nText after bw\n\n\n\n\n\n\n\nAnd here second page\n\n\n",
"merged_content": "\nText before shell\n\nText after shell\n\nText after bw\n\n SHELL 1900 1904 1909 1930 1948 SHELL SHELL Shell Shell 1955 1961 1971 1995 1999 \n\n B+W BLACK+WHITE PHOTOGRAPHY \n\n\n\nAnd here second page\n\n\n",
"text": [
"SHELL 1900 1904 1909 1930 1948 SHELL SHELL Shell Shell 1955 1961 1971 1995 1999",
"B+W BLACK+WHITE PHOTOGRAPHY"
],
"layoutText": [],
"textFromOcr": "[\"SHELL 1900 1904 1909 1930 1948 SHELL SHELL Shell Shell 1955 1961 1971 1995 1999\",\"B+W BLACK+WHITE PHOTOGRAPHY\"]"
}
]
}
我的问题是,当我使用/document/document/normalized_images/*/时,为什么使用标准文本以正确的顺序将Ocred Text放置在正确的顺序上。 contentOffset“
in mergeskill
?说实话,我的技能集是从 ms docs ,并且它无法正常工作。我不太了解,什么特殊来自 ocr
ocr技能
。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,这就是设计通过设计的行为。它首先获取文本,然后将图像翻译放在底部。由于实现限制,这不是此时使用代码内使用代码的事情。更改 ocr技能文档希望本周发表,以澄清和避免混乱。
Unfortunately, that is the behavior of the skill by design. It gets the text first and leave the image translation at the bottom. This is not something that can be changed at this time with code within the skill due to an implementation limitation. Changes to OCR skill documentation have been made to reflect this, and it will be published hopefully this week, to clarify and avoid confusion.