Я извлекаю пару значений ключа и таблицы с помощью amazontextract, используя .Net, как мне динамически извлекать данные из пары значений ключа и таблицы, полученные в ответ на анализируемый запрос запроса? код ниже я передаю блок как статическое значение.
AmazonTextractClient Atc = new AmazonTextractClient(credentials, config);
Document MyDocument;
using (Image image = Image.FromFile(imagePath))
{
using (MemoryStream m = new MemoryStream())
{
image.Save(m, image.RawFormat);
MyDocument = new Document()
{
Bytes = m
};
}
}
var DocRequest = new AnalyzeDocumentRequest()
{
Document = MyDocument,
FeatureTypes = new List<string> { FeatureType.FORMS, FeatureType.TABLES }
};
var response = Atc.AnalyzeDocument(DocRequest);
var reg = response.Blocks.ElementAt(20);
var result= reg.Relationships.Select(r=> r.Ids).ToList();
for (int i = 0; i < result.Count; i++)
{
foreach(var str in result[i])
{
int red = response.Blocks.Count;
for (int j = 1; j < red; j++)
{
if (response.Blocks[j].Id == str)
{
textValue = textValue + " " + response.Blocks[j].Text;
break;
}
}
}
}