Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.48k stars 4.81k forks source link

Form Recognizer: Forms with multiple tables on a page have no name property #23679

Closed vkurpad closed 3 years ago

vkurpad commented 3 years ago

Describe the bug The REST API returns a list of tables with the key for each table being the table name. The value is the table details. The SDK only contains a list of tables with no name property.

Expected behavior Add an additional table name property for each

Actual behavior (include Exception or Stack Trace) What is the actual behavior?

To Reproduce Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)

  1. Create a custom form model with multiple tables on a single page
  2. Analyze the results and the REST API returns a key with the labeled table name but the SDK returns a list of tables with no name property
jsquire commented 3 years ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.

maririos commented 3 years ago

Hi @vkurpad

It looks like you are calling the CustomForms method, right? I am assuming you are looking at the tables under RecognizedForm.Pages[i].Tables where you don't have the table name.

Please note that RecognizedForm.Pages contains information about the recognized form elements present in the input document. Here, no labels assigned by the customer are recognized.

In order to access the fields that have labels set by the user when training the model, you need to access the RecognizedForm.Fields property and look for the name that was assigned to the table, same as you would do with any other field.

For example, if the table name is Expenses you could do:

foreach (FormField field in form.Fields.Values)
{
    if (field.Name == "Expenses")
    {
        ...
    }
}

Here is an example on how to iterate over the table when it is in the Fields section: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/samples/Sample15_DifferentiateOutputLabeledTables.cs#L117

Mode information on RecognizedForm: https://docs.microsoft.com/en-us/dotnet/api/azure.ai.formrecognizer.models.recognizedform?view=azure-dotnet

ghost commented 3 years ago

Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!