Skip to content

Commit f2127dc

Browse files
committed
update java to single script
1 parent 18e2e92 commit f2127dc

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ ms.date: 03/14/2022
1111
ms.author: lajanuar
1212
recommendations: false
1313
---
14+
1415
<!-- markdownlint-disable MD025 -->
16+
<!-- markdownlint-disable MD036 -->
17+
1518
# Get started: Form Recognizer C# SDK v3.0 | Preview
1619

1720
>[!NOTE]
@@ -152,7 +155,7 @@ Analyze and extract text, tables, structure, key-value pairs, and named entities
152155
> * We've added the file URI value to the `Uri fileUri` variable at the top of the script.
153156
> * For simplicity, all the entity fields that the service returns are not shown here. To see the list of all supported fields and corresponding types, see the [General document](../concept-general-document.md#named-entity-recognition-ner-categories) concept page.
154157
155-
**Add the following code sample to the Program.cs file:**
158+
**Add the following code sample to the Program.cs file. Make sure you update the key and endpoint variables with values from your Form Recognizer instance in the Azure portal:**
156159

157160
```csharp
158161
using Azure;
@@ -280,7 +283,7 @@ Extract text, selection marks, text styles, table structures, and bounding regio
280283
> * We've added the file URI value to the `Uri fileUri` variable at the top of the script.
281284
> * To extract the layout from a given file at a URI, use the `StartAnalyzeDocumentFromUri` method and pass `prebuilt-layout` as the model ID. The returned value is an `AnalyzeResult` object containing data from the submitted document.
282285
283-
**Add the following code sample to the Program.cs file:**
286+
**Add the following code sample to the Program.cs file. Make sure you update the key and endpoint variables with values from your Form Recognizer instance in the Azure portal:**
284287

285288
```csharp
286289
using Azure;
@@ -368,7 +371,6 @@ for (int i = 0; i < result.Tables.Count; i++)
368371

369372
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).
370373

371-
372374
## Prebuilt model
373375

374376
Analyze and extract common fields from specific document types using a prebuilt model. In this example, we'll analyze an invoice using the **prebuilt-invoice** model.
@@ -383,7 +385,7 @@ Analyze and extract common fields from specific document types using a prebuilt
383385
> * To analyze a given file at a URI, use the `StartAnalyzeDocumentFromUri` method and pass `prebuilt-invoice` as the model ID. The returned value is an `AnalyzeResult` object containing data from the submitted document.
384386
> * For simplicity, all the key-value pairs that the service returns are not shown here. To see the list of all supported fields and corresponding types, see our [Invoice](../concept-invoice.md#field-extraction) concept page.
385387
386-
**Add the following code sample to your Program.cs file:**
388+
**Add the following code sample to your Program.cs file. Make sure you update the key and endpoint variables with values from your Form Recognizer instance in the Azure portal:**
387389

388390
```csharp
389391

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ In this quickstart you'll use following features to analyze and extract data and
6060

6161
## Set up
6262

63-
#### Create a new Gradle project
63+
### Create a new Gradle project
6464

6565
1. In console window (such as cmd, PowerShell, or Bash), create a new directory for your app called **form-recognizer-app**, and navigate to it.
6666

@@ -78,7 +78,7 @@ In this quickstart you'll use following features to analyze and extract data and
7878

7979
1. Accept the default project name (form-recognizer-app)
8080

81-
#### Install the client library
81+
### Install the client library
8282

8383
This quickstart uses the Gradle dependency manager. You can find the client library and information for other dependency managers on the [Maven Central Repository](https://mvnrepository.com/artifact/com.azure/azure-ai-formrecognizer).
8484

@@ -100,7 +100,7 @@ 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

105105
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

@@ -145,7 +145,7 @@ Extract text, tables, structure, key-value pairs, and named entities from docume
145145
> * We've added the file URI value to the `documentUrl` variable in the main method.
146146
> * For simplicity, all the entity fields that the service returns are not shown here. To see the list of all supported fields and corresponding types, see our [General document](../concept-general-document.md#named-entity-recognition-ner-categories) concept page.
147147

148-
**Add the following code sample to the `FormRecognizer` class. Make sure you update the key and endpoint variables with values from your Form Recognizer instance in the Azure portal:
148+
**Add the following code sample to the `FormRecognizer` class. Make sure you update the key and endpoint variables with values from your Form Recognizer instance in the Azure portal:**
149149

150150
```java
151151

@@ -164,16 +164,19 @@ Extract text, tables, structure, key-value pairs, and named entities from docume
164164

165165
public class FormRecognizer {
166166

167-
private static final String key = "PASTE_YOUR_FORM_RECOGNIZER_SUBSCRIPTION_KEY_HERE";
168-
private static final String endpoint = "PASTE_YOUR_FORM_RECOGNIZER_ENDPOINT_HERE";
167+
// set `<your-endpoint>` and `<your-key>` variables with the values from the Azure portal
168+
private static final String endpoint = "<your-endpoint>";
169+
private static final String key = "<your-key>";
169170

170171
public static void main(String[] args) {
171172

173+
// create your `DocumentAnalysisClient` instance and `AzureKeyCredential` variable
172174
DocumentAnalysisClient client = new DocumentAnalysisClientBuilder()
173175
.credential(new AzureKeyCredential(key))
174176
.endpoint(endpoint)
175177
.buildClient();
176178

179+
// sample document
177180
String documentUrl = "https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/sample-layout.pdf";
178181
String modelId = "prebuilt-document";
179182
SyncPoller < DocumentOperationResult, AnalyzeResult> analyzeDocumentPoller =
@@ -238,8 +241,6 @@ Extract text, tables, structure, key-value pairs, and named entities from docume
238241
}
239242
```
240243

241-
242-
243244
## Layout model
244245

245246
Extract text, selection marks, text styles, table structures, and bounding region coordinates from documents.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Extract text, tables, structure, key-value pairs, and named entities from docume
8989
> * For simplicity, all the entity fields that the service returns are not shown here. To see the list of all supported fields and corresponding types, see our [General document](../concept-general-document.md#named-entity-recognition-ner-categories) concept page.
9090
9191
<!-- markdownlint-disable MD036 -->
92-
**Add the following code sample to your form_recognizer_quickstart.py application. Make sure you update the key and endpoint variables with values from your Form Recognizer instance in the Azure portal**
92+
**Add the following code sample to your form_recognizer_quickstart.py application. Make sure you update the key and endpoint variables with values from your Form Recognizer instance in the Azure portal:**
9393

9494
```python
9595

@@ -239,7 +239,7 @@ Extract text, selection marks, text styles, table structures, and bounding regio
239239
> * We've added the file URL value to the `formUrl` variable in the `analyze_layout` function.
240240
> * To analyze a given file at a URL, you'll use the `begin_analyze_document_from_url` method and pass in `prebuilt-layout` as the model Id. The returned value is a `result` object containing data about the submitted document.
241241
242-
**Add the following code sample to your form_recognizer_quickstart.py application. Make sure you update the key and endpoint variables with values from your Form Recognizer instance in the Azure portal**
242+
**Add the following code sample to your form_recognizer_quickstart.py application. Make sure you update the key and endpoint variables with values from your Form Recognizer instance in the Azure portal:**
243243

244244
```python
245245

@@ -370,7 +370,7 @@ Analyze and extract common fields from specific document types using a prebuilt
370370
> * To analyze a given file at a URI, you'll use the `beginAnalyzeDocuments` method and pass `PrebuiltModels.Invoice` as the model Id. The returned value is a `result` object containing data about the submitted document.
371371
> * For simplicity, all the key-value pairs that the service returns are not shown here. To see the list of all supported fields and corresponding types, see our [Invoice](../concept-invoice.md#field-extraction) concept page.
372372
373-
**Add the following code sample to your form_recognizer_quickstart.py application. Make sure you update the key and endpoint variables with values from your Form Recognizer instance in the Azure portal**
373+
**Add the following code sample to your form_recognizer_quickstart.py application. Make sure you update the key and endpoint variables with values from your Form Recognizer instance in the Azure portal:**
374374

375375
```python
376376
# import libraries

0 commit comments

Comments
 (0)