Skip to content

Commit 2fe039f

Browse files
kristapraticorakshith91
authored andcommitted
some small docs fixes/improvements (Azure#18894)
1 parent 12c1ba3 commit 2fe039f

File tree

8 files changed

+46
-41
lines changed

8 files changed

+46
-41
lines changed

sdk/formrecognizer/azure-ai-formrecognizer/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This table shows the relationship between SDK versions and supported API version
3434
|SDK version|Supported API version of service
3535
|-|-
3636
|3.1.0 - Latest GA release| 2.0, 2.1 (default)
37-
37+
|3.0.0| 2.0
3838

3939
#### Create a Form Recognizer resource
4040
Form Recognizer supports both [multi-service and single-service access][multi_and_single_service].
@@ -147,7 +147,7 @@ Sample code snippets are provided to illustrate using a FormRecognizerClient [he
147147
`FormTrainingClient` provides operations for:
148148

149149
- Training custom models without labels to recognize all fields and values found in your custom forms. A `CustomFormModel` is returned indicating the form types the model will recognize, and the fields it will extract for each form type. See the [service documentation][fr-train-without-labels] for a more detailed explanation.
150-
- Training custom models with labels to recognize specific fields, selection marks, and values you specify by labeling your custom forms. A `CustomFormModel` is returned indicating the fields the model will extract, as well as the estimated accuracy for each field. See the [service documentation][fr-train-with-labels] for a more detailed explanation.
150+
- Training custom models with labels to recognize specific fields, selection marks, tables, and values you specify by labeling your custom forms. A `CustomFormModel` is returned indicating the fields the model will extract, as well as the estimated accuracy for each field. See the [service documentation][fr-train-with-labels] for a more detailed explanation.
151151
- Managing models created in your account.
152152
- Copying a custom model from one Form Recognizer resource to another.
153153
- Creating a composed model from a collection of existing trained models with labels.

sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_recognizer_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@
2727

2828
class FormRecognizerClient(FormRecognizerClientBase):
2929
"""FormRecognizerClient extracts information from forms and images into structured data.
30-
It is the interface to use for analyzing receipts, business cards, invoices, recognizing
31-
content/layout from forms, and analyzing custom forms from trained models. It provides
32-
different methods based on inputs from a URL and inputs from a stream.
30+
It is the interface to use for analyzing with prebuilt models (receipts, business cards,
31+
invoices, identity documents), recognizing content/layout from forms, and analyzing
32+
custom forms from trained models. It provides different methods based on inputs from a
33+
URL and inputs from a stream.
3334
3435
:param str endpoint: Supported Cognitive Services endpoints (protocol and hostname,
3536
for example: https://westus2.api.cognitive.microsoft.com).

sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def begin_create_composed_model(self, model_ids, **kwargs):
438438
439439
A composed model allows multiple models to be called with a single model ID. When a document is
440440
submitted to be analyzed with a composed model ID, a classification step is first performed to
441-
route it to the correct custom model
441+
route it to the correct custom model.
442442
443443
:param list[str] model_ids: List of model IDs to use in the composed model.
444444
:keyword str model_name: An optional, user-defined name to associate with your model.

sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,9 @@ class FormPage(object):
627627
returned is 300 per page. The lines are sorted top to bottom, left to right, although in
628628
certain cases proximity is treated with higher priority. As the sorting order depends on
629629
the detected text, it may change across images and OCR version updates. Thus, business
630-
logic should be built upon the actual line location instead of order.
630+
logic should be built upon the actual line location instead of order. The reading order
631+
of lines can be specified by the `reading_order` keyword argument (Note: `reading_order`
632+
only supported in `begin_recognize_content` and `begin_recognize_content_from_url`).
631633
:ivar selection_marks: List of selection marks extracted from the page.
632634
:vartype selection_marks: list[~azure.ai.formrecognizer.FormSelectionMark]
633635

sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_recognizer_client_async.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424

2525
class FormRecognizerClient(FormRecognizerClientBaseAsync):
2626
"""FormRecognizerClient extracts information from forms and images into structured data.
27-
It is the interface to use for analyzing receipts, business cards, invoices, recognizing
28-
content/layout from forms, and analyzing custom forms from trained models. It provides
29-
different methods based on inputs from a URL and inputs from a stream.
27+
It is the interface to use for analyzing with prebuilt models (receipts, business cards,
28+
invoices, identity documents), recognizing content/layout from forms, and analyzing
29+
custom forms from trained models. It provides different methods based on inputs from a
30+
URL and inputs from a stream.
3031
3132
:param str endpoint: Supported Cognitive Services endpoints (protocol and hostname,
3233
for example: https://westus2.api.cognitive.microsoft.com).

sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ async def begin_create_composed_model(
426426
427427
A composed model allows multiple models to be called with a single model ID. When a document is
428428
submitted to be analyzed with a composed model ID, a classification step is first performed to
429-
route it to the correct custom model
429+
route it to the correct custom model.
430430
431431
:param list[str] model_ids: List of model IDs to use in the composed model.
432432
:keyword str model_name: An optional, user-defined name to associate with your model.

sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -54,34 +54,35 @@ async def create_composed_model_async(self):
5454
po_cleaning_supplies = os.environ['PURCHASE_ORDER_OFFICE_CLEANING_SUPPLIES_SAS_URL']
5555

5656
form_training_client = FormTrainingClient(endpoint=endpoint, credential=AzureKeyCredential(key))
57-
supplies_poller = await form_training_client.begin_training(
58-
po_supplies, use_training_labels=True, model_name="Purchase order - Office supplies"
59-
)
60-
equipment_poller = await form_training_client.begin_training(
61-
po_equipment, use_training_labels=True, model_name="Purchase order - Office Equipment"
62-
)
63-
furniture_poller = await form_training_client.begin_training(
64-
po_furniture, use_training_labels=True, model_name="Purchase order - Furniture"
65-
)
66-
cleaning_supplies_poller = await form_training_client.begin_training(
67-
po_cleaning_supplies, use_training_labels=True, model_name="Purchase order - Cleaning Supplies"
68-
)
69-
supplies_model = await supplies_poller.result()
70-
equipment_model = await equipment_poller.result()
71-
furniture_model = await furniture_poller.result()
72-
cleaning_supplies_model = await cleaning_supplies_poller.result()
73-
74-
models_trained_with_labels = [
75-
supplies_model.model_id,
76-
equipment_model.model_id,
77-
furniture_model.model_id,
78-
cleaning_supplies_model.model_id
79-
]
80-
81-
poller = await form_training_client.begin_create_composed_model(
82-
models_trained_with_labels, model_name="Office Supplies Composed Model"
83-
)
84-
model = await poller.result()
57+
async with form_training_client:
58+
supplies_poller = await form_training_client.begin_training(
59+
po_supplies, use_training_labels=True, model_name="Purchase order - Office supplies"
60+
)
61+
equipment_poller = await form_training_client.begin_training(
62+
po_equipment, use_training_labels=True, model_name="Purchase order - Office Equipment"
63+
)
64+
furniture_poller = await form_training_client.begin_training(
65+
po_furniture, use_training_labels=True, model_name="Purchase order - Furniture"
66+
)
67+
cleaning_supplies_poller = await form_training_client.begin_training(
68+
po_cleaning_supplies, use_training_labels=True, model_name="Purchase order - Cleaning Supplies"
69+
)
70+
supplies_model = await supplies_poller.result()
71+
equipment_model = await equipment_poller.result()
72+
furniture_model = await furniture_poller.result()
73+
cleaning_supplies_model = await cleaning_supplies_poller.result()
74+
75+
models_trained_with_labels = [
76+
supplies_model.model_id,
77+
equipment_model.model_id,
78+
furniture_model.model_id,
79+
cleaning_supplies_model.model_id
80+
]
81+
82+
poller = await form_training_client.begin_create_composed_model(
83+
models_trained_with_labels, model_name="Office Supplies Composed Model"
84+
)
85+
model = await poller.result()
8586

8687
print("Office Supplies Composed Model Info:")
8788
print("Model ID: {}".format(model.model_id))

sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_recognize_identity_documents_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async def recognize_identity_documents(self):
3333
path_to_sample_forms = os.path.abspath(os.path.join(os.path.abspath(__file__),
3434
"..", "./../sample_forms/id_documents/license.jpg"))
3535

36-
# [START recognize_identity_documents]
36+
# [START recognize_identity_documents_async]
3737
from azure.core.credentials import AzureKeyCredential
3838
from azure.ai.formrecognizer.aio import FormRecognizerClient
3939

@@ -78,7 +78,7 @@ async def recognize_identity_documents(self):
7878
region = id_document.fields.get("Region")
7979
if region:
8080
print("Region: {} has confidence: {}".format(region.value, region.confidence))
81-
# [END recognize_identity_documents]
81+
# [END recognize_identity_documents_async]
8282

8383
async def main():
8484
sample = RecognizeIdDocumentsSampleAsync()

0 commit comments

Comments
 (0)