Skip to content

Commit fb30c1f

Browse files
authored
Merge pull request #192048 from laujan/1925568-single-script-javascript
complete qs build and output
2 parents 6f84f90 + 2d44d8b commit fb30c1f

File tree

6 files changed

+461
-257
lines changed

6 files changed

+461
-257
lines changed

articles/applied-ai-services/form-recognizer/concept-model-overview.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ manager: nitinme
77
ms.service: applied-ai-services
88
ms.subservice: forms-recognizer
99
ms.topic: conceptual
10-
ms.date: 03/09/2022
10+
ms.date: 03/16/2022
1111
ms.author: lajanuar
1212
recommendations: false
1313
ms.custom: ignite-fall-2021
@@ -22,7 +22,7 @@ Azure Form Recognizer prebuilt models enable you to add intelligent document pro
2222

2323
| **Model** | **Description** |
2424
| --- | --- |
25-
| 🆕[Read (preview)](#read-preview) | Extract text lines, words, their locations, detected languages, and handwritten style if detected. |
25+
| 🆕[Read (preview)](#read-preview) | Extract printed and handwritten text lines, words, locations, and detected languages.|
2626
| 🆕[W-2 (preview)](#w-2-preview) | Extract employee, employer, wage information, etc. from US W-2 forms. |
2727
| 🆕[General document (preview)](#general-document-preview) | Extract text, tables, structure, key-value pairs, and named entities. |
2828
| [Layout](#layout) | Extracts text and layout information from documents. |
@@ -49,7 +49,7 @@ The Read API analyzes and extracts ext lines, words, their locations, detected l
4949

5050
[:::image type="icon" source="media/studio/w2.png":::](https://formrecognizer.appliedai.azure.com/studio/prebuilt?formType=tax.us.w2)
5151

52-
The W-2 model analyzes and extracts key information reported in each box on a W-2 form. The model supports standard and customized forms from 2018 to the present, including both single form and multiple forms (copy A, B, C, D, 1, 2) on one page.
52+
The W-2 model analyzes and extracts key information reported in each box on a W-2 form. The model supports standard and customized forms from 2018 to the present, including single and multiple forms on one page.
5353

5454
***Sample W-2 document processed using [Form Recognizer Studio](https://formrecognizer.appliedai.azure.com/studio/prebuilt?formType=tax.us.w2)***:
5555

@@ -81,7 +81,7 @@ The W-2 model analyzes and extracts key information reported in each box on a W-
8181

8282
The Layout API analyzes and extracts text, tables and headers, selection marks, and structure information from forms and documents.
8383

84-
***Sample form processed using the [Form Recognizer Studio](https://formrecognizer.appliedai.azure.com/studio/layout)***:
84+
***Sample document processed using the [Form Recognizer Studio](https://formrecognizer.appliedai.azure.com/studio/layout)***:
8585

8686
:::image type="content" source="media/studio/analyze-layout.png" alt-text="Screenshot: Screenshot of sample document processed using Form Recognizer studio":::
8787

@@ -105,7 +105,7 @@ The invoice model analyzes and extracts key information from sales invoices. The
105105

106106
[:::image type="icon" source="media/studio/receipt.png":::](https://formrecognizer.appliedai.azure.com/studio/prebuilt?formType=receipt)
107107

108-
The receipt model analyzes and extracts key information from sales receipts. The API analyzes printed and handwritten receipts and extracts key information such as merchant name, merchant phone number, transaction date, tax, and transaction total.
108+
The receipt model analyzes and extracts key information from printed and handwritten receipts.
109109

110110
***Sample receipt processed using [Form Recognizer Studio](https://formrecognizer.appliedai.azure.com/studio/prebuilt?formType=receipt)***:
111111

@@ -118,7 +118,11 @@ The receipt model analyzes and extracts key information from sales receipts. The
118118

119119
[:::image type="icon" source="media/studio/id-document.png":::](https://formrecognizer.appliedai.azure.com/studio/prebuilt?formType=idDocument)
120120

121-
The ID document model analyzes and extracts key information from U.S. Driver's Licenses (all 50 states and District of Columbia) and biographical pages from international passports (excluding visa and other travel documents). The API analyzes identity documents and extracts key information such as first name, last name, address, and date of birth.
121+
The ID document model analyzes and extracts key information from the following documents:
122+
123+
* U.S. Driver's Licenses (all 50 states and District of Columbia)
124+
125+
* Biographical pages from international passports (excluding visa and other travel documents). The API analyzes identity documents and extracts
122126

123127
***Sample U.S. Driver's License processed using [Form Recognizer Studio](https://formrecognizer.appliedai.azure.com/studio/prebuilt?formType=idDocument)***:
124128

@@ -131,7 +135,7 @@ The ID document model analyzes and extracts key information from U.S. Driver's L
131135

132136
[:::image type="icon" source="media/studio/business-card.png":::](https://formrecognizer.appliedai.azure.com/studio/prebuilt?formType=businessCard)
133137

134-
The business card model analyzes and extracts key information from business card images. The API analyzes printed business card images and extracts key information such as first name, last name, company name, email address, and phone number.
138+
The business card model analyzes and extracts key information from business card images.
135139

136140
***Sample business card processed using [Form Recognizer Studio](https://formrecognizer.appliedai.azure.com/studio/prebuilt?formType=businessCard)***:
137141

articles/applied-ai-services/form-recognizer/quickstarts/try-v3-csharp-sdk.md

Lines changed: 60 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,10 @@ This version of the client library defaults to the 2021-09-30-preview version of
119119

120120
1. Choose the **Include prerelease** checkbox and select version **4.0.0-beta.3*** from the dropdown menu and install the package in your project.
121121
<!-- --- -->
122+
122123
## Build your application
123124

124-
To interact with the Form Recognizer service, you'll need to create an instance of the `DocumentAnalysisClient` class. To do so, you'll create an `AzureKeyCredential` with your key from the Azure portal and a `DocumentAnalysisClient` instance with the `AzureKeyCredential` and your Form Recognizer `endpoint`.
125+
To interact with the Form Recognizer service, you'll need to create an instance of the `DocumentAnalysisClient` class. To do so, you'll create an `AzureKeyCredential` with your `key` from the Azure portal and a `DocumentAnalysisClient` instance with the `AzureKeyCredential` and your Form Recognizer `endpoint`.
125126

126127
> [!NOTE]
127128
>
@@ -144,6 +145,22 @@ To interact with the Form Recognizer service, you'll need to create an instance
144145
>
145146
> * Remember to remove the key from your code when you're done, and never post it publicly. For production, use secure methods to store and access your credentials. For more information, *see* Cognitive Services [security](../../../cognitive-services/cognitive-services-security.md).
146147
148+
## Run your application
149+
150+
Once you've added a code sample to your application, choose the green **Start** button next to formRecognizer_quickstart to build and run your program, or press **F5**.
151+
152+
:::image type="content" source="../media/quickstarts/run-visual-studio.png" alt-text="Screenshot: run your Visual Studio program.":::
153+
154+
<!-- ### [.NET Command-line interface (CLI)](#tab/cli)
155+
156+
Open your command prompt and go to the directory that contains your project and type the following:
157+
158+
```console
159+
dotnet run formrecognizer-quickstart.dll
160+
```
161+
162+
### [Visual Studio](#tab/vs) -->
163+
147164
## General document model
148165

149166
Analyze and extract text, tables, structure, key-value pairs, and named entities.
@@ -270,8 +287,20 @@ for (int i = 0; i < result.Tables.Count; i++)
270287

271288
### General document model output
272289

273-
Visit the Azure samples repository on GitHub to view the [general document model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/dotnet/FormRecognizer/v3-csharp-sdk-general-document-output.md).
274-
___
290+
Here's a snippet of the expected output:
291+
292+
```console
293+
Detected key-value pairs:
294+
Found key with no value: '?'
295+
Found key-value pair: 'QUARTERLY REPORT PURSUANT TO SECTION 13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934' and ':selected:'
296+
Found key-value pair: 'For the Quarterly Period Ended March 31, 2020' and 'OR'
297+
Found key with no value: '?'
298+
Found key-value pair: 'TRANSITION REPORT PURSUANT TO SECTION 13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934' and ':unselected:'
299+
Found key with no value: 'For the Transition Period From'
300+
Found key-value pair: 'to Commission File Number' and '001-37845'
301+
```
302+
303+
To view the entire output, visit the Azure samples repository on GitHub to view the [general document model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/dotnet/FormRecognizer/v3-csharp-sdk-general-document-output.md).
275304

276305
## Layout model
277306

@@ -369,7 +398,25 @@ for (int i = 0; i < result.Tables.Count; i++)
369398

370399
### Layout model output
371400

372-
Visit the Azure samples repository on GitHub to view the [layout model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/dotnet/FormRecognizer/v3-csharp-sdk-layout-output.md).
401+
Here's a snippet of the expected output:
402+
403+
```console
404+
Document Page 1 has 69 line(s), 425 word(s), and 15 selection mark(s).
405+
Line 0 has content: 'UNITED STATES'.
406+
Its bounding box is:
407+
Upper left => X: 3.4915, Y= 0.6828
408+
Upper right => X: 5.0116, Y= 0.6828
409+
Lower right => X: 5.0116, Y= 0.8265
410+
Lower left => X: 3.4915, Y= 0.8265
411+
Line 1 has content: 'SECURITIES AND EXCHANGE COMMISSION'.
412+
Its bounding box is:
413+
Upper left => X: 2.1937, Y= 0.9061
414+
Upper right => X: 6.297, Y= 0.9061
415+
Lower right => X: 6.297, Y= 1.0498
416+
Lower left => X: 2.1937, Y= 1.0498
417+
```
418+
419+
To view the entire output, visit the Azure samples repository on GitHub to view the [layout model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/dotnet/FormRecognizer/v3-csharp-sdk-layout-output.md).
373420

374421
## Prebuilt model
375422

@@ -501,26 +548,19 @@ for (int i = 0; i < result.Documents.Count; i++)
501548

502549
### Prebuilt model output
503550

504-
Visit the Azure samples repository on GitHub to view the [prebuilt invoice model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/dotnet/FormRecognizer/v3-csharp-sdk-prebuilt-invoice-output.md).
505-
506-
507-
## Run your application
508-
509-
<!-- ### [.NET Command-line interface (CLI)](#tab/cli)
510-
511-
Open your command prompt and go to the directory that contains your project and type the following:
551+
Here's a snippet of the expected output:
512552

513553
```console
514-
dotnet run formrecognizer-quickstart.dll
554+
Document 0:
555+
Vendor Name: 'CONTOSO LTD.', with confidence 0.962
556+
Customer Name: 'MICROSOFT CORPORATION', with confidence 0.951
557+
Item:
558+
Description: 'Test for 23 fields', with confidence 0.899
559+
Amount: '100', with confidence 0.902
560+
Sub Total: '100', with confidence 0.979
515561
```
516562

517-
### [Visual Studio](#tab/vs) -->
518-
519-
Choose the green **Start** button next to formRecognizer_quickstart to build and run your program, or press **F5**.
520-
521-
:::image type="content" source="../media/quickstarts/run-visual-studio.png" alt-text="Screenshot: run your Visual Studio program.":::
522-
523-
<!-- --- -->
563+
To view the entire output, visit the Azure samples repository on GitHub to view the [prebuilt invoice model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/dotnet/FormRecognizer/v3-csharp-sdk-prebuilt-invoice-output.md).
524564

525565
That's it, congratulations!
526566

articles/applied-ai-services/form-recognizer/quickstarts/try-v3-java-sdk.md

Lines changed: 75 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ms.date: 03/16/2022
1111
ms.author: lajanuar
1212
recommendations: false
1313
---
14-
<!-- markdownlint-disable MD025 -->
14+
<!-- markdownlint-disable MD025 -->
1515

1616
# Get started: Form Recognizer Java SDK v3.0 | Preview
1717

@@ -100,9 +100,9 @@ This quickstart uses the Gradle dependency manager. You can find the client libr
100100
}
101101
```
102102

103-
### Create a Java application
103+
## Create a Java application
104104

105-
To interact with the Form Recognizer service, you'll need to create an instance of the `DocumentAnalysisClient` class. To do so, you'll create an `AzureKeyCredential` with your key from the Azure portal and a `DocumentAnalysisClient` instance with the `AzureKeyCredential` and your Form Recognizer `endpoint`.
105+
To interact with the Form Recognizer service, you'll need to create an instance of the `DocumentAnalysisClient` class. To do so, you'll create an `AzureKeyCredential` with your `key` from the Azure portal and a `DocumentAnalysisClient` instance with the `AzureKeyCredential` and your Form Recognizer `endpoint`.
106106

107107
1. From the form-recognizer-app directory, run the following command:
108108

@@ -134,6 +134,22 @@ To interact with the Form Recognizer service, you'll need to create an instance
134134
>
135135
> Remember to remove the key from your code when you're done, and never post it publicly. For production, use secure methods to store and access your credentials. For more information, see* the Cognitive Services [security](../../../cognitive-services/cognitive-services-security.md).
136136

137+
## Build and run your application
138+
139+
Once you've added a code sample to your application, navigate back to your main project directory—**form-recognizer-app**.
140+
141+
1. Build your application with the `build` command:
142+
143+
```console
144+
gradle build
145+
```
146+
147+
1. Run your application with the `run` command:
148+
149+
```console
150+
gradle run
151+
```
152+
137153
## General document model
138154

139155
Extract text, tables, structure, key-value pairs, and named entities from documents.
@@ -243,7 +259,25 @@ Extract text, tables, structure, key-value pairs, and named entities from docume
243259

244260
### General document model output
245261

246-
Visit the Azure samples repository on GitHub to view the [general document model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/java/FormRecognizer/v3-java-sdk-general-document-output.md).
262+
Here's a snippet of the expected output:
263+
264+
```console
265+
Key content: For the Transition Period From
266+
Key content bounding region: [com.azure.ai.formrecognizer.models.BoundingRegion@14c053c6]
267+
Key content: to Commission File Number
268+
Key content bounding region: [com.azure.ai.formrecognizer.models.BoundingRegion@6c2d4cc6]
269+
Value content: 001-37845
270+
Value content bounding region: [com.azure.ai.formrecognizer.models.BoundingRegion@30865a90]
271+
Key content: (I.R.S. ID)
272+
Key content bounding region: [com.azure.ai.formrecognizer.models.BoundingRegion@6134ac4a]
273+
Value content: 91-1144442
274+
Value content bounding region: [com.azure.ai.formrecognizer.models.BoundingRegion@777c9dc9]
275+
Key content: Securities registered pursuant to Section 12(g) of the Act:
276+
Key content bounding region: [com.azure.ai.formrecognizer.models.BoundingRegion@71b1a49c]
277+
Value content: NONE
278+
```
279+
280+
To view the entire output, visit the Azure samples repository on GitHub to view the [general document model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/java/FormRecognizer/v3-java-sdk-general-document-output.md).
247281

248282
## Layout model
249283

@@ -286,8 +320,9 @@ Extract text, selection marks, text styles, table structures, and bounding regio
286320
.endpoint(endpoint)
287321
.buildClient();
288322

289-
// sample document
323+
// sample document
290324
String documentUrl = "https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/sample-layout.pdf";
325+
291326
String modelId = "prebuilt-layout";
292327

293328
SyncPoller < DocumentOperationResult, AnalyzeResult > analyzeLayoutResultPoller =
@@ -340,7 +375,28 @@ Extract text, selection marks, text styles, table structures, and bounding regio
340375

341376
### Layout model output
342377

343-
Visit the Azure samples repository on GitHub to view the [layout model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/java/FormRecognizer/v3-java-sdk-layout-output.md).
378+
Here's a snippet of the expected output:
379+
380+
```console
381+
Table 0 has 5 rows and 3 columns.
382+
Cell 'Title of each class', has row index 0 and column index 0.
383+
Cell 'Trading Symbol', has row index 0 and column index 1.
384+
Cell 'Name of exchange on which registered', has row index 0 and column index 2.
385+
Cell 'Common stock, $0.00000625 par value per share', has row index 1 and column index 0.
386+
Cell 'MSFT', has row index 1 and column index 1.
387+
Cell 'NASDAQ', has row index 1 and column index 2.
388+
Cell '2.125% Notes due 2021', has row index 2 and column index 0.
389+
Cell 'MSFT', has row index 2 and column index 1.
390+
Cell 'NASDAQ', has row index 2 and column index 2.
391+
Cell '3.125% Notes due 2028', has row index 3 and column index 0.
392+
Cell 'MSFT', has row index 3 and column index 1.
393+
Cell 'NASDAQ', has row index 3 and column index 2.
394+
Cell '2.625% Notes due 2033', has row index 4 and column index 0.
395+
Cell 'MSFT', has row index 4 and column index 1.
396+
Cell 'NASDAQ', has row index 4 and column index 2.
397+
```
398+
399+
To view the entire output,visit the Azure samples repository on GitHub to view the [layout model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/java/FormRecognizer/v3-java-sdk-layout-output.md).
344400

345401
## Prebuilt model
346402

@@ -349,8 +405,6 @@ Analyze and extract common fields from specific document types using a prebuilt
349405
> [!TIP]
350406
> You aren't limited to invoices—there are several prebuilt models to choose from, each of which has its own set of supported fields. The model to use for the analyze operation depends on the type of document to be analyzed. See [**model data extraction**](../concept-model-overview.md#model-data-extraction).
351407
352-
#### Try the prebuilt invoice model
353-
354408
> [!div class="checklist"]
355409
>
356410
> * Analyze an invoice using the prebuilt-invoice model. You can use our [sample invoice document](https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/sample-invoice.pdf) for this quickstart.
@@ -382,13 +436,13 @@ Analyze and extract common fields from specific document types using a prebuilt
382436
private static final String key = "<your-key>";
383437

384438
public static void main(final String[] args) throws IOException {
385-
439+
386440
// create your `DocumentAnalysisClient` instance and `AzureKeyCredential` variable
387441
DocumentAnalysisClient client = new DocumentAnalysisClientBuilder()
388442
.credential(new AzureKeyCredential(key))
389443
.endpoint(endpoint)
390444
.buildClient();
391-
445+
392446
// sample document
393447
String invoiceUrl = "https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/sample-invoice.pdf";
394448
String modelId = "prebuilt-invoice";
@@ -401,7 +455,7 @@ Analyze and extract common fields from specific document types using a prebuilt
401455
AnalyzedDocument analyzedInvoice = analyzeInvoiceResult.getDocuments().get(i);
402456
Map < String, DocumentField > invoiceFields = analyzedInvoice.getFields();
403457
System.out.printf("----------- Analyzing invoice %d -----------%n", i);
404-
System.out.printf("Analyzed document has doc type %s with confidence : %.2f%n.",
458+
System.out.printf("Analyzed document has doc type %s with confidence : %.2f%n",
405459
analyzedInvoice.getDocType(), analyzedInvoice.getConfidence());
406460

407461
DocumentField vendorNameField = invoiceFields.get("VendorName");
@@ -518,23 +572,20 @@ Analyze and extract common fields from specific document types using a prebuilt
518572

519573
### Prebuilt model output
520574

521-
Visit the Azure samples repository on GitHub to view the [prebuilt invoice model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/java/FormRecognizer/v3-java-sdk-prebuilt-invoice-output.md)
522-
523-
## Build and run your application
524-
525-
Navigate back to your main project directory—**form-recognizer-app**.
526-
527-
1. Build your application with the `build` command:
575+
Here's a snippet of the expected output:
528576

529577
```console
530-
gradle build
578+
----------- Analyzing invoice 0 -----------
579+
Analyzed document has doc type invoice with confidence : 1.00
580+
Vendor Name: CONTOSO LTD., confidence: 0.92
581+
Vendor address: 123 456th St New York, NY, 10001, confidence: 0.91
582+
Customer Name: MICROSOFT CORPORATION, confidence: 0.84
583+
Customer Address Recipient: Microsoft Corp, confidence: 0.92
584+
Invoice ID: INV-100, confidence: 0.97
585+
Invoice Date: 2019-11-15, confidence: 0.97
531586
```
532587

533-
1. Run your application with the `run` command:
534-
535-
```console
536-
gradle run
537-
```
588+
To view the entire output, visit the Azure samples repository on GitHub to view the [prebuilt invoice model output](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/java/FormRecognizer/v3-java-sdk-prebuilt-invoice-output.md)
538589

539590
That's it, congratulations!
540591

0 commit comments

Comments
 (0)