Skip to content

Commit ffeb366

Browse files
[formrecognizer] Print fields in custom documents samples (Azure#20904)
* print fields in samples * review feedback
1 parent 5aadfb2 commit ffeb366

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_analyze_custom_documents_async.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ async def analyze_custom_documents_async(custom_model_id):
6969
print("Document has type {}".format(document.doc_type))
7070
print("Document has document type confidence {}".format(document.confidence))
7171
print("Document was analyzed with model with ID {}".format(result.model_id))
72+
for name, field in document.fields.items():
73+
field_value = field.value if field.value else field.content
74+
print("......found field of type '{}' with value '{}' and with confidence {}".format(field.value_type, field_value, field.confidence))
7275

7376
# iterate over tables, lines, and selection marks on each page
7477
for page in result.pages:

sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_custom_documents.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ def analyze_custom_documents(custom_model_id):
6363
print("Document has type {}".format(document.doc_type))
6464
print("Document has document type confidence {}".format(document.confidence))
6565
print("Document was analyzed with model with ID {}".format(result.model_id))
66+
for name, field in document.fields.items():
67+
field_value = field.value if field.value else field.content
68+
print("......found field of type '{}' with value '{}' and with confidence {}".format(field.value_type, field_value, field.confidence))
69+
6670

6771
# iterate over tables, lines, and selection marks on each page
6872
for page in result.pages:

0 commit comments

Comments
 (0)