Skip to content

Commit 8a82839

Browse files
[formrecognizer] rename id documents -> identity documents (#18474)
* rename on clients * rename for samples * renames for samples, tests, readme, changelog * rename param in tests * rename param in samples * cat's review feedback
1 parent ee47f3b commit 8a82839

File tree

54 files changed

+211
-207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+211
-207
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## 3.1.0b5 (Unreleased)
44

5+
**Breaking Changes**
6+
7+
- `begin_recognize_id_documents` renamed to `begin_recognize_identity_documents`
8+
- `begin_recognize_id_documents_from_url` renamed to `begin_recognize_identity_documents_from_url`
59

610
## 3.1.0b4 (2021-04-06)
711

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ from form documents. It includes the following main functionalities:
99
* Receipt model - Recognize data from sales receipts using a prebuilt model.
1010
* Business card model - Recognize data from business cards using a prebuilt model.
1111
* Invoice model - Recognize data from invoices using a prebuilt model.
12-
* ID document model - Recognize data from ID documents using a prebuilt model.
12+
* Identity document model - Recognize data from identity documents using a prebuilt model.
1313

1414
[Source code][python-fr-src] | [Package (PyPI)][python-fr-pypi] | [API reference documentation][python-fr-ref-docs]| [Product documentation][python-fr-product-docs] | [Samples][python-fr-samples]
1515

@@ -139,7 +139,7 @@ form_recognizer_client = FormRecognizerClient(
139139
- Sales receipts. See fields found on a receipt [here][service_recognize_receipt].
140140
- Business cards. See fields found on a business card [here][service_recognize_business_cards].
141141
- Invoices. See fields found on an invoice [here][service_recognize_invoice].
142-
- ID documents. See fields found on an ID document [here][service_recognize_id_documents].
142+
- Identity documents. See fields found on identity documents [here][service_recognize_identity_documents].
143143
- Recognizing form content, including tables, lines, words, and selection marks, without the need to train a model. Form content is returned in a collection of `FormPage` objects.
144144

145145
Sample code snippets are provided to illustrate using a FormRecognizerClient [here](#recognize-forms-using-a-custom-model "Recognize Forms Using a Custom Model").
@@ -293,7 +293,7 @@ You are not limited to receipts! There are a few prebuilt models to choose from,
293293
- Analyze receipts through the `begin_recognize_receipts` method (fields recognized by the service can be found [here][service_recognize_receipt])
294294
- Analyze business cards through the `begin_recognize_business_cards` method (fields recognized by the service can be found [here][service_recognize_business_cards]).
295295
- Analyze invoices through the `begin_recognize_invoices` method (fields recognized by the service can be found [here][service_recognize_invoice]).
296-
- Analyze identity documents through the `begin_recognize_id_documents` method (fields recognized by the service can be found [here][service_recognize_id_documents]).
296+
- Analyze identity documents through the `begin_recognize_identity_documents` method (fields recognized by the service can be found [here][service_recognize_identity_documents]).
297297

298298

299299
### Train a model
@@ -427,7 +427,7 @@ These code samples show common scenario operations with the Azure Form Recognize
427427
* Recognize receipts from a URL: [sample_recognize_receipts_from_url.py][sample_recognize_receipts_from_url]
428428
* Recognize business cards: [sample_recognize_business_cards.py][sample_recognize_business_cards]
429429
* Recognize invoices: [sample_recognize_invoices.py][sample_recognize_invoices]
430-
* Recognize ID documents: [sample_recognize_id_documents.py][sample_recognize_id_documents]
430+
* Recognize identity documents: [sample_recognize_identity_documents.py][sample_recognize_identity_documents]
431431
* Recognize content: [sample_recognize_content.py][sample_recognize_content]
432432
* Recognize custom forms: [sample_recognize_custom_forms.py][sample_recognize_custom_forms]
433433
* Train a model without labels: [sample_train_model_without_labels.py][sample_train_model_without_labels]
@@ -446,7 +446,7 @@ are found under the `azure.ai.formrecognizer.aio` namespace.
446446
* Recognize receipts from a URL: [sample_recognize_receipts_from_url_async.py][sample_recognize_receipts_from_url_async]
447447
* Recognize business cards: [sample_recognize_business_cards_async.py][sample_recognize_business_cards_async]
448448
* Recognize invoices: [sample_recognize_invoices_async.py][sample_recognize_invoices_async]
449-
* Recognize ID documents: [sample_recognize_id_documents_async.py][sample_recognize_id_documents_async]
449+
* Recognize identity documents: [sample_recognize_identity_documents_async.py][sample_recognize_identity_documents_async]
450450
* Recognize content: [sample_recognize_content_async.py][sample_recognize_content_async]
451451
* Recognize custom forms: [sample_recognize_custom_forms_async.py][sample_recognize_custom_forms_async]
452452
* Train a model without labels: [sample_train_model_without_labels_async.py][sample_train_model_without_labels_async]
@@ -502,7 +502,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
502502
[service_recognize_receipt]: https://aka.ms/formrecognizer/receiptfields
503503
[service_recognize_business_cards]: https://aka.ms/formrecognizer/businesscardfields
504504
[service_recognize_invoice]: https://aka.ms/formrecognizer/invoicefields
505-
[service_recognize_id_documents]: https://aka.ms/formrecognizer/iddocumentfields
505+
[service_recognize_identity_documents]: https://aka.ms/formrecognizer/iddocumentfields
506506
[sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging
507507

508508
[cla]: https://cla.microsoft.com
@@ -526,8 +526,8 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
526526
[sample_recognize_business_cards_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_recognize_business_cards_async.py
527527
[sample_recognize_invoices]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_recognize_invoices.py
528528
[sample_recognize_invoices_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_recognize_invoices_async.py
529-
[sample_recognize_id_documents]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_recognize_id_documents.py
530-
[sample_recognize_id_documents_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_recognize_id_documents_async.py
529+
[sample_recognize_identity_documents]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_recognize_identity_documents.py
530+
[sample_recognize_identity_documents_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_recognize_identity_documents_async.py
531531
[sample_train_model_with_labels]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_with_labels.py
532532
[sample_train_model_with_labels_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_with_labels_async.py
533533
[sample_train_model_without_labels]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_without_labels.py

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

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -343,17 +343,17 @@ def begin_recognize_business_cards_from_url(self, business_card_url, **kwargs):
343343
raise e
344344

345345
@distributed_trace
346-
def begin_recognize_id_documents(self, id_document, **kwargs):
346+
def begin_recognize_identity_documents(self, identity_document, **kwargs):
347347
# type: (Union[bytes, IO[bytes]], Any) -> LROPoller[List[RecognizedForm]]
348-
"""Extract field text and semantic values from a given ID document.
348+
"""Extract field text and semantic values from a given identity document.
349349
The input document must be of one of the supported content types - 'application/pdf',
350350
'image/jpeg', 'image/png', 'image/tiff' or 'image/bmp'.
351351
352-
See fields found on an ID document here:
352+
See fields found on an identity document here:
353353
https://aka.ms/formrecognizer/iddocumentfields
354354
355-
:param id_document: JPEG, PNG, PDF, TIFF, or BMP type file stream or bytes.
356-
:type id_document: bytes or IO[bytes]
355+
:param identity_document: JPEG, PNG, PDF, TIFF, or BMP type file stream or bytes.
356+
:type identity_document: bytes or IO[bytes]
357357
:keyword bool include_field_elements:
358358
Whether or not to include all lines per page and field elements such as lines, words,
359359
and selection marks for each form field.
@@ -373,30 +373,30 @@ def begin_recognize_id_documents(self, id_document, **kwargs):
373373
:raises ~azure.core.exceptions.HttpResponseError:
374374
375375
.. versionadded:: v2.1-preview
376-
The *begin_recognize_id_documents* client method
376+
The *begin_recognize_identity_documents* client method
377377
378378
.. admonition:: Example:
379379
380-
.. literalinclude:: ../samples/sample_recognize_id_documents.py
381-
:start-after: [START recognize_id_documents]
382-
:end-before: [END recognize_id_documents]
380+
.. literalinclude:: ../samples/sample_recognize_identity_documents.py
381+
:start-after: [START recognize_identity_documents]
382+
:end-before: [END recognize_identity_documents]
383383
:language: python
384384
:dedent: 8
385-
:caption: Recognize ID document fields.
385+
:caption: Recognize identity document fields.
386386
"""
387387
content_type = kwargs.pop("content_type", None)
388388
if content_type == "application/json":
389389
raise TypeError(
390-
"Call begin_recognize_id_documents_from_url() to analyze an ID document from a URL."
390+
"Call begin_recognize_identity_documents_from_url() to analyze an identity document from a URL."
391391
)
392392
if content_type is None and kwargs.get("continuation_token", None) is None:
393-
content_type = get_content_type(id_document)
393+
content_type = get_content_type(identity_document)
394394

395395
include_field_elements = kwargs.pop("include_field_elements", False)
396396

397397
try:
398398
return self._client.begin_analyze_id_document_async( # type: ignore
399-
file_stream=id_document,
399+
file_stream=identity_document,
400400
content_type=content_type,
401401
include_text_details=include_field_elements,
402402
cls=kwargs.pop("cls", self._prebuilt_callback),
@@ -406,21 +406,21 @@ def begin_recognize_id_documents(self, id_document, **kwargs):
406406
except ValueError as e:
407407
if "begin_analyze_id_document_async" in str(e):
408408
raise ValueError(
409-
"Method 'begin_recognize_id_documents' is only available for API version V2_1_PREVIEW and up"
409+
"Method 'begin_recognize_identity_documents' is only available for API version V2_1_PREVIEW and up"
410410
)
411411
raise e
412412

413413
@distributed_trace
414-
def begin_recognize_id_documents_from_url(self, id_document_url, **kwargs):
414+
def begin_recognize_identity_documents_from_url(self, identity_document_url, **kwargs):
415415
# type: (str, Any) -> LROPoller[List[RecognizedForm]]
416-
"""Extract field text and semantic values from a given ID document.
417-
The input document must be the location (URL) of the ID document to be analyzed.
416+
"""Extract field text and semantic values from a given identity document.
417+
The input document must be the location (URL) of the identity document to be analyzed.
418418
419-
See fields found on an ID document here:
419+
See fields found on an identity document here:
420420
https://aka.ms/formrecognizer/iddocumentfields
421421
422-
:param str id_document_url: The URL of the ID document to analyze. The input must be a valid, encoded URL
423-
of one of the supported formats: JPEG, PNG, PDF, TIFF, or BMP.
422+
:param str identity_document_url: The URL of the identity document to analyze.
423+
The input must be a valid, encoded URL of one of the supported formats: JPEG, PNG, PDF, TIFF, or BMP.
424424
:keyword bool include_field_elements:
425425
Whether or not to include all lines per page and field elements such as lines, words,
426426
and selection marks for each form field.
@@ -436,14 +436,14 @@ def begin_recognize_id_documents_from_url(self, id_document_url, **kwargs):
436436
:raises ~azure.core.exceptions.HttpResponseError:
437437
438438
.. versionadded:: v2.1-preview
439-
The *begin_recognize_id_documents_from_url* client method
439+
The *begin_recognize_identity_documents_from_url* client method
440440
"""
441441

442442
include_field_elements = kwargs.pop("include_field_elements", False)
443443

444444
try:
445445
return self._client.begin_analyze_id_document_async( # type: ignore
446-
file_stream={"source": id_document_url},
446+
file_stream={"source": identity_document_url},
447447
include_text_details=include_field_elements,
448448
cls=kwargs.pop("cls", self._prebuilt_callback),
449449
polling=True,
@@ -452,7 +452,7 @@ def begin_recognize_id_documents_from_url(self, id_document_url, **kwargs):
452452
except ValueError as e:
453453
if "begin_analyze_id_document_async" in str(e):
454454
raise ValueError(
455-
"Method 'begin_recognize_id_documents_from_url' is "
455+
"Method 'begin_recognize_identity_documents_from_url' is "
456456
"only available for API version V2_1_PREVIEW and up"
457457
)
458458
raise e

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

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -349,18 +349,18 @@ async def begin_recognize_business_cards_from_url(
349349
raise e
350350

351351
@distributed_trace_async
352-
async def begin_recognize_id_documents(
353-
self, id_document: Union[bytes, IO[bytes]], **kwargs: Any
352+
async def begin_recognize_identity_documents(
353+
self, identity_document: Union[bytes, IO[bytes]], **kwargs: Any
354354
) -> AsyncLROPoller[List[RecognizedForm]]:
355-
"""Extract field text and semantic values from a given ID document.
355+
"""Extract field text and semantic values from a given identity document.
356356
The input document must be of one of the supported content types - 'application/pdf',
357357
'image/jpeg', 'image/png', 'image/tiff' or 'image/bmp'.
358358
359-
See fields found on an ID document here:
359+
See fields found on an identity document here:
360360
https://aka.ms/formrecognizer/iddocumentfields
361361
362-
:param id_document: JPEG, PNG, PDF, TIFF, or BMP type file stream or bytes.
363-
:type id_document: bytes or IO[bytes]
362+
:param identity_document: JPEG, PNG, PDF, TIFF, or BMP type file stream or bytes.
363+
:type identity_document: bytes or IO[bytes]
364364
:keyword bool include_field_elements:
365365
Whether or not to include all lines per page and field elements such as lines, words,
366366
and selection marks for each form field.
@@ -380,31 +380,31 @@ async def begin_recognize_id_documents(
380380
:raises ~azure.core.exceptions.HttpResponseError:
381381
382382
.. versionadded:: v2.1-preview
383-
The *begin_recognize_id_documents* client method
383+
The *begin_recognize_identity_documents* client method
384384
385385
.. admonition:: Example:
386386
387-
.. literalinclude:: ../samples/async_samples/sample_recognize_id_documents_async.py
388-
:start-after: [START recognize_id_documents_async]
389-
:end-before: [END recognize_id_documents_async]
387+
.. literalinclude:: ../samples/async_samples/sample_recognize_identity_documents_async.py
388+
:start-after: [START recognize_identity_documents_async]
389+
:end-before: [END recognize_identity_documents_async]
390390
:language: python
391391
:dedent: 8
392-
:caption: Recognize ID documents from a file.
392+
:caption: Recognize identity documents from a file.
393393
"""
394394
content_type = kwargs.pop("content_type", None)
395395
if content_type == "application/json":
396396
raise TypeError(
397-
"Call begin_recognize_id_documents_from_url() to analyze an ID document from a URL."
397+
"Call begin_recognize_identity_documents_from_url() to analyze an identity document from a URL."
398398
)
399399

400400
include_field_elements = kwargs.pop("include_field_elements", False)
401401

402402
if content_type is None and kwargs.get("continuation_token", None) is None:
403-
content_type = get_content_type(id_document)
403+
content_type = get_content_type(identity_document)
404404

405405
try:
406406
return await self._client.begin_analyze_id_document_async( # type: ignore
407-
file_stream=id_document,
407+
file_stream=identity_document,
408408
content_type=content_type,
409409
include_text_details=include_field_elements,
410410
cls=kwargs.pop("cls", self._prebuilt_callback),
@@ -414,22 +414,22 @@ async def begin_recognize_id_documents(
414414
except ValueError as e:
415415
if "begin_analyze_id_document_async" in str(e):
416416
raise ValueError(
417-
"Method 'begin_recognize_id_documents' is only available for API version V2_1_PREVIEW and up"
417+
"Method 'begin_recognize_identity_documents' is only available for API version V2_1_PREVIEW and up"
418418
)
419419
raise e
420420

421421
@distributed_trace_async
422-
async def begin_recognize_id_documents_from_url(
423-
self, id_document_url: str, **kwargs: Any
422+
async def begin_recognize_identity_documents_from_url(
423+
self, identity_document_url: str, **kwargs: Any
424424
) -> AsyncLROPoller[List[RecognizedForm]]:
425-
"""Extract field text and semantic values from a given ID document.
426-
The input document must be the location (URL) of the ID document to be analyzed.
425+
"""Extract field text and semantic values from a given identity document.
426+
The input document must be the location (URL) of the identity document to be analyzed.
427427
428-
See fields found on an ID document here:
428+
See fields found on an identity document here:
429429
https://aka.ms/formrecognizer/iddocumentfields
430430
431-
:param str id_document_url: The URL of the ID document to analyze. The input must be a valid, encoded URL
432-
of one of the supported formats: JPEG, PNG, PDF, TIFF, or BMP.
431+
:param str identity_document_url: The URL of the identity document to analyze. The input must be a valid,
432+
encoded URL of one of the supported formats: JPEG, PNG, PDF, TIFF, or BMP.
433433
:keyword bool include_field_elements:
434434
Whether or not to include all lines per page and field elements such as lines, words,
435435
and selection marks for each form field.
@@ -445,14 +445,14 @@ async def begin_recognize_id_documents_from_url(
445445
:raises ~azure.core.exceptions.HttpResponseError:
446446
447447
.. versionadded:: v2.1-preview
448-
The *begin_recognize_id_documents_from_url* client method
448+
The *begin_recognize_identity_documents_from_url* client method
449449
"""
450450

451451
include_field_elements = kwargs.pop("include_field_elements", False)
452452

453453
try:
454454
return await self._client.begin_analyze_id_document_async( # type: ignore
455-
file_stream={"source": id_document_url},
455+
file_stream={"source": identity_document_url},
456456
include_text_details=include_field_elements,
457457
cls=kwargs.pop("cls", self._prebuilt_callback),
458458
polling=True,
@@ -461,7 +461,7 @@ async def begin_recognize_id_documents_from_url(
461461
except ValueError as e:
462462
if "begin_analyze_id_document_async" in str(e):
463463
raise ValueError(
464-
"Method 'begin_recognize_id_documents_from_url' is "
464+
"Method 'begin_recognize_identity_documents_from_url' is "
465465
"only available for API version V2_1_PREVIEW and up"
466466
)
467467
raise e

0 commit comments

Comments
 (0)