Using prebuilt-document and forms recognizer service, how to tell the difference between 2 fields named the same thing

Ryan Brown 0 Reputation points
2023-04-19T15:20:04.7466667+00:00

I have a form that has 2 sections for gathering information on a person. Each section has a "Name" field and an "Address" field, etc. When looping through document.fields how can I know which "Name" field it is? One thought was to keep track with a variable (bool first_namefield_found for example) but this would require that the document fields are always returned in the same order. Are the document fields guaranteed to be returned in the same order? Is there some other way to differentiate between fields with the same name?

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,390 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,443 questions
{count} votes

1 answer

Sort by: Most helpful
  1. YutongTie-MSFT 46,996 Reputation points
    2023-04-21T06:39:12.83+00:00

    Hello @Ryan Brown

    Thanks for reaching out to us, I am sorry, I don't think there is a smart way to do so since there is no label in prebuilt model. You may considerate to use rowIndex and columnIndex if you want to do so, but your table need to be very clear.

    I will highly recommend you consider custom model which allows you to label your data, you can differentiate between fields with the same name by using the "label" property of each field. The "label" property is a human-readable description of the field that can be customized in the form definition file.

    Reference - https://learn.microsoft.com/en-us/azure/applied-ai-services/form-recognizer/concept-custom?view=form-recog-3.0.0&tabs=extraction%2Cclassification

    I hope this helps, thanks a lot. Please let me know if you need further help, we are happy to help you.

    Regards, Yutong

    -Please kindly accept the answer if you feel helpful to support the community, thanks.