Retrieving Tagged Tables in Form Recognizer
I created a custom model using Form Recognizer Studio and tested it using the sample forms. The results in Form Recognizer Studio come out perfect. I can see the correct results in the Fields tab and in the JSON results in the analyzeResult/documents/fields/mytablename...
However, when I try to look at the JSON file in my program using:
AnalyzeDocumentOperation operation = await client.AnalyzeDocumentFromUriAsync(WaitUntil.Completed, modelId, fileUri);
AnalyzeResult result = operation.Value;
string strJson = JsonSerializer.Serialize(result);
Console.WriteLine(strJson);
the JSON file is structured differently. Most of the document/field/values are all available just like in Form Recognizer Studio. However, the document/field/values for the table are all Null.
Further, it appears that using:
DocumentTable table = result.Tables[i];
Console.WriteLine($" Table {i} has {table.RowCount} rows and {table.ColumnCount} columns.");
foreach (DocumentTableCell cell in table.Cells)
{
Console.WriteLine($" Cell ({cell.RowIndex}, {cell.ColumnIndex}) has kind '{cell.Kind}' and content: '{cell.Content}'.");
}
you are unable to return a tagged table. Instead, you get all the tables that were recognized.
So, the only other option I see is to try and use one of the untagged tables from result.Table. However, this does not work for my application since the result.Table values are too unpredictable and messy.
Is there a way yet to access tagged tables from script? Or, is there a way to get a matching JSON file to that in the Result tab of Form Recognizer Studio?