Skip to content

Commit 8f924b2

Browse files
Merge Feature/formrecognizer2.1 into master (Azure#17121)
* [FR] Update to 2.1-preview.2 with generation and recordings (Azure#16462) * generation and recordings * missing tests * PR feedback * enable test * export-api * [FR] Add invoices functionality (Azure#16522) * add invoices * pr feedback * export api * Update sdk/formrecognizer/Azure.AI.FormRecognizer/src/RecognizeInvoicesOperation.cs Co-authored-by: Krista Pratico <krpratic@microsoft.com> Co-authored-by: Krista Pratico <krpratic@microsoft.com> * [FR] Add documentation for invoices (Azure#16659) * documentation * PR feedback * generation plus small fixes (Azure#16787) * [FR] Expose code generated properties (Azure#16841) * selection mark state order: * appearance * bounding box * content-type bmp * pages * update to 2.1-preview.2 * language (Azure#16889) * added more test for copy feature (Azure#16892) * enable receipt and bc (Azure#17004) * remove bc workaround (Azure#17025) * disable receipts, enable AAD, move to canada (Azure#17119) Co-authored-by: Krista Pratico <krpratic@microsoft.com>
1 parent 9e0bd11 commit 8f924b2

File tree

275 files changed

+104222
-40009
lines changed

Some content is hidden

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

275 files changed

+104222
-40009
lines changed

sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,26 @@
33
## 3.1.0-beta.1 (Unreleased)
44

55
### Breaking changes
6-
- It defaults to the latest supported API version, which currently is `2.1-preview.1`.
6+
- It defaults to the latest supported API version, which currently is `2.1-preview.2`.
77

88
### New Features
99
- Added integration for ASP.NET Core.
1010
- Added support for pre-built business card recognition.
11+
- Added support for pre-built invoices recognition.
1112
- Added support for providing locale info when recognizing receipts and business cards. Supported locales include support EN-US, EN-AU, EN-CA, EN-GB, EN-IN.
13+
- Added support for providing the document language in `StartRecognizeContent` when recognizing a form.
1214
- Added support to train and recognize custom forms with selection marks such as check boxes and radio buttons. This functionality is only available in train with labels scenarios.
15+
- Added support to `StartRecognizeContent` to recognize selection marks such as check boxes and radio buttons.
1316
- Added ability to create a composed model from the `FormTrainingClient` by calling method `StartCreateComposedModel`.
1417
- Added ability to pass parameter `ModelName` to `StartTraining` methods.
1518
- Added the properties `ModelName` and `Properties` to types `CustomFormModel` and `CustomFormModelInfo`.
1619
- Added type `CustomFormModelProperties` that includes information like if a model is a composed model.
1720
- Added property `ModelId` to `CustomFormSubmodel` and `TrainingDocumentInfo`.
1821
- Added properties `ModelId` and `FormTypeConfidence` to `RecognizedForm`.
19-
- Added support to `StartRecognizeContent` to recognize selection marks such as check boxes and radio buttons.
22+
- Added property `Appearance` to `FormLine` to indicate the style of the extracted text. for example, "handwriting" or "other".
23+
- Added property `BoundingBox` to `FormTable`.
24+
- Added support for `ContentType` `image/bmp` in recognize content and prebuilt models.
25+
- Added property `Pages` to `RecognizeContentOptions` to specify the page numbers to analyze.
2026

2127
## 3.0.0 (2020-08-20)
2228

sdk/formrecognizer/Azure.AI.FormRecognizer/README.md

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ Azure Cognitive Services Form Recognizer is a cloud service that uses machine le
33

44
- Recognize Custom Forms - Recognize and extract form fields and other content from your custom forms, using models you trained with your own form types.
55
- Recognize Form Content - Recognize and extract tables, lines, words, and selection marks like radio buttons and check boxes in forms documents, without the need to train a model.
6-
- Recognize Receipts - Recognize and extract common fields from receipts, using a pre-trained receipt model.
7-
- Recognize Business Card - Recognize and extract common fields from business cards, using a pre-trained business cards model.
6+
- Recognize Prebuilt models - Recognize data using the following prebuilt models:
7+
- Receipts - Recognize and extract common fields from receipts, using a pre-trained receipt model.
8+
- Business Cards - Recognize and extract common fields from business cards, using a pre-trained business cards model.
9+
- Invoices - Recognize and extract common fields from invoices, using a pre-trained invoice model.
810

911
[Source code][formreco_client_src] | [Package (NuGet)][formreco_nuget_package] | [API reference documentation][formreco_refdocs] | [Product documentation][formreco_docs] | [Samples][formreco_samples]
1012

@@ -101,10 +103,12 @@ var client = new FormRecognizerClient(new Uri(endpoint), new DefaultAzureCredent
101103

102104
`FormRecognizerClient` provides operations for:
103105

104-
- Recognizing form fields and content, using custom models trained to recognize your custom forms. These values are returned in a collection of `RecognizedForm` objects. See example [Recognize Custom Forms](#recognize-custom-forms).
105-
- Recognizing form content, including tables, lines, words, and selection marks like radio buttons and check boxes without the need to train a model. Form content is returned in a collection of `FormPage` objects. See example [Recognize Content](#recognize-content).
106-
- Recognizing common fields from receipts, using a pre-trained receipt model on the Form Recognizer service. These fields and meta-data are returned in a collection of `RecognizedForm` objects. See example [Recognize Receipts](#recognize-receipts).
107-
- Recognizing common fields from business cards, using a pre-trained business cards model on the Form Recognizer service. These fields and meta-data are returned in a collection of `RecognizedForm` objects. See example [Recognize Business Cards](#recognize-business-cards).
106+
- Recognizing form fields and content, using custom models trained to recognize your custom forms. These values are returned in a collection of `RecognizedForm` objects. See example [Recognize Custom Forms](#recognize-custom-forms).
107+
- Recognizing form content, including tables, lines, words, and selection marks like radio buttons and check boxes without the need to train a model. Form content is returned in a collection of `FormPage` objects. See example [Recognize Content](#recognize-content).
108+
- Recognizing common fields from the following form types using prebuilt models. These fields and meta-data are returned in a collection of `RecognizedForm` objects.
109+
- Sales receipts. See example [Recognize Receipts](#recognize-receipts).
110+
- Business cards. See example [Recognize Business Cards](#recognize-business-cards).
111+
- Invoices. See example [Recognize Invoices](#recognize-invoices).
108112

109113
### FormTrainingClient
110114

@@ -134,6 +138,7 @@ The following section provides several code snippets illustrating common pattern
134138
* [Recognize Custom Forms](#recognize-custom-forms)
135139
* [Recognize Receipts](#recognize-receipts)
136140
* [Recognize Business Cards](#recognize-business-cards)
141+
* [Recognize Invoices](#recognize-invoices)
137142
* [Train a Model](#train-a-model)
138143
* [Manage Custom Models](#manage-custom-models)
139144

@@ -299,7 +304,7 @@ using (FileStream stream = new FileStream(receiptPath, FileMode.Open))
299304
Recognize data from business cards using a prebuilt model. Business card fields recognized by the service can be found [here][service_recognize_business_cards_fields].
300305

301306
```C# Snippet:FormRecognizerSampleRecognizeBusinessCardFileStream
302-
using (FileStream stream = new FileStream(busienssCardsPath, FileMode.Open))
307+
using (FileStream stream = new FileStream(businessCardsPath, FileMode.Open))
303308
{
304309
var options = new RecognizeBusinessCardsOptions() { Locale = "en-US" };
305310
RecognizedFormCollection businessCards = await client.StartRecognizeBusinessCardsAsync(stream, options).WaitForCompletionAsync();
@@ -368,6 +373,52 @@ using (FileStream stream = new FileStream(busienssCardsPath, FileMode.Open))
368373
}
369374
```
370375

376+
### Recognize Invoices
377+
Recognize data from invoices using a prebuilt model. Invoices fields recognized by the service can be found [here][service_recognize_invoices_fields].
378+
379+
```C# Snippet:FormRecognizerSampleRecognizeInvoicesFileStream
380+
using (FileStream stream = new FileStream(invoicePath, FileMode.Open))
381+
{
382+
var options = new RecognizeInvoicesOptions() { Locale = "en-US" };
383+
RecognizedFormCollection invoices = await client.StartRecognizeInvoicesAsync(stream, options).WaitForCompletionAsync();
384+
385+
// To see the list of the supported fields returned by service and its corresponding types, consult:
386+
// https://aka.ms/formrecognizer/invoicefields
387+
388+
RecognizedForm invoice = invoices.Single();
389+
390+
FormField vendorNameField;
391+
if (invoice.Fields.TryGetValue("VendorName", out vendorNameField))
392+
{
393+
if (vendorNameField.Value.ValueType == FieldValueType.String)
394+
{
395+
string vendorName = vendorNameField.Value.AsString();
396+
Console.WriteLine($" Vendor Name: '{vendorName}', with confidence {vendorNameField.Confidence}");
397+
}
398+
}
399+
400+
FormField customerNameField;
401+
if (invoice.Fields.TryGetValue("CustomerName", out customerNameField))
402+
{
403+
if (customerNameField.Value.ValueType == FieldValueType.String)
404+
{
405+
string customerName = customerNameField.Value.AsString();
406+
Console.WriteLine($" Customer Name: '{customerName}', with confidence {customerNameField.Confidence}");
407+
}
408+
}
409+
410+
FormField invoiceTotalField;
411+
if (invoice.Fields.TryGetValue("InvoiceTotal", out invoiceTotalField))
412+
{
413+
if (invoiceTotalField.Value.ValueType == FieldValueType.Float)
414+
{
415+
float invoiceTotal = invoiceTotalField.Value.AsFloat();
416+
Console.WriteLine($" Invoice Total: '{invoiceTotal}', with confidence {invoiceTotalField.Confidence}");
417+
}
418+
}
419+
}
420+
```
421+
371422
### Train a Model
372423
Train a machine-learned model on your own form types. The resulting model will be able to recognize values from the types of forms it was trained on.
373424

@@ -602,6 +653,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
602653
[labeling_tool]: https://docs.microsoft.com/azure/cognitive-services/form-recognizer/quickstarts/label-tool
603654
[service_recognize_receipt_fields]: https://aka.ms/formrecognizer/receiptfields
604655
[service_recognize_business_cards_fields]: https://aka.ms/formrecognizer/businesscardfields
656+
[service_recognize_invoices_fields]: https://aka.ms/formrecognizer/invoicefields
605657
[dotnet_lro_guidelines]: https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-longrunning
606658

607659
[logging]: https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/core/Azure.Core/samples/Diagnostics.md

0 commit comments

Comments
 (0)