我正在使用计算机视觉 API C# 快速入门中提供的示例 我能够获得 JSON 结果,如示例中所示,但无法仅获得文本内容。
JSON的样本格式如下:
{
"textAngle": 0.020943951023932542,
"orientation": "NotDetected",
"language": "de",
"regions": [
{
"boundingBox": "46,54,59,71",
"lines": [
{
"boundingBox": "48,54,49,19",
"words": [
{
"boundingBox": "48,54,49,19",
"text": "Hello"
}
]
},
{
"boundingBox": "46,106,59,19",
"words": [
{
"boundingBox": "46,106,59,19",
"text": "World"
}
]
}
]
}
]
}
现在,我正在使用 JSON 转换器通过使用下面的类结构为每个单词添加换行符来提取文本节点。
public class Region
{
public string BoundingBox { get; set; }
public List<Line> Lines { get; set; }
}
public class Line
{
public string BoundingBox { get; set; }
public List<Word> Words { get; set; }
}
public class Word
{
public string BoundingBox { get; set; }
public string Text { get; set; }
}
API 中是否提供了任何请求参数来获取响应本身中的直接文本?