Skip to content

Commit 78a4a8a

Browse files
[formrecognizer] Small sample fixes (#20959)
* misc sample fixes * update docs * rename and updates
1 parent 7217219 commit 78a4a8a

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@
77
# --------------------------------------------------------------------------
88

99
"""
10-
FILE: sample_analyze_document_async.py
10+
FILE: sample_analyze_prebuilt_document_async.py
1111
1212
DESCRIPTION:
1313
This sample demonstrates how to extract general document information from a document
1414
given through a file.
1515
16-
Note that selection marks returned from begin_analyze_document() do not return the text associated with
17-
the checkbox. For the API to return this information, build a custom model to analyze the checkbox and its text.
18-
See sample_build_model_async.py for more information.
19-
2016
USAGE:
21-
python sample_analyze_document_async.py
17+
python sample_analyze_prebuilt_document_async.py
2218
2319
Set the environment variables with your own values before running the sample:
2420
1) AZURE_FORM_RECOGNIZER_ENDPOINT - the endpoint to your Cognitive Services resource.
@@ -131,7 +127,7 @@ async def analyze_document():
131127
)
132128
for region in cell.bounding_regions:
133129
print(
134-
"...content on page {} is within bounding box '{}'".format(
130+
"...content on page {} is within bounding box '{}'\n".format(
135131
region.page_number,
136132
format_bounding_box(region.bounding_box),
137133
)
@@ -142,7 +138,7 @@ async def analyze_document():
142138
print("Entity of category '{}' with sub-category '{}'".format(entity.category, entity.sub_category))
143139
print("...has content '{}'".format(entity.content))
144140
print("...within '{}' bounding regions".format(format_bounding_region(entity.bounding_regions)))
145-
print("...with confidence {}".format(entity.confidence))
141+
print("...with confidence {}\n".format(entity.confidence))
146142

147143
print("----Key-value pairs found in document----")
148144
for idx, kv_pair in enumerate(result.key_value_pairs):
@@ -155,7 +151,7 @@ async def analyze_document():
155151
)
156152
if kv_pair.value:
157153
print(
158-
"Value '{}' found within '{}' bounding regions".format(
154+
"Value '{}' found within '{}' bounding regions\n".format(
159155
kv_pair.value.content,
160156
format_bounding_region(kv_pair.value.bounding_regions),
161157
)

sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_document.py renamed to sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_analyze_prebuilt_document.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@
77
# --------------------------------------------------------------------------
88

99
"""
10-
FILE: sample_analyze_document.py
10+
FILE: sample_analyze_prebuilt_document.py
1111
1212
DESCRIPTION:
1313
This sample demonstrates how to extract general document information from a document
1414
given through a file.
1515
16-
Note that selection marks returned from begin_analyze_document() do not return the text associated with
17-
the checkbox. For the API to return this information, build a custom model to analyze the checkbox and its text.
18-
See sample_build_model.py for more information.
19-
2016
USAGE:
21-
python sample_analyze_document.py
17+
python sample_analyze_prebuilt_document.py
2218
2319
Set the environment variables with your own values before running the sample:
2420
1) AZURE_FORM_RECOGNIZER_ENDPOINT - the endpoint to your Cognitive Services resource.
@@ -127,7 +123,7 @@ def analyze_document():
127123
)
128124
for region in cell.bounding_regions:
129125
print(
130-
"...content on page {} is within bounding box '{}'".format(
126+
"...content on page {} is within bounding box '{}'\n".format(
131127
region.page_number,
132128
format_bounding_box(region.bounding_box),
133129
)
@@ -138,7 +134,7 @@ def analyze_document():
138134
print("Entity of category '{}' with sub-category '{}'".format(entity.category, entity.sub_category))
139135
print("...has content '{}'".format(entity.content))
140136
print("...within '{}' bounding regions".format(format_bounding_region(entity.bounding_regions)))
141-
print("...with confidence {}".format(entity.confidence))
137+
print("...with confidence {}\n".format(entity.confidence))
142138

143139
print("----Key-value pairs found in document----")
144140
for kv_pair in result.key_value_pairs:
@@ -151,7 +147,7 @@ def analyze_document():
151147
)
152148
if kv_pair.value:
153149
print(
154-
"Value '{}' found within '{}' bounding regions".format(
150+
"Value '{}' found within '{}' bounding regions\n".format(
155151
kv_pair.value.content,
156152
format_bounding_region(kv_pair.value.bounding_regions),
157153
)

0 commit comments

Comments
 (0)