Skip to content

Commit

Permalink
[formrecognizer] add locale to receipt samples (#14292)
Browse files Browse the repository at this point in the history
* add locale to receipt samples

* update docstring from feedback
  • Loading branch information
kristapratico authored Oct 6, 2020
1 parent d4bff7b commit 25e0ffd
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
4 changes: 4 additions & 0 deletions sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 3.1.0b1 (Unreleased)

**New features**

- Recognize receipt methods now take keyword argument `locale` to optionally indicate the locale of the receipt for
improved results

## 3.0.0 (2020-08-20)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,14 @@ def begin_recognize_receipts(self, receipt, **kwargs):
:keyword int polling_interval: Waiting time between two polls for LRO operations
if no Retry-After header is present. Defaults to 5 seconds.
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword str locale: Locale of the receipt. Defaults to en-US. Supported locales include:
en-US, en-AU, en-CA, en-GB, and en-IN.
:return: An instance of an LROPoller. Call `result()` on the poller
object to return a list[:class:`~azure.ai.formrecognizer.RecognizedForm`].
:rtype: ~azure.core.polling.LROPoller[list[~azure.ai.formrecognizer.RecognizedForm]]
:raises ~azure.core.exceptions.HttpResponseError:
.. versionadded:: v2.1-preview
The *locale* keyword argument
.. admonition:: Example:
Expand Down Expand Up @@ -142,10 +146,14 @@ def begin_recognize_receipts_from_url(self, receipt_url, **kwargs):
:keyword int polling_interval: Waiting time between two polls for LRO operations
if no Retry-After header is present. Defaults to 5 seconds.
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword str locale: Locale of the receipt. Defaults to en-US. Supported locales include:
en-US, en-AU, en-CA, en-GB, and en-IN.
:return: An instance of an LROPoller. Call `result()` on the poller
object to return a list[:class:`~azure.ai.formrecognizer.RecognizedForm`].
:rtype: ~azure.core.polling.LROPoller[list[~azure.ai.formrecognizer.RecognizedForm]]
:raises ~azure.core.exceptions.HttpResponseError:
.. versionadded:: v2.1-preview
The *locale* keyword argument
.. admonition:: Example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,14 @@ async def begin_recognize_receipts(
:keyword int polling_interval: Waiting time between two polls for LRO operations
if no Retry-After header is present. Defaults to 5 seconds.
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword str locale: Locale of the receipt. Defaults to en-US. Supported locales include:
en-US, en-AU, en-CA, en-GB, and en-IN.
:return: An instance of an AsyncLROPoller. Call `result()` on the poller
object to return a list[:class:`~azure.ai.formrecognizer.RecognizedForm`].
:rtype: ~azure.core.polling.AsyncLROPoller[list[~azure.ai.formrecognizer.RecognizedForm]]
:raises ~azure.core.exceptions.HttpResponseError:
.. versionadded:: v2.1-preview
The *locale* keyword argument
.. admonition:: Example:
Expand Down Expand Up @@ -145,10 +149,14 @@ async def begin_recognize_receipts_from_url(
:keyword int polling_interval: Waiting time between two polls for LRO operations
if no Retry-After header is present. Defaults to 5 seconds.
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword str locale: Locale of the receipt. Defaults to en-US. Supported locales include:
en-US, en-AU, en-CA, en-GB, and en-IN.
:return: An instance of an AsyncLROPoller. Call `result()` on the poller
object to return a list[:class:`~azure.ai.formrecognizer.RecognizedForm`].
:rtype: ~azure.core.polling.AsyncLROPoller[list[~azure.ai.formrecognizer.RecognizedForm]]
:raises ~azure.core.exceptions.HttpResponseError:
.. versionadded:: v2.1-preview
The *locale* keyword argument
.. admonition:: Example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async def recognize_receipts(self):
) as form_recognizer_client:

with open(path_to_sample_forms, "rb") as f:
poller = await form_recognizer_client.begin_recognize_receipts(receipt=f)
poller = await form_recognizer_client.begin_recognize_receipts(receipt=f, locale="en-US")

receipts = await poller.result()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def recognize_receipts(self):
endpoint=endpoint, credential=AzureKeyCredential(key)
)
with open(path_to_sample_forms, "rb") as f:
poller = form_recognizer_client.begin_recognize_receipts(receipt=f)
poller = form_recognizer_client.begin_recognize_receipts(receipt=f, locale="en-US")
receipts = poller.result()

for idx, receipt in enumerate(receipts):
Expand Down

0 comments on commit 25e0ffd

Please sign in to comment.