cloudmersive-ocr-api-client 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/docs/ImageOcrApi.md +65 -0
- data/lib/cloudmersive-ocr-api-client/api/image_ocr_api.rb +68 -0
- data/lib/cloudmersive-ocr-api-client/version.rb +1 -1
- data/spec/api/image_ocr_api_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5daaa7a09ae31d9b73a83371af2dbaecee566850228fa9bf8a14f6d8b33d136
|
4
|
+
data.tar.gz: 1dbf9618622d1d68031a7cafc28561892c4085827e3467521c2c054d4c560285
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc3ec7df8c1063b3c7047f7a5123e47de7bd90f70c77232ad23ef72689e3811c1c8c89e3c96821ef54c008db3129a84aa23b431e83259166c8eed98410408795
|
7
|
+
data.tar.gz: 1e41349621d3f6e4d65d99280b2ce14d57db759858edd4aff8943c2105fc95a357fd4095e83747d24b751335617bd220301f003b5077b57e2c2cdaeb2228cf79
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ The powerful Optical Character Recognition (OCR) APIs let you convert scanned im
|
|
7
7
|
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
8
8
|
|
9
9
|
- API version: v1
|
10
|
-
- Package version: 1.4.
|
10
|
+
- Package version: 1.4.3
|
11
11
|
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
12
12
|
|
13
13
|
## Installation
|
@@ -23,15 +23,15 @@ gem build cloudmersive-ocr-api-client.gemspec
|
|
23
23
|
Then either install the gem locally:
|
24
24
|
|
25
25
|
```shell
|
26
|
-
gem install ./cloudmersive-ocr-api-client-1.4.
|
26
|
+
gem install ./cloudmersive-ocr-api-client-1.4.3.gem
|
27
27
|
```
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-ocr-api-client-1.4.
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-ocr-api-client-1.4.3.gem` to install the development dependencies)
|
29
29
|
|
30
30
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
31
31
|
|
32
32
|
Finally add this to the Gemfile:
|
33
33
|
|
34
|
-
gem 'cloudmersive-ocr-api-client', '~> 1.4.
|
34
|
+
gem 'cloudmersive-ocr-api-client', '~> 1.4.3'
|
35
35
|
|
36
36
|
### Install from Git
|
37
37
|
|
@@ -91,6 +91,7 @@ Class | Method | HTTP request | Description
|
|
91
91
|
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_image_words_with_location**](docs/ImageOcrApi.md#image_ocr_image_words_with_location) | **POST** /ocr/image/to/words-with-location | Convert a scanned image into words with location
|
92
92
|
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_photo_recognize_business_card**](docs/ImageOcrApi.md#image_ocr_photo_recognize_business_card) | **POST** /ocr/photo/recognize/business-card | Recognize a photo of a business card, extract key business information
|
93
93
|
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_photo_recognize_form**](docs/ImageOcrApi.md#image_ocr_photo_recognize_form) | **POST** /ocr/photo/recognize/form | Recognize a photo of a form, extract key fields and business information
|
94
|
+
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_photo_recognize_form_advanced**](docs/ImageOcrApi.md#image_ocr_photo_recognize_form_advanced) | **POST** /ocr/photo/recognize/form/advanced | Recognize a photo of a form, extract key fields using stored templates
|
94
95
|
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_photo_recognize_receipt**](docs/ImageOcrApi.md#image_ocr_photo_recognize_receipt) | **POST** /ocr/photo/recognize/receipt | Recognize a photo of a receipt, extract key business information
|
95
96
|
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_photo_to_text**](docs/ImageOcrApi.md#image_ocr_photo_to_text) | **POST** /ocr/photo/toText | Convert a photo of a document into text
|
96
97
|
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_photo_words_with_location**](docs/ImageOcrApi.md#image_ocr_photo_words_with_location) | **POST** /ocr/photo/to/words-with-location | Convert a photo of a document or receipt into words with location
|
data/docs/ImageOcrApi.md
CHANGED
@@ -8,6 +8,7 @@ Method | HTTP request | Description
|
|
8
8
|
[**image_ocr_image_words_with_location**](ImageOcrApi.md#image_ocr_image_words_with_location) | **POST** /ocr/image/to/words-with-location | Convert a scanned image into words with location
|
9
9
|
[**image_ocr_photo_recognize_business_card**](ImageOcrApi.md#image_ocr_photo_recognize_business_card) | **POST** /ocr/photo/recognize/business-card | Recognize a photo of a business card, extract key business information
|
10
10
|
[**image_ocr_photo_recognize_form**](ImageOcrApi.md#image_ocr_photo_recognize_form) | **POST** /ocr/photo/recognize/form | Recognize a photo of a form, extract key fields and business information
|
11
|
+
[**image_ocr_photo_recognize_form_advanced**](ImageOcrApi.md#image_ocr_photo_recognize_form_advanced) | **POST** /ocr/photo/recognize/form/advanced | Recognize a photo of a form, extract key fields using stored templates
|
11
12
|
[**image_ocr_photo_recognize_receipt**](ImageOcrApi.md#image_ocr_photo_recognize_receipt) | **POST** /ocr/photo/recognize/receipt | Recognize a photo of a receipt, extract key business information
|
12
13
|
[**image_ocr_photo_to_text**](ImageOcrApi.md#image_ocr_photo_to_text) | **POST** /ocr/photo/toText | Convert a photo of a document into text
|
13
14
|
[**image_ocr_photo_words_with_location**](ImageOcrApi.md#image_ocr_photo_words_with_location) | **POST** /ocr/photo/to/words-with-location | Convert a photo of a document or receipt into words with location
|
@@ -252,6 +253,70 @@ Name | Type | Description | Notes
|
|
252
253
|
|
253
254
|
|
254
255
|
|
256
|
+
# **image_ocr_photo_recognize_form_advanced**
|
257
|
+
> FormRecognitionResult image_ocr_photo_recognize_form_advanced(image_file, opts)
|
258
|
+
|
259
|
+
Recognize a photo of a form, extract key fields using stored templates
|
260
|
+
|
261
|
+
Analyzes a photograph of a form as input, and outputs key business fields and information. Customzie data to be extracted by defining fields for the form. Uses template definitions stored in Cloudmersive Configuration; to configure stored templates in a configuration bucket, log into Cloudmersive Management Portal and navigate to Settings > API Configuration > Create Bucket
|
262
|
+
|
263
|
+
### Example
|
264
|
+
```ruby
|
265
|
+
# load the gem
|
266
|
+
require 'cloudmersive-ocr-api-client'
|
267
|
+
# setup authorization
|
268
|
+
CloudmersiveOcrApiClient.configure do |config|
|
269
|
+
# Configure API key authorization: Apikey
|
270
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
271
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
272
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
273
|
+
end
|
274
|
+
|
275
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
276
|
+
|
277
|
+
image_file = File.new("/path/to/file.txt") # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
278
|
+
|
279
|
+
opts = {
|
280
|
+
bucket_id: "bucket_id_example", # String | Bucket ID of the Configuration Bucket storing the form templates
|
281
|
+
bucket_secret_key: "bucket_secret_key_example", # String | Bucket Secret Key of the Configuration Bucket storing the form templates
|
282
|
+
recognition_mode: "recognition_mode_example", # String | Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
283
|
+
preprocessing: "preprocessing_example" # String | Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement.
|
284
|
+
}
|
285
|
+
|
286
|
+
begin
|
287
|
+
#Recognize a photo of a form, extract key fields using stored templates
|
288
|
+
result = api_instance.image_ocr_photo_recognize_form_advanced(image_file, opts)
|
289
|
+
p result
|
290
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
291
|
+
puts "Exception when calling ImageOcrApi->image_ocr_photo_recognize_form_advanced: #{e}"
|
292
|
+
end
|
293
|
+
```
|
294
|
+
|
295
|
+
### Parameters
|
296
|
+
|
297
|
+
Name | Type | Description | Notes
|
298
|
+
------------- | ------------- | ------------- | -------------
|
299
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
300
|
+
**bucket_id** | **String**| Bucket ID of the Configuration Bucket storing the form templates | [optional]
|
301
|
+
**bucket_secret_key** | **String**| Bucket Secret Key of the Configuration Bucket storing the form templates | [optional]
|
302
|
+
**recognition_mode** | **String**| Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled. | [optional]
|
303
|
+
**preprocessing** | **String**| Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement. | [optional]
|
304
|
+
|
305
|
+
### Return type
|
306
|
+
|
307
|
+
[**FormRecognitionResult**](FormRecognitionResult.md)
|
308
|
+
|
309
|
+
### Authorization
|
310
|
+
|
311
|
+
[Apikey](../README.md#Apikey)
|
312
|
+
|
313
|
+
### HTTP request headers
|
314
|
+
|
315
|
+
- **Content-Type**: multipart/form-data
|
316
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
317
|
+
|
318
|
+
|
319
|
+
|
255
320
|
# **image_ocr_photo_recognize_receipt**
|
256
321
|
> ReceiptRecognitionResult image_ocr_photo_recognize_receipt(image_file, opts)
|
257
322
|
|
@@ -268,6 +268,74 @@ module CloudmersiveOcrApiClient
|
|
268
268
|
return data, status_code, headers
|
269
269
|
end
|
270
270
|
|
271
|
+
# Recognize a photo of a form, extract key fields using stored templates
|
272
|
+
# Analyzes a photograph of a form as input, and outputs key business fields and information. Customzie data to be extracted by defining fields for the form. Uses template definitions stored in Cloudmersive Configuration; to configure stored templates in a configuration bucket, log into Cloudmersive Management Portal and navigate to Settings > API Configuration > Create Bucket
|
273
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
274
|
+
# @param [Hash] opts the optional parameters
|
275
|
+
# @option opts [String] :bucket_id Bucket ID of the Configuration Bucket storing the form templates
|
276
|
+
# @option opts [String] :bucket_secret_key Bucket Secret Key of the Configuration Bucket storing the form templates
|
277
|
+
# @option opts [String] :recognition_mode Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
278
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement.
|
279
|
+
# @return [FormRecognitionResult]
|
280
|
+
def image_ocr_photo_recognize_form_advanced(image_file, opts = {})
|
281
|
+
data, _status_code, _headers = image_ocr_photo_recognize_form_advanced_with_http_info(image_file, opts)
|
282
|
+
return data
|
283
|
+
end
|
284
|
+
|
285
|
+
# Recognize a photo of a form, extract key fields using stored templates
|
286
|
+
# Analyzes a photograph of a form as input, and outputs key business fields and information. Customzie data to be extracted by defining fields for the form. Uses template definitions stored in Cloudmersive Configuration; to configure stored templates in a configuration bucket, log into Cloudmersive Management Portal and navigate to Settings > API Configuration > Create Bucket
|
287
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
288
|
+
# @param [Hash] opts the optional parameters
|
289
|
+
# @option opts [String] :bucket_id Bucket ID of the Configuration Bucket storing the form templates
|
290
|
+
# @option opts [String] :bucket_secret_key Bucket Secret Key of the Configuration Bucket storing the form templates
|
291
|
+
# @option opts [String] :recognition_mode Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
292
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement.
|
293
|
+
# @return [Array<(FormRecognitionResult, Fixnum, Hash)>] FormRecognitionResult data, response status code and response headers
|
294
|
+
def image_ocr_photo_recognize_form_advanced_with_http_info(image_file, opts = {})
|
295
|
+
if @api_client.config.debugging
|
296
|
+
@api_client.config.logger.debug "Calling API: ImageOcrApi.image_ocr_photo_recognize_form_advanced ..."
|
297
|
+
end
|
298
|
+
# verify the required parameter 'image_file' is set
|
299
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
300
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_photo_recognize_form_advanced"
|
301
|
+
end
|
302
|
+
# resource path
|
303
|
+
local_var_path = "/ocr/photo/recognize/form/advanced"
|
304
|
+
|
305
|
+
# query parameters
|
306
|
+
query_params = {}
|
307
|
+
|
308
|
+
# header parameters
|
309
|
+
header_params = {}
|
310
|
+
# HTTP header 'Accept' (if needed)
|
311
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
312
|
+
# HTTP header 'Content-Type'
|
313
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
314
|
+
header_params[:'bucketID'] = opts[:'bucket_id'] if !opts[:'bucket_id'].nil?
|
315
|
+
header_params[:'bucketSecretKey'] = opts[:'bucket_secret_key'] if !opts[:'bucket_secret_key'].nil?
|
316
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
317
|
+
header_params[:'preprocessing'] = opts[:'preprocessing'] if !opts[:'preprocessing'].nil?
|
318
|
+
|
319
|
+
# form parameters
|
320
|
+
form_params = {}
|
321
|
+
form_params["imageFile"] = image_file
|
322
|
+
|
323
|
+
# http body (model)
|
324
|
+
post_body = nil
|
325
|
+
auth_names = ['Apikey']
|
326
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
327
|
+
:header_params => header_params,
|
328
|
+
:query_params => query_params,
|
329
|
+
:form_params => form_params,
|
330
|
+
:body => post_body,
|
331
|
+
:auth_names => auth_names,
|
332
|
+
:return_type => 'FormRecognitionResult')
|
333
|
+
if @api_client.config.debugging
|
334
|
+
@api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_photo_recognize_form_advanced\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
335
|
+
end
|
336
|
+
return data, status_code, headers
|
337
|
+
end
|
338
|
+
|
271
339
|
# Recognize a photo of a receipt, extract key business information
|
272
340
|
# Analyzes a photograph of a receipt as input, and outputs key business information such as the name of the business, the address of the business, the phone number of the business, the total of the receipt, the date of the receipt, and more.
|
273
341
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
@@ -88,6 +88,22 @@ describe 'ImageOcrApi' do
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
+
# unit tests for image_ocr_photo_recognize_form_advanced
|
92
|
+
# Recognize a photo of a form, extract key fields using stored templates
|
93
|
+
# Analyzes a photograph of a form as input, and outputs key business fields and information. Customzie data to be extracted by defining fields for the form. Uses template definitions stored in Cloudmersive Configuration; to configure stored templates in a configuration bucket, log into Cloudmersive Management Portal and navigate to Settings &gt; API Configuration &gt; Create Bucket
|
94
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
95
|
+
# @param [Hash] opts the optional parameters
|
96
|
+
# @option opts [String] :bucket_id Bucket ID of the Configuration Bucket storing the form templates
|
97
|
+
# @option opts [String] :bucket_secret_key Bucket Secret Key of the Configuration Bucket storing the form templates
|
98
|
+
# @option opts [String] :recognition_mode Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
99
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement.
|
100
|
+
# @return [FormRecognitionResult]
|
101
|
+
describe 'image_ocr_photo_recognize_form_advanced test' do
|
102
|
+
it "should work" do
|
103
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
91
107
|
# unit tests for image_ocr_photo_recognize_receipt
|
92
108
|
# Recognize a photo of a receipt, extract key business information
|
93
109
|
# Analyzes a photograph of a receipt as input, and outputs key business information such as the name of the business, the address of the business, the phone number of the business, the total of the receipt, the date of the receipt, and more.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudmersive-ocr-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cloudmersive
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|