azure.cognitiveservices.formrecognizer package¶
Submodules¶
Module contents¶
-
class
azure.cognitiveservices.formrecognizer.
FormRecognizerClient
(endpoint, credentials)[source]¶ Bases:
msrest.service_client.SDKClient
Extracts information from forms and images into structured data based on a model created by a set of representative training forms.
- Variables
config (FormRecognizerClientConfiguration) – Configuration for client.
- Parameters
endpoint (str) – Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).
credentials (None) – Subscription credentials which uniquely identify client subscription.
-
analyze_with_custom_model
(id, form_stream, keys=None, custom_headers=None, raw=False, **operation_config)[source]¶ Analyze Form.
Extract key-value pairs from a given document. The input document must be of one of the supported content types - ‘application/pdf’, ‘image/jpeg’ or ‘image/png’. A success response is returned in JSON.
- Parameters
id (str) – Model Identifier to analyze the document with.
form_stream (Generator) – A pdf document or image (jpg,png) file to analyze.
keys (list[str]) – An optional list of known keys to extract the values for.
custom_headers (dict) – headers that will be added to the request
raw (bool) – returns the direct response alongside the deserialized response
operation_config – Operation configuration overrides.
- Returns
AnalyzeResult or ClientRawResponse if raw=true
- Return type
AnalyzeResult or ClientRawResponse
- Raises
-
delete_custom_model
(id, custom_headers=None, raw=False, **operation_config)[source]¶ Delete Model.
Delete model artifacts.
- Parameters
- Returns
None or ClientRawResponse if raw=true
- Return type
None or ClientRawResponse
- Raises
-
get_custom_model
(id, custom_headers=None, raw=False, **operation_config)[source]¶ Get Model.
Get information about a model.
- Parameters
- Returns
ModelResult or ClientRawResponse if raw=true
- Return type
ModelResult or ClientRawResponse
- Raises
-
get_custom_models
(custom_headers=None, raw=False, **operation_config)[source]¶ Get Models.
Get information about all trained custom models.
- Parameters
- Returns
ModelsResult or ClientRawResponse if raw=true
- Return type
ModelsResult or ClientRawResponse
- Raises
-
get_extracted_keys
(id, custom_headers=None, raw=False, **operation_config)[source]¶ Get Keys.
Retrieve the keys that were extracted during the training of the specified model.
- Parameters
- Returns
KeysResult or ClientRawResponse if raw=true
- Return type
KeysResult or ClientRawResponse
- Raises
-
train_custom_model
(source, custom_headers=None, raw=False, **operation_config)[source]¶ Train Model.
Create and train a custom model. The train request must include a source parameter that is either an externally accessible Azure Storage blob container Uri (preferably a Shared Access Signature Uri) or valid path to a data folder in a locally mounted drive. When local paths are specified, they must follow the Linux/Unix path format and be an absolute path rooted to the input mount configuration setting value e.g., if ‘{Mounts:Input}’ configuration setting value is ‘/input’ then a valid source path would be ‘/input/contosodataset’. All data to be trained is expected to be directly under the source folder. Subfolders are not supported. Models are trained using documents that are of the following content type - ‘application/pdf’, ‘image/jpeg’ and ‘image/png’.” Other type of content is ignored.
- Parameters
- Returns
TrainResult or ClientRawResponse if raw=true
- Return type
TrainResult or ClientRawResponse
- Raises