Retrieving Tagged Tables in Form Recognizer

Peter Weber 6 Reputation points
2023-04-02T03:36:27.55+00:00

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?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,158 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,236 questions
Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,365 questions
{count} votes