Skip to content

Commit

Permalink
[formrecognizer] Print fields in custom documents samples (Azure#20904)
Browse files Browse the repository at this point in the history
* print fields in samples

* review feedback
  • Loading branch information
catalinaperalta authored Sep 29, 2021
1 parent 5aadfb2 commit ffeb366
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ async def analyze_custom_documents_async(custom_model_id):
print("Document has type {}".format(document.doc_type))
print("Document has document type confidence {}".format(document.confidence))
print("Document was analyzed with model with ID {}".format(result.model_id))
for name, field in document.fields.items():
field_value = field.value if field.value else field.content
print("......found field of type '{}' with value '{}' and with confidence {}".format(field.value_type, field_value, field.confidence))

# iterate over tables, lines, and selection marks on each page
for page in result.pages:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ def analyze_custom_documents(custom_model_id):
print("Document has type {}".format(document.doc_type))
print("Document has document type confidence {}".format(document.confidence))
print("Document was analyzed with model with ID {}".format(result.model_id))
for name, field in document.fields.items():
field_value = field.value if field.value else field.content
print("......found field of type '{}' with value '{}' and with confidence {}".format(field.value_type, field_value, field.confidence))


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

0 comments on commit ffeb366

Please sign in to comment.