You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Get started with Azure Form Recognizer using the Java programming language. Azure Form Recognizer is a cloud-based Azure Applied AI Service that uses machine learning to extract key-value pairs, text, and tables from your documents. You can easily call Form Recognizer models by integrating our client library SDks into your workflows and applications. We recommend that you use the free service when you're learning the technology. Remember that the number of free pages is limited to 500 per month.
25
24
@@ -36,6 +35,7 @@ In this quickstart you'll use following features to analyze and extract data and
36
35
## Prerequisites
37
36
38
37
* Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/).
38
+
39
39
* The latest version of [Visual Studio Code](https://code.visualstudio.com/) or your preferred IDE. *See*[Java in Visual Studio Code](https://code.visualstudio.com/docs/languages/java).
40
40
41
41
>[!TIP]
@@ -96,11 +96,13 @@ This quickstart uses the Gradle dependency manager. You can find the client libr
96
96
mavenCentral()
97
97
}
98
98
dependencies {
99
-
implementation(group = "com.azure", name = "azure-ai-formrecognizer", version = "4.0.0-beta.3")
99
+
implementation(group = "com.azure", name = "azure-ai-formrecognizer", version = "4.0.0-beta.4")
100
100
}
101
101
```
102
102
103
-
#### Create a Java file
103
+
#### Create a Java application
104
+
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`.
104
106
105
107
1. From the form-recognizer-app directory, run the following command:
106
108
@@ -120,44 +122,7 @@ This quickstart uses the Gradle dependency manager. You can find the client libr
120
122
> * Open a PowerShell window in your project directory by holding down the Shift key and right-clicking the folder.
121
123
> * Type the following command **New-Item FormRecognizer.java**.
122
124
123
-
1. Open the `FormRecognizer.java` file in your preferred editor or IDE and add the following `import` statements:
Next, you'll need to create a public class for your project:
143
-
144
-
```java
145
-
publicclassFormRecognizer {
146
-
// All project code goes here...
147
-
}
148
-
```
149
-
150
-
> [!TIP]
151
-
> If you would like to try more than one code sample:
152
-
>
153
-
> * Select one of the sample code blocks below to copy and paste into your application.
154
-
> *[**Build and run your application**](#build-and-run-your-application).
155
-
> * Comment out that sample code block but keep the set-up code and library directives.
156
-
> * Select another sample code block to copy and paste into your application.
157
-
> *[**Build and run your application**](#build-and-run-your-application).
158
-
> * You can continue to comment out, copy/paste, build, and run the sample blocks of code.
159
-
160
-
#### Select a code sample to copy and paste into your application's main method:
125
+
1. Open the `FormRecognizer.java` file and select one of the following code samples to copy and pasted into your application:
161
126
162
127
* [**General document**](#general-document-model)
163
128
@@ -180,83 +145,101 @@ Extract text, tables, structure, key-value pairs, and named entities from docume
180
145
> * We've added the file URI value to the `documentUrl` variable in the main method.
181
146
> * 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.
182
147
183
-
Add the following code 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:
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`.
66
65
67
66
1. Create a new Python file called **form_recognizer_quickstart.py** in your preferred editor or IDE.
68
-
67
+
69
68
1. Open the **form_recognizer_quickstart.py** file and select one of the following code samples to copy and pasted into your application:
70
69
71
70
*[**General document**](#general-document-model)
@@ -90,7 +89,7 @@ Extract text, tables, structure, key-value pairs, and named entities from docume
90
89
> * 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.
91
90
92
91
<!-- markdownlint-disable MD036 -->
93
-
**Add the following sample code to your form_recognizer_quickstart.py application:**
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**
94
93
95
94
```python
96
95
@@ -240,7 +239,7 @@ Extract text, selection marks, text styles, table structures, and bounding regio
240
239
> * We've added the file URL value to the `formUrl` variable in the `analyze_layout` function.
241
240
> * 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.
242
241
243
-
**Add the following sample code to your form_recognizer_quickstart.py application:**
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**
244
243
245
244
```python
246
245
@@ -371,7 +370,7 @@ Analyze and extract common fields from specific document types using a prebuilt
371
370
> * 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.
372
371
> * 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.
373
372
374
-
**Add the following sample code to your form_recognizer_quickstart.py application:**
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**
0 commit comments