cloudmersive-ocr-api-client 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -0
- data/README.md +150 -0
- data/Rakefile +8 -0
- data/cloudmersive-ocr-api-client.gemspec +45 -0
- data/docs/BusinessCardRecognitionResult.md +15 -0
- data/docs/FieldResult.md +9 -0
- data/docs/FormDefinitionTemplate.md +9 -0
- data/docs/FormFieldDefinition.md +25 -0
- data/docs/FormRecognitionResult.md +12 -0
- data/docs/FormTableColumnDefinition.md +13 -0
- data/docs/FormTableDefinition.md +11 -0
- data/docs/GetPageAngleResult.md +9 -0
- data/docs/ImageOcrApi.md +571 -0
- data/docs/ImageToLinesWithLocationResult.md +9 -0
- data/docs/ImageToTextResponse.md +9 -0
- data/docs/ImageToWordsWithLocationResult.md +9 -0
- data/docs/OcrLineElement.md +9 -0
- data/docs/OcrPageResult.md +10 -0
- data/docs/OcrPageResultWithLinesWithLocation.md +10 -0
- data/docs/OcrPageResultWithWordsWithLocation.md +10 -0
- data/docs/OcrPhotoTextElement.md +14 -0
- data/docs/OcrWordElement.md +18 -0
- data/docs/PdfOcrApi.md +191 -0
- data/docs/PdfToLinesWithLocationResult.md +9 -0
- data/docs/PdfToTextResponse.md +9 -0
- data/docs/PdfToWordsWithLocationResult.md +9 -0
- data/docs/PhotoToWordsWithLocationResult.md +10 -0
- data/docs/Point.md +9 -0
- data/docs/PreprocessingApi.md +338 -0
- data/docs/ReceiptLineItem.md +9 -0
- data/docs/ReceiptRecognitionResult.md +16 -0
- data/docs/ReceiptsApi.md +63 -0
- data/docs/TableCellResult.md +9 -0
- data/docs/TableResult.md +9 -0
- data/docs/TableRowResult.md +8 -0
- data/git_push.sh +55 -0
- data/lib/cloudmersive-ocr-api-client.rb +70 -0
- data/lib/cloudmersive-ocr-api-client/api/image_ocr_api.rb +596 -0
- data/lib/cloudmersive-ocr-api-client/api/pdf_ocr_api.rb +207 -0
- data/lib/cloudmersive-ocr-api-client/api/preprocessing_api.rb +353 -0
- data/lib/cloudmersive-ocr-api-client/api/receipts_api.rb +78 -0
- data/lib/cloudmersive-ocr-api-client/api_client.rb +391 -0
- data/lib/cloudmersive-ocr-api-client/api_error.rb +38 -0
- data/lib/cloudmersive-ocr-api-client/configuration.rb +209 -0
- data/lib/cloudmersive-ocr-api-client/models/business_card_recognition_result.rb +256 -0
- data/lib/cloudmersive-ocr-api-client/models/field_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/form_definition_template.rb +200 -0
- data/lib/cloudmersive-ocr-api-client/models/form_field_definition.rb +358 -0
- data/lib/cloudmersive-ocr-api-client/models/form_recognition_result.rb +232 -0
- data/lib/cloudmersive-ocr-api-client/models/form_table_column_definition.rb +236 -0
- data/lib/cloudmersive-ocr-api-client/models/form_table_definition.rb +218 -0
- data/lib/cloudmersive-ocr-api-client/models/get_page_angle_result.rb +196 -0
- data/lib/cloudmersive-ocr-api-client/models/image_to_lines_with_location_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/image_to_text_response.rb +196 -0
- data/lib/cloudmersive-ocr-api-client/models/image_to_words_with_location_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_line_element.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result.rb +205 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_lines_with_location.rb +208 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_words_with_location.rb +208 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_photo_text_element.rb +248 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_word_element.rb +286 -0
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_lines_with_location_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_text_response.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_words_with_location_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/photo_to_words_with_location_result.rb +223 -0
- data/lib/cloudmersive-ocr-api-client/models/point.rb +196 -0
- data/lib/cloudmersive-ocr-api-client/models/receipt_line_item.rb +196 -0
- data/lib/cloudmersive-ocr-api-client/models/receipt_recognition_result.rb +268 -0
- data/lib/cloudmersive-ocr-api-client/models/table_cell_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/table_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/table_row_result.rb +188 -0
- data/lib/cloudmersive-ocr-api-client/version.rb +15 -0
- data/spec/api/image_ocr_api_spec.rb +169 -0
- data/spec/api/pdf_ocr_api_spec.rb +77 -0
- data/spec/api/preprocessing_api_spec.rb +107 -0
- data/spec/api/receipts_api_spec.rb +47 -0
- data/spec/api_client_spec.rb +243 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/business_card_recognition_result_spec.rb +83 -0
- data/spec/models/field_result_spec.rb +47 -0
- data/spec/models/form_definition_template_spec.rb +47 -0
- data/spec/models/form_field_definition_spec.rb +143 -0
- data/spec/models/form_recognition_result_spec.rb +65 -0
- data/spec/models/form_table_column_definition_spec.rb +71 -0
- data/spec/models/form_table_definition_spec.rb +59 -0
- data/spec/models/get_page_angle_result_spec.rb +47 -0
- data/spec/models/image_to_lines_with_location_result_spec.rb +47 -0
- data/spec/models/image_to_text_response_spec.rb +47 -0
- data/spec/models/image_to_words_with_location_result_spec.rb +47 -0
- data/spec/models/ocr_line_element_spec.rb +47 -0
- data/spec/models/ocr_page_result_spec.rb +53 -0
- data/spec/models/ocr_page_result_with_lines_with_location_spec.rb +53 -0
- data/spec/models/ocr_page_result_with_words_with_location_spec.rb +53 -0
- data/spec/models/ocr_photo_text_element_spec.rb +77 -0
- data/spec/models/ocr_word_element_spec.rb +101 -0
- data/spec/models/pdf_to_lines_with_location_result_spec.rb +47 -0
- data/spec/models/pdf_to_text_response_spec.rb +47 -0
- data/spec/models/pdf_to_words_with_location_result_spec.rb +47 -0
- data/spec/models/photo_to_words_with_location_result_spec.rb +53 -0
- data/spec/models/point_spec.rb +47 -0
- data/spec/models/receipt_line_item_spec.rb +47 -0
- data/spec/models/receipt_recognition_result_spec.rb +89 -0
- data/spec/models/table_cell_result_spec.rb +47 -0
- data/spec/models/table_result_spec.rb +47 -0
- data/spec/models/table_row_result_spec.rb +41 -0
- data/spec/spec_helper.rb +111 -0
- metadata +109 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2d61f2a0afbce56a20c9a5494488e01e97a8fc7b70d2bc3ba7c7ad9380d8e20
|
4
|
+
data.tar.gz: 89af648ebbb008d9124fb8c187b0a19d491d0161630968eb6f404e6ae3ada06d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bba1bc1f40a43fe7617957830610f5c1c76acdb21dcd8f2866e839a915be7ec66c4e013ad2cb4ee46c60c7f22ccfbab2f175118faf80fc488a95d362f53c672
|
7
|
+
data.tar.gz: 3e491b712a586afb7d29d6d7a89661719d6b5252422d6408155945b964d40c86e5d772c085468e9962ec23cd49beb3303fa66415d30ec00248eb2afe400acffb
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
# cloudmersive-ocr-api-client
|
2
|
+
|
3
|
+
CloudmersiveOcrApiClient - the Ruby gem for the ocrapi
|
4
|
+
|
5
|
+
The powerful Optical Character Recognition (OCR) APIs let you convert scanned images of pages into recognized text.
|
6
|
+
|
7
|
+
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
8
|
+
|
9
|
+
- API version: v1
|
10
|
+
- Package version: 2.0.2
|
11
|
+
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
### Build a gem
|
16
|
+
|
17
|
+
To build the Ruby code into a gem:
|
18
|
+
|
19
|
+
```shell
|
20
|
+
gem build cloudmersive-ocr-api-client.gemspec
|
21
|
+
```
|
22
|
+
|
23
|
+
Then either install the gem locally:
|
24
|
+
|
25
|
+
```shell
|
26
|
+
gem install ./cloudmersive-ocr-api-client-2.0.2.gem
|
27
|
+
```
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-ocr-api-client-2.0.2.gem` to install the development dependencies)
|
29
|
+
|
30
|
+
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
31
|
+
|
32
|
+
Finally add this to the Gemfile:
|
33
|
+
|
34
|
+
gem 'cloudmersive-ocr-api-client', '~> 2.0.2'
|
35
|
+
|
36
|
+
### Install from Git
|
37
|
+
|
38
|
+
If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
|
39
|
+
|
40
|
+
gem 'cloudmersive-ocr-api-client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
|
41
|
+
|
42
|
+
### Include the Ruby code directly
|
43
|
+
|
44
|
+
Include the Ruby code directly using `-I` as follows:
|
45
|
+
|
46
|
+
```shell
|
47
|
+
ruby -Ilib script.rb
|
48
|
+
```
|
49
|
+
|
50
|
+
## Getting Started
|
51
|
+
|
52
|
+
Please follow the [installation](#installation) procedure and then run the following code:
|
53
|
+
```ruby
|
54
|
+
# Load the gem
|
55
|
+
require 'cloudmersive-ocr-api-client'
|
56
|
+
|
57
|
+
# Setup authorization
|
58
|
+
CloudmersiveOcrApiClient.configure do |config|
|
59
|
+
# Configure API key authorization: Apikey
|
60
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
61
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
62
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
63
|
+
end
|
64
|
+
|
65
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
66
|
+
|
67
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
68
|
+
|
69
|
+
opts = {
|
70
|
+
language: 'language_example', # String | Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
71
|
+
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 before OCR is applied; this is recommended).
|
72
|
+
}
|
73
|
+
|
74
|
+
begin
|
75
|
+
#Convert a scanned image into words with location
|
76
|
+
result = api_instance.image_ocr_image_lines_with_location(image_file, opts)
|
77
|
+
p result
|
78
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
79
|
+
puts "Exception when calling ImageOcrApi->image_ocr_image_lines_with_location: #{e}"
|
80
|
+
end
|
81
|
+
|
82
|
+
```
|
83
|
+
|
84
|
+
## Documentation for API Endpoints
|
85
|
+
|
86
|
+
All URIs are relative to *https://api.cloudmersive.com*
|
87
|
+
|
88
|
+
Class | Method | HTTP request | Description
|
89
|
+
------------ | ------------- | ------------- | -------------
|
90
|
+
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_image_lines_with_location**](docs/ImageOcrApi.md#image_ocr_image_lines_with_location) | **POST** /ocr/image/to/lines-with-location | Convert a scanned image into words with location
|
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
|
+
*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
|
+
*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
|
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
|
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
|
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
|
98
|
+
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_post**](docs/ImageOcrApi.md#image_ocr_post) | **POST** /ocr/image/toText | Convert a scanned image into text
|
99
|
+
*CloudmersiveOcrApiClient::PdfOcrApi* | [**pdf_ocr_pdf_to_lines_with_location**](docs/PdfOcrApi.md#pdf_ocr_pdf_to_lines_with_location) | **POST** /ocr/pdf/to/lines-with-location | Convert a PDF into text lines with location
|
100
|
+
*CloudmersiveOcrApiClient::PdfOcrApi* | [**pdf_ocr_pdf_to_words_with_location**](docs/PdfOcrApi.md#pdf_ocr_pdf_to_words_with_location) | **POST** /ocr/pdf/to/words-with-location | Convert a PDF into words with location
|
101
|
+
*CloudmersiveOcrApiClient::PdfOcrApi* | [**pdf_ocr_post**](docs/PdfOcrApi.md#pdf_ocr_post) | **POST** /ocr/pdf/toText | Converts an uploaded PDF file into text via Optical Character Recognition.
|
102
|
+
*CloudmersiveOcrApiClient::PreprocessingApi* | [**preprocessing_binarize**](docs/PreprocessingApi.md#preprocessing_binarize) | **POST** /ocr/preprocessing/image/binarize | Convert an image of text into a binarized (light and dark) view
|
103
|
+
*CloudmersiveOcrApiClient::PreprocessingApi* | [**preprocessing_binarize_advanced**](docs/PreprocessingApi.md#preprocessing_binarize_advanced) | **POST** /ocr/preprocessing/image/binarize/advanced | Convert an image of text into a binary (light and dark) view with ML
|
104
|
+
*CloudmersiveOcrApiClient::PreprocessingApi* | [**preprocessing_get_page_angle**](docs/PreprocessingApi.md#preprocessing_get_page_angle) | **POST** /ocr/preprocessing/image/get-page-angle | Get the angle of the page / document / receipt
|
105
|
+
*CloudmersiveOcrApiClient::PreprocessingApi* | [**preprocessing_unrotate**](docs/PreprocessingApi.md#preprocessing_unrotate) | **POST** /ocr/preprocessing/image/unrotate | Detect and unrotate a document image
|
106
|
+
*CloudmersiveOcrApiClient::PreprocessingApi* | [**preprocessing_unrotate_advanced**](docs/PreprocessingApi.md#preprocessing_unrotate_advanced) | **POST** /ocr/preprocessing/image/unrotate/advanced | Detect and unrotate a document image (advanced)
|
107
|
+
*CloudmersiveOcrApiClient::PreprocessingApi* | [**preprocessing_unskew**](docs/PreprocessingApi.md#preprocessing_unskew) | **POST** /ocr/preprocessing/image/unskew | Detect and unskew a photo of a document
|
108
|
+
*CloudmersiveOcrApiClient::ReceiptsApi* | [**receipts_photo_to_csv**](docs/ReceiptsApi.md#receipts_photo_to_csv) | **POST** /ocr/receipts/photo/to/csv | Convert a photo of a receipt into a CSV file containing structured information from the receipt
|
109
|
+
|
110
|
+
|
111
|
+
## Documentation for Models
|
112
|
+
|
113
|
+
- [CloudmersiveOcrApiClient::BusinessCardRecognitionResult](docs/BusinessCardRecognitionResult.md)
|
114
|
+
- [CloudmersiveOcrApiClient::FieldResult](docs/FieldResult.md)
|
115
|
+
- [CloudmersiveOcrApiClient::FormDefinitionTemplate](docs/FormDefinitionTemplate.md)
|
116
|
+
- [CloudmersiveOcrApiClient::FormFieldDefinition](docs/FormFieldDefinition.md)
|
117
|
+
- [CloudmersiveOcrApiClient::FormRecognitionResult](docs/FormRecognitionResult.md)
|
118
|
+
- [CloudmersiveOcrApiClient::FormTableColumnDefinition](docs/FormTableColumnDefinition.md)
|
119
|
+
- [CloudmersiveOcrApiClient::FormTableDefinition](docs/FormTableDefinition.md)
|
120
|
+
- [CloudmersiveOcrApiClient::GetPageAngleResult](docs/GetPageAngleResult.md)
|
121
|
+
- [CloudmersiveOcrApiClient::ImageToLinesWithLocationResult](docs/ImageToLinesWithLocationResult.md)
|
122
|
+
- [CloudmersiveOcrApiClient::ImageToTextResponse](docs/ImageToTextResponse.md)
|
123
|
+
- [CloudmersiveOcrApiClient::ImageToWordsWithLocationResult](docs/ImageToWordsWithLocationResult.md)
|
124
|
+
- [CloudmersiveOcrApiClient::OcrLineElement](docs/OcrLineElement.md)
|
125
|
+
- [CloudmersiveOcrApiClient::OcrPageResult](docs/OcrPageResult.md)
|
126
|
+
- [CloudmersiveOcrApiClient::OcrPageResultWithLinesWithLocation](docs/OcrPageResultWithLinesWithLocation.md)
|
127
|
+
- [CloudmersiveOcrApiClient::OcrPageResultWithWordsWithLocation](docs/OcrPageResultWithWordsWithLocation.md)
|
128
|
+
- [CloudmersiveOcrApiClient::OcrPhotoTextElement](docs/OcrPhotoTextElement.md)
|
129
|
+
- [CloudmersiveOcrApiClient::OcrWordElement](docs/OcrWordElement.md)
|
130
|
+
- [CloudmersiveOcrApiClient::PdfToLinesWithLocationResult](docs/PdfToLinesWithLocationResult.md)
|
131
|
+
- [CloudmersiveOcrApiClient::PdfToTextResponse](docs/PdfToTextResponse.md)
|
132
|
+
- [CloudmersiveOcrApiClient::PdfToWordsWithLocationResult](docs/PdfToWordsWithLocationResult.md)
|
133
|
+
- [CloudmersiveOcrApiClient::PhotoToWordsWithLocationResult](docs/PhotoToWordsWithLocationResult.md)
|
134
|
+
- [CloudmersiveOcrApiClient::Point](docs/Point.md)
|
135
|
+
- [CloudmersiveOcrApiClient::ReceiptLineItem](docs/ReceiptLineItem.md)
|
136
|
+
- [CloudmersiveOcrApiClient::ReceiptRecognitionResult](docs/ReceiptRecognitionResult.md)
|
137
|
+
- [CloudmersiveOcrApiClient::TableCellResult](docs/TableCellResult.md)
|
138
|
+
- [CloudmersiveOcrApiClient::TableResult](docs/TableResult.md)
|
139
|
+
- [CloudmersiveOcrApiClient::TableRowResult](docs/TableRowResult.md)
|
140
|
+
|
141
|
+
|
142
|
+
## Documentation for Authorization
|
143
|
+
|
144
|
+
|
145
|
+
### Apikey
|
146
|
+
|
147
|
+
- **Type**: API key
|
148
|
+
- **API key parameter name**: Apikey
|
149
|
+
- **Location**: HTTP header
|
150
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
=begin
|
4
|
+
#ocrapi
|
5
|
+
|
6
|
+
#The powerful Optical Character Recognition (OCR) APIs let you convert scanned images of pages into recognized text.
|
7
|
+
|
8
|
+
OpenAPI spec version: v1
|
9
|
+
|
10
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
11
|
+
Swagger Codegen version: 2.4.14
|
12
|
+
|
13
|
+
=end
|
14
|
+
|
15
|
+
$:.push File.expand_path("../lib", __FILE__)
|
16
|
+
require "cloudmersive-ocr-api-client/version"
|
17
|
+
|
18
|
+
Gem::Specification.new do |s|
|
19
|
+
s.name = "cloudmersive-ocr-api-client"
|
20
|
+
s.version = CloudmersiveOcrApiClient::VERSION
|
21
|
+
s.platform = Gem::Platform::RUBY
|
22
|
+
s.authors = ["Cloudmersive"]
|
23
|
+
s.email = [""]
|
24
|
+
s.homepage = "https://www.cloudmersive.com/ocr-api"
|
25
|
+
s.summary = "Convert scanned documents and images to text."
|
26
|
+
s.description = "Convert scanned images of documents into rich text."
|
27
|
+
s.license = 'Apache 2.0'
|
28
|
+
s.required_ruby_version = ">= 1.9"
|
29
|
+
|
30
|
+
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
31
|
+
s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
|
32
|
+
|
33
|
+
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
|
34
|
+
s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
|
35
|
+
s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
|
36
|
+
s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
|
37
|
+
s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
|
38
|
+
s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
|
39
|
+
s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
|
40
|
+
|
41
|
+
s.files = Dir['./**/*']
|
42
|
+
s.test_files = `find spec/*`.split("\n")
|
43
|
+
s.executables = []
|
44
|
+
s.require_paths = ["lib"]
|
45
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::BusinessCardRecognitionResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if the operation was successful, false otherwise | [optional]
|
7
|
+
**person_name** | **String** | The name of the person printed on the business card (if included on the business card) | [optional]
|
8
|
+
**person_title** | **String** | The title of the person printed on the business card (if included on the business card) | [optional]
|
9
|
+
**business_name** | **String** | The name of the business printed on the business card (if included on the business card) | [optional]
|
10
|
+
**address_string** | **String** | The address printed on the business card (if included on the business card) | [optional]
|
11
|
+
**phone_number** | **String** | The phone number printed on the business card (if included on the business card) | [optional]
|
12
|
+
**email_address** | **String** | The email address printed on the business card (if included on the business card) | [optional]
|
13
|
+
**timestamp** | **DateTime** | The date and time printed on the business card (if included on the business card) | [optional]
|
14
|
+
|
15
|
+
|
data/docs/FieldResult.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::FieldResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**target_field** | [**FormFieldDefinition**](FormFieldDefinition.md) | Target field to extract from the form | [optional]
|
7
|
+
**field_values** | [**Array<OcrPhotoTextElement>**](OcrPhotoTextElement.md) | Result field value(s) extracted | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::FormDefinitionTemplate
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**field_definitions** | [**Array<FormFieldDefinition>**](FormFieldDefinition.md) | Field definitions in the template; a field is comprised of a key/value pair | [optional]
|
7
|
+
**table_definitions** | [**Array<FormTableDefinition>**](FormTableDefinition.md) | Table definitions in the template; a table is comprised of columns and rows and exists in a 2-dimensional layout; a common example of a table would be an invoice | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::FormFieldDefinition
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**field_id** | **String** | The identifier of the field; use this to identify which field is being referenced. Set to SkipField if you do not wish to return the value of this field in the result. | [optional]
|
7
|
+
**left_anchor** | **String** | Optional - the left-hand anchor of the field | [optional]
|
8
|
+
**top_anchor** | **String** | Optional - the top anchor of the field | [optional]
|
9
|
+
**bottom_anchor** | **String** | Optional - the bottom anchor of the field | [optional]
|
10
|
+
**alternate_anchor** | **String** | Optional - alterate match text for the specified anchor | [optional]
|
11
|
+
**anchor_mode** | **String** | Optional - the matching mode for the anchor. Possible values are Complete (requires the entire anchor to match) and Partial (allows only part of the anchor to match) and Horizontal (anchor must be laid out horizontally). Default is Partial. | [optional]
|
12
|
+
**data_type** | **String** | The data type of the field; possible values are INTEGER (Integer value), STRING (Arbitrary string value, spaces are permitted), DATE (Date in a structured format), DECIMAL (Decimal number), ALPHANUMERIC (Continuous alphanumeric string with no spaces), STRINGNOWHITESPACE (A string that contains no whitespace characters), SERIALNUMBER (A serial-number style string that contains letters and numbers, and certain symbols; must contain at least one number), ALPHAONLY (Alphabet characters only, no numbers or symbols or whitespace) | [optional]
|
13
|
+
**target_digit_count** | **Integer** | Optional - the target number of digits in the field; useful for fixed-length fields | [optional]
|
14
|
+
**minimum_character_count** | **Integer** | Optional - the target number of digits in the field; useful for fixed-length fields | [optional]
|
15
|
+
**allow_numeric_digits** | **BOOLEAN** | Optional - set to false to block values that contain numeric digits, set to true to allow numeric digits | [optional]
|
16
|
+
**vertical_alignment_type** | **String** | Vertical alignment of target value area relative to the field anchor; Possible values are VCenter, Top, Bottom | [optional]
|
17
|
+
**horizontal_alignment_type** | **String** | Horizontal alignment of target value area relative to the field anchor; Possible values are Left, Right | [optional]
|
18
|
+
**target_field_width_relative** | **Float** | Optional - scale factor for target field width - relative to width of field title; a value of 1.0 indicates the target value area has the same width as the field value as occurring in the image; a value of 2.0 would indicate that the target value area has 2 times the width of the field value as occurring in the image. | [optional]
|
19
|
+
**target_field_height_relative** | **Float** | Optional - scale factor for target field height - relative to height of field title | [optional]
|
20
|
+
**target_field_horizontal_adjustment** | **Float** | Optional - horizontal adjestment in relative width of the field | [optional]
|
21
|
+
**target_field_vertical_adjustment** | **Float** | Optional - vertical adjestment in relative height of the field | [optional]
|
22
|
+
**ignore** | **Array<String>** | Optional - Ignore any result items that contain a partial or complete match with these text strings | [optional]
|
23
|
+
**options** | **String** | Optional - additional options that can be set for this field definition, separated by commas. Possible values are AllowMultiMatch (allow the same anchor to be matched to multiple fields) | [optional]
|
24
|
+
|
25
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::FormRecognitionResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if the operation was successful, false otherwise | [optional]
|
7
|
+
**field_value_extraction_result** | [**Array<FieldResult>**](FieldResult.md) | Result of form field OCR data extraction | [optional]
|
8
|
+
**table_value_extraction_results** | [**Array<TableResult>**](TableResult.md) | Result of form table OCR data extraction | [optional]
|
9
|
+
**diagnostics** | **Array<String>** | Diagnostic images - default is null, enable diagnostics=true to populate this parameter with one image per field | [optional]
|
10
|
+
**best_match_form_setting_name** | **String** | Optional; populated when using photo/recognize/form/advanced with the Setting Name of the best-matching highest-relevance form | [optional]
|
11
|
+
|
12
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::FormTableColumnDefinition
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**column_id** | **String** | The identifier of the field; use this to identify which field is being referenced | [optional]
|
7
|
+
**top_anchor** | **String** | Optional - the top anchor of the column heading | [optional]
|
8
|
+
**anchor_mode** | **String** | Optional - the matching mode for the anchor. Possible values are Complete (requires the entire anchor to match) and Partial (allows only part of the anchor to match). Default is Partial. | [optional]
|
9
|
+
**data_type** | **String** | The data type of the field; possible values are INTEGER (Integer value), STRING (Arbitrary string value, spaces are permitted), DATE (Date in a structured format), DECIMAL (Decimal number), ALPHANUMERIC (Continuous alphanumeric string with no spaces), STRINGNOWHITESPACE (A string that contains no whitespace characters), SERIALNUMBER (A serial-number style string that contains letters and numbers, and certain symbols; must contain at least one number), ALPHAONLY (Alphabet characters only, no numbers or symbols or whitespace) | [optional]
|
10
|
+
**minimum_character_count** | **Integer** | Optional - the target number of digits in the field; useful for fixed-length fields | [optional]
|
11
|
+
**allow_numeric_digits** | **BOOLEAN** | Optional - set to false to block values that contain numeric digits, set to true to allow numeric digits | [optional]
|
12
|
+
|
13
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::FormTableDefinition
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**table_id** | **String** | Optional; the ID of the table | [optional]
|
7
|
+
**column_definitions** | [**Array<FormTableColumnDefinition>**](FormTableColumnDefinition.md) | Definition of the columns in the table | [optional]
|
8
|
+
**target_table_height_relative** | **Float** | Optional - scale factor for target table height - relative to maximum height of headers of columns | [optional]
|
9
|
+
**target_row_height_relative** | **Float** | Optional - scale factor for target row height - relative to height of column header | [optional]
|
10
|
+
|
11
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::GetPageAngleResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if the operation was successful, false otherwise | [optional]
|
7
|
+
**angle** | **Float** | Angle of the page in radians; 0 represents perfectly horizontal | [optional]
|
8
|
+
|
9
|
+
|
data/docs/ImageOcrApi.md
ADDED
@@ -0,0 +1,571 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::ImageOcrApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://api.cloudmersive.com*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**image_ocr_image_lines_with_location**](ImageOcrApi.md#image_ocr_image_lines_with_location) | **POST** /ocr/image/to/lines-with-location | Convert a scanned image into words with location
|
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
|
+
[**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
|
+
[**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
|
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
|
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
|
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
|
15
|
+
[**image_ocr_post**](ImageOcrApi.md#image_ocr_post) | **POST** /ocr/image/toText | Convert a scanned image into text
|
16
|
+
|
17
|
+
|
18
|
+
# **image_ocr_image_lines_with_location**
|
19
|
+
> ImageToLinesWithLocationResult image_ocr_image_lines_with_location(image_file, opts)
|
20
|
+
|
21
|
+
Convert a scanned image into words with location
|
22
|
+
|
23
|
+
Converts an uploaded image in common formats such as JPEG, PNG into lines/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
24
|
+
|
25
|
+
### Example
|
26
|
+
```ruby
|
27
|
+
# load the gem
|
28
|
+
require 'cloudmersive-ocr-api-client'
|
29
|
+
# setup authorization
|
30
|
+
CloudmersiveOcrApiClient.configure do |config|
|
31
|
+
# Configure API key authorization: Apikey
|
32
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
33
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
34
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
35
|
+
end
|
36
|
+
|
37
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
38
|
+
|
39
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
40
|
+
|
41
|
+
opts = {
|
42
|
+
language: 'language_example', # String | Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
43
|
+
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 before OCR is applied; this is recommended).
|
44
|
+
}
|
45
|
+
|
46
|
+
begin
|
47
|
+
#Convert a scanned image into words with location
|
48
|
+
result = api_instance.image_ocr_image_lines_with_location(image_file, opts)
|
49
|
+
p result
|
50
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
51
|
+
puts "Exception when calling ImageOcrApi->image_ocr_image_lines_with_location: #{e}"
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
### Parameters
|
56
|
+
|
57
|
+
Name | Type | Description | Notes
|
58
|
+
------------- | ------------- | ------------- | -------------
|
59
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
60
|
+
**language** | **String**| Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish) | [optional]
|
61
|
+
**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 before OCR is applied; this is recommended). | [optional]
|
62
|
+
|
63
|
+
### Return type
|
64
|
+
|
65
|
+
[**ImageToLinesWithLocationResult**](ImageToLinesWithLocationResult.md)
|
66
|
+
|
67
|
+
### Authorization
|
68
|
+
|
69
|
+
[Apikey](../README.md#Apikey)
|
70
|
+
|
71
|
+
### HTTP request headers
|
72
|
+
|
73
|
+
- **Content-Type**: multipart/form-data
|
74
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
# **image_ocr_image_words_with_location**
|
79
|
+
> ImageToWordsWithLocationResult image_ocr_image_words_with_location(image_file, opts)
|
80
|
+
|
81
|
+
Convert a scanned image into words with location
|
82
|
+
|
83
|
+
Converts an uploaded image in common formats such as JPEG, PNG into words/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
84
|
+
|
85
|
+
### Example
|
86
|
+
```ruby
|
87
|
+
# load the gem
|
88
|
+
require 'cloudmersive-ocr-api-client'
|
89
|
+
# setup authorization
|
90
|
+
CloudmersiveOcrApiClient.configure do |config|
|
91
|
+
# Configure API key authorization: Apikey
|
92
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
93
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
94
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
95
|
+
end
|
96
|
+
|
97
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
98
|
+
|
99
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
100
|
+
|
101
|
+
opts = {
|
102
|
+
language: 'language_example', # String | Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
103
|
+
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 before OCR is applied; this is recommended).
|
104
|
+
}
|
105
|
+
|
106
|
+
begin
|
107
|
+
#Convert a scanned image into words with location
|
108
|
+
result = api_instance.image_ocr_image_words_with_location(image_file, opts)
|
109
|
+
p result
|
110
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
111
|
+
puts "Exception when calling ImageOcrApi->image_ocr_image_words_with_location: #{e}"
|
112
|
+
end
|
113
|
+
```
|
114
|
+
|
115
|
+
### Parameters
|
116
|
+
|
117
|
+
Name | Type | Description | Notes
|
118
|
+
------------- | ------------- | ------------- | -------------
|
119
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
120
|
+
**language** | **String**| Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish) | [optional]
|
121
|
+
**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 before OCR is applied; this is recommended). | [optional]
|
122
|
+
|
123
|
+
### Return type
|
124
|
+
|
125
|
+
[**ImageToWordsWithLocationResult**](ImageToWordsWithLocationResult.md)
|
126
|
+
|
127
|
+
### Authorization
|
128
|
+
|
129
|
+
[Apikey](../README.md#Apikey)
|
130
|
+
|
131
|
+
### HTTP request headers
|
132
|
+
|
133
|
+
- **Content-Type**: multipart/form-data
|
134
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
# **image_ocr_photo_recognize_business_card**
|
139
|
+
> BusinessCardRecognitionResult image_ocr_photo_recognize_business_card(image_file)
|
140
|
+
|
141
|
+
Recognize a photo of a business card, extract key business information
|
142
|
+
|
143
|
+
Analyzes a photograph of a business card as input, and outputs key business information such as the name of the person, name of the business, the address of the business, the phone number, the email address and more.
|
144
|
+
|
145
|
+
### Example
|
146
|
+
```ruby
|
147
|
+
# load the gem
|
148
|
+
require 'cloudmersive-ocr-api-client'
|
149
|
+
# setup authorization
|
150
|
+
CloudmersiveOcrApiClient.configure do |config|
|
151
|
+
# Configure API key authorization: Apikey
|
152
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
153
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
154
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
155
|
+
end
|
156
|
+
|
157
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
158
|
+
|
159
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
160
|
+
|
161
|
+
|
162
|
+
begin
|
163
|
+
#Recognize a photo of a business card, extract key business information
|
164
|
+
result = api_instance.image_ocr_photo_recognize_business_card(image_file)
|
165
|
+
p result
|
166
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
167
|
+
puts "Exception when calling ImageOcrApi->image_ocr_photo_recognize_business_card: #{e}"
|
168
|
+
end
|
169
|
+
```
|
170
|
+
|
171
|
+
### Parameters
|
172
|
+
|
173
|
+
Name | Type | Description | Notes
|
174
|
+
------------- | ------------- | ------------- | -------------
|
175
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
176
|
+
|
177
|
+
### Return type
|
178
|
+
|
179
|
+
[**BusinessCardRecognitionResult**](BusinessCardRecognitionResult.md)
|
180
|
+
|
181
|
+
### Authorization
|
182
|
+
|
183
|
+
[Apikey](../README.md#Apikey)
|
184
|
+
|
185
|
+
### HTTP request headers
|
186
|
+
|
187
|
+
- **Content-Type**: multipart/form-data
|
188
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
# **image_ocr_photo_recognize_form**
|
193
|
+
> FormRecognitionResult image_ocr_photo_recognize_form(image_file, opts)
|
194
|
+
|
195
|
+
Recognize a photo of a form, extract key fields and business information
|
196
|
+
|
197
|
+
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.
|
198
|
+
|
199
|
+
### Example
|
200
|
+
```ruby
|
201
|
+
# load the gem
|
202
|
+
require 'cloudmersive-ocr-api-client'
|
203
|
+
# setup authorization
|
204
|
+
CloudmersiveOcrApiClient.configure do |config|
|
205
|
+
# Configure API key authorization: Apikey
|
206
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
207
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
208
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
209
|
+
end
|
210
|
+
|
211
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
212
|
+
|
213
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
214
|
+
|
215
|
+
opts = {
|
216
|
+
form_template_definition: nil, # Object | Form field definitions
|
217
|
+
recognition_mode: 'recognition_mode_example', # String | Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
218
|
+
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.
|
219
|
+
diagnostics: 'diagnostics_example', # String | Optional, diagnostics mode, default is 'false'. Possible values are 'true' (will set DiagnosticImage to a diagnostic PNG image in the result), and 'false' (no diagnostics are enabled; this is recommended for best performance).
|
220
|
+
language: 'language_example' # String | Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
221
|
+
}
|
222
|
+
|
223
|
+
begin
|
224
|
+
#Recognize a photo of a form, extract key fields and business information
|
225
|
+
result = api_instance.image_ocr_photo_recognize_form(image_file, opts)
|
226
|
+
p result
|
227
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
228
|
+
puts "Exception when calling ImageOcrApi->image_ocr_photo_recognize_form: #{e}"
|
229
|
+
end
|
230
|
+
```
|
231
|
+
|
232
|
+
### Parameters
|
233
|
+
|
234
|
+
Name | Type | Description | Notes
|
235
|
+
------------- | ------------- | ------------- | -------------
|
236
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
237
|
+
**form_template_definition** | [**Object**](.md)| Form field definitions | [optional]
|
238
|
+
**recognition_mode** | **String**| Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled. | [optional]
|
239
|
+
**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]
|
240
|
+
**diagnostics** | **String**| Optional, diagnostics mode, default is 'false'. Possible values are 'true' (will set DiagnosticImage to a diagnostic PNG image in the result), and 'false' (no diagnostics are enabled; this is recommended for best performance). | [optional]
|
241
|
+
**language** | **String**| Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish) | [optional]
|
242
|
+
|
243
|
+
### Return type
|
244
|
+
|
245
|
+
[**FormRecognitionResult**](FormRecognitionResult.md)
|
246
|
+
|
247
|
+
### Authorization
|
248
|
+
|
249
|
+
[Apikey](../README.md#Apikey)
|
250
|
+
|
251
|
+
### HTTP request headers
|
252
|
+
|
253
|
+
- **Content-Type**: multipart/form-data
|
254
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
# **image_ocr_photo_recognize_form_advanced**
|
259
|
+
> FormRecognitionResult image_ocr_photo_recognize_form_advanced(image_file, opts)
|
260
|
+
|
261
|
+
Recognize a photo of a form, extract key fields using stored templates
|
262
|
+
|
263
|
+
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
|
264
|
+
|
265
|
+
### Example
|
266
|
+
```ruby
|
267
|
+
# load the gem
|
268
|
+
require 'cloudmersive-ocr-api-client'
|
269
|
+
# setup authorization
|
270
|
+
CloudmersiveOcrApiClient.configure do |config|
|
271
|
+
# Configure API key authorization: Apikey
|
272
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
273
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
274
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
275
|
+
end
|
276
|
+
|
277
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
278
|
+
|
279
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
280
|
+
|
281
|
+
opts = {
|
282
|
+
bucket_id: 'bucket_id_example', # String | Bucket ID of the Configuration Bucket storing the form templates
|
283
|
+
bucket_secret_key: 'bucket_secret_key_example', # String | Bucket Secret Key of the Configuration Bucket storing the form templates
|
284
|
+
recognition_mode: 'recognition_mode_example', # String | Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
285
|
+
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.
|
286
|
+
diagnostics: 'diagnostics_example' # String | Optional, diagnostics mode, default is 'false'. Possible values are 'true' (will set DiagnosticImage to a diagnostic PNG image in the result), and 'false' (no diagnostics are enabled; this is recommended for best performance).
|
287
|
+
}
|
288
|
+
|
289
|
+
begin
|
290
|
+
#Recognize a photo of a form, extract key fields using stored templates
|
291
|
+
result = api_instance.image_ocr_photo_recognize_form_advanced(image_file, opts)
|
292
|
+
p result
|
293
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
294
|
+
puts "Exception when calling ImageOcrApi->image_ocr_photo_recognize_form_advanced: #{e}"
|
295
|
+
end
|
296
|
+
```
|
297
|
+
|
298
|
+
### Parameters
|
299
|
+
|
300
|
+
Name | Type | Description | Notes
|
301
|
+
------------- | ------------- | ------------- | -------------
|
302
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
303
|
+
**bucket_id** | **String**| Bucket ID of the Configuration Bucket storing the form templates | [optional]
|
304
|
+
**bucket_secret_key** | **String**| Bucket Secret Key of the Configuration Bucket storing the form templates | [optional]
|
305
|
+
**recognition_mode** | **String**| Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled. | [optional]
|
306
|
+
**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]
|
307
|
+
**diagnostics** | **String**| Optional, diagnostics mode, default is 'false'. Possible values are 'true' (will set DiagnosticImage to a diagnostic PNG image in the result), and 'false' (no diagnostics are enabled; this is recommended for best performance). | [optional]
|
308
|
+
|
309
|
+
### Return type
|
310
|
+
|
311
|
+
[**FormRecognitionResult**](FormRecognitionResult.md)
|
312
|
+
|
313
|
+
### Authorization
|
314
|
+
|
315
|
+
[Apikey](../README.md#Apikey)
|
316
|
+
|
317
|
+
### HTTP request headers
|
318
|
+
|
319
|
+
- **Content-Type**: multipart/form-data
|
320
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
# **image_ocr_photo_recognize_receipt**
|
325
|
+
> ReceiptRecognitionResult image_ocr_photo_recognize_receipt(image_file, opts)
|
326
|
+
|
327
|
+
Recognize a photo of a receipt, extract key business information
|
328
|
+
|
329
|
+
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.
|
330
|
+
|
331
|
+
### Example
|
332
|
+
```ruby
|
333
|
+
# load the gem
|
334
|
+
require 'cloudmersive-ocr-api-client'
|
335
|
+
# setup authorization
|
336
|
+
CloudmersiveOcrApiClient.configure do |config|
|
337
|
+
# Configure API key authorization: Apikey
|
338
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
339
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
340
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
341
|
+
end
|
342
|
+
|
343
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
344
|
+
|
345
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
346
|
+
|
347
|
+
opts = {
|
348
|
+
recognition_mode: 'recognition_mode_example', # String | Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
349
|
+
language: 'language_example', # String | Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
350
|
+
preprocessing: 'preprocessing_example' # String | Optional, preprocessing mode, default is 'None'. Possible values are None (no preprocessing of the image), and 'Advanced' (automatic image enhancement of the image before OCR is applied; this is recommended and needed to handle rotated receipts).
|
351
|
+
}
|
352
|
+
|
353
|
+
begin
|
354
|
+
#Recognize a photo of a receipt, extract key business information
|
355
|
+
result = api_instance.image_ocr_photo_recognize_receipt(image_file, opts)
|
356
|
+
p result
|
357
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
358
|
+
puts "Exception when calling ImageOcrApi->image_ocr_photo_recognize_receipt: #{e}"
|
359
|
+
end
|
360
|
+
```
|
361
|
+
|
362
|
+
### Parameters
|
363
|
+
|
364
|
+
Name | Type | Description | Notes
|
365
|
+
------------- | ------------- | ------------- | -------------
|
366
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
367
|
+
**recognition_mode** | **String**| Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled. | [optional]
|
368
|
+
**language** | **String**| Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish) | [optional]
|
369
|
+
**preprocessing** | **String**| Optional, preprocessing mode, default is 'None'. Possible values are None (no preprocessing of the image), and 'Advanced' (automatic image enhancement of the image before OCR is applied; this is recommended and needed to handle rotated receipts). | [optional]
|
370
|
+
|
371
|
+
### Return type
|
372
|
+
|
373
|
+
[**ReceiptRecognitionResult**](ReceiptRecognitionResult.md)
|
374
|
+
|
375
|
+
### Authorization
|
376
|
+
|
377
|
+
[Apikey](../README.md#Apikey)
|
378
|
+
|
379
|
+
### HTTP request headers
|
380
|
+
|
381
|
+
- **Content-Type**: multipart/form-data
|
382
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
# **image_ocr_photo_to_text**
|
387
|
+
> ImageToTextResponse image_ocr_photo_to_text(image_file, opts)
|
388
|
+
|
389
|
+
Convert a photo of a document into text
|
390
|
+
|
391
|
+
Converts an uploaded photo of a document in common formats such as JPEG, PNG into text via Optical Character Recognition. This API is intended to be run on photos of documents, e.g. taken with a smartphone and supports cases where other content, such as a desk, are in the frame and the camera is crooked. If you want to OCR a scanned image, use the image/toText API call instead as it is designed for scanned images.
|
392
|
+
|
393
|
+
### Example
|
394
|
+
```ruby
|
395
|
+
# load the gem
|
396
|
+
require 'cloudmersive-ocr-api-client'
|
397
|
+
# setup authorization
|
398
|
+
CloudmersiveOcrApiClient.configure do |config|
|
399
|
+
# Configure API key authorization: Apikey
|
400
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
401
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
402
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
403
|
+
end
|
404
|
+
|
405
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
406
|
+
|
407
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
408
|
+
|
409
|
+
opts = {
|
410
|
+
recognition_mode: 'recognition_mode_example', # String | Optional; possible values are 'Basic' which provides basic recognition and is not resillient to page rotation, skew or low quality images uses 1-2 API calls; 'Normal' which provides highly fault tolerant OCR recognition uses 26-30 API calls; and 'Advanced' which provides the highest quality and most fault-tolerant recognition uses 28-30 API calls. Default recognition mode is 'Advanced'
|
411
|
+
language: 'language_example' # String | Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
412
|
+
}
|
413
|
+
|
414
|
+
begin
|
415
|
+
#Convert a photo of a document into text
|
416
|
+
result = api_instance.image_ocr_photo_to_text(image_file, opts)
|
417
|
+
p result
|
418
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
419
|
+
puts "Exception when calling ImageOcrApi->image_ocr_photo_to_text: #{e}"
|
420
|
+
end
|
421
|
+
```
|
422
|
+
|
423
|
+
### Parameters
|
424
|
+
|
425
|
+
Name | Type | Description | Notes
|
426
|
+
------------- | ------------- | ------------- | -------------
|
427
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
428
|
+
**recognition_mode** | **String**| Optional; possible values are 'Basic' which provides basic recognition and is not resillient to page rotation, skew or low quality images uses 1-2 API calls; 'Normal' which provides highly fault tolerant OCR recognition uses 26-30 API calls; and 'Advanced' which provides the highest quality and most fault-tolerant recognition uses 28-30 API calls. Default recognition mode is 'Advanced' | [optional]
|
429
|
+
**language** | **String**| Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish) | [optional]
|
430
|
+
|
431
|
+
### Return type
|
432
|
+
|
433
|
+
[**ImageToTextResponse**](ImageToTextResponse.md)
|
434
|
+
|
435
|
+
### Authorization
|
436
|
+
|
437
|
+
[Apikey](../README.md#Apikey)
|
438
|
+
|
439
|
+
### HTTP request headers
|
440
|
+
|
441
|
+
- **Content-Type**: multipart/form-data
|
442
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
# **image_ocr_photo_words_with_location**
|
447
|
+
> PhotoToWordsWithLocationResult image_ocr_photo_words_with_location(image_file, opts)
|
448
|
+
|
449
|
+
Convert a photo of a document or receipt into words with location
|
450
|
+
|
451
|
+
Converts a photo of a document or receipt in common formats such as JPEG, PNG into words/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on photographs of documents. If you want to OCR scanned documents (e.g. taken with a scanner), be sure to use the image/toText API instead, as it is designed for that use case.
|
452
|
+
|
453
|
+
### Example
|
454
|
+
```ruby
|
455
|
+
# load the gem
|
456
|
+
require 'cloudmersive-ocr-api-client'
|
457
|
+
# setup authorization
|
458
|
+
CloudmersiveOcrApiClient.configure do |config|
|
459
|
+
# Configure API key authorization: Apikey
|
460
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
461
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
462
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
463
|
+
end
|
464
|
+
|
465
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
466
|
+
|
467
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
468
|
+
|
469
|
+
opts = {
|
470
|
+
recognition_mode: 'recognition_mode_example', # String | Optional; possible values are 'Normal' which provides highly fault tolerant OCR recognition uses 26-30 API calls; and 'Advanced' which provides the highest quality and most fault-tolerant recognition uses 28-30 API calls. Default recognition mode is 'Advanced'
|
471
|
+
language: 'language_example', # String | Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
472
|
+
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 before OCR is applied; this is recommended).
|
473
|
+
diagnostics: 'diagnostics_example' # String | Optional, diagnostics mode, default is 'false'. Possible values are 'true' (will set DiagnosticImage to a diagnostic PNG image in the result), and 'false' (no diagnostics are enabled; this is recommended for best performance).
|
474
|
+
}
|
475
|
+
|
476
|
+
begin
|
477
|
+
#Convert a photo of a document or receipt into words with location
|
478
|
+
result = api_instance.image_ocr_photo_words_with_location(image_file, opts)
|
479
|
+
p result
|
480
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
481
|
+
puts "Exception when calling ImageOcrApi->image_ocr_photo_words_with_location: #{e}"
|
482
|
+
end
|
483
|
+
```
|
484
|
+
|
485
|
+
### Parameters
|
486
|
+
|
487
|
+
Name | Type | Description | Notes
|
488
|
+
------------- | ------------- | ------------- | -------------
|
489
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
490
|
+
**recognition_mode** | **String**| Optional; possible values are 'Normal' which provides highly fault tolerant OCR recognition uses 26-30 API calls; and 'Advanced' which provides the highest quality and most fault-tolerant recognition uses 28-30 API calls. Default recognition mode is 'Advanced' | [optional]
|
491
|
+
**language** | **String**| Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish) | [optional]
|
492
|
+
**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 before OCR is applied; this is recommended). | [optional]
|
493
|
+
**diagnostics** | **String**| Optional, diagnostics mode, default is 'false'. Possible values are 'true' (will set DiagnosticImage to a diagnostic PNG image in the result), and 'false' (no diagnostics are enabled; this is recommended for best performance). | [optional]
|
494
|
+
|
495
|
+
### Return type
|
496
|
+
|
497
|
+
[**PhotoToWordsWithLocationResult**](PhotoToWordsWithLocationResult.md)
|
498
|
+
|
499
|
+
### Authorization
|
500
|
+
|
501
|
+
[Apikey](../README.md#Apikey)
|
502
|
+
|
503
|
+
### HTTP request headers
|
504
|
+
|
505
|
+
- **Content-Type**: multipart/form-data
|
506
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
# **image_ocr_post**
|
511
|
+
> ImageToTextResponse image_ocr_post(image_file, opts)
|
512
|
+
|
513
|
+
Convert a scanned image into text
|
514
|
+
|
515
|
+
Converts an uploaded image in common formats such as JPEG, PNG into text via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
516
|
+
|
517
|
+
### Example
|
518
|
+
```ruby
|
519
|
+
# load the gem
|
520
|
+
require 'cloudmersive-ocr-api-client'
|
521
|
+
# setup authorization
|
522
|
+
CloudmersiveOcrApiClient.configure do |config|
|
523
|
+
# Configure API key authorization: Apikey
|
524
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
525
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
526
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
527
|
+
end
|
528
|
+
|
529
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
530
|
+
|
531
|
+
image_file = File.new('/path/to/file.txt') # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
532
|
+
|
533
|
+
opts = {
|
534
|
+
recognition_mode: 'recognition_mode_example', # String | Optional; possible values are 'Basic' which provides basic recognition and is not resillient to page rotation, skew or low quality images uses 1-2 API calls; 'Normal' which provides highly fault tolerant OCR recognition uses 26-30 API calls; and 'Advanced' which provides the highest quality and most fault-tolerant recognition uses 28-30 API calls. Default recognition mode is 'Advanced'
|
535
|
+
language: 'language_example', # String | Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
|
536
|
+
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 before OCR is applied; this is recommended).
|
537
|
+
}
|
538
|
+
|
539
|
+
begin
|
540
|
+
#Convert a scanned image into text
|
541
|
+
result = api_instance.image_ocr_post(image_file, opts)
|
542
|
+
p result
|
543
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
544
|
+
puts "Exception when calling ImageOcrApi->image_ocr_post: #{e}"
|
545
|
+
end
|
546
|
+
```
|
547
|
+
|
548
|
+
### Parameters
|
549
|
+
|
550
|
+
Name | Type | Description | Notes
|
551
|
+
------------- | ------------- | ------------- | -------------
|
552
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
553
|
+
**recognition_mode** | **String**| Optional; possible values are 'Basic' which provides basic recognition and is not resillient to page rotation, skew or low quality images uses 1-2 API calls; 'Normal' which provides highly fault tolerant OCR recognition uses 26-30 API calls; and 'Advanced' which provides the highest quality and most fault-tolerant recognition uses 28-30 API calls. Default recognition mode is 'Advanced' | [optional]
|
554
|
+
**language** | **String**| Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish) | [optional]
|
555
|
+
**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 before OCR is applied; this is recommended). | [optional]
|
556
|
+
|
557
|
+
### Return type
|
558
|
+
|
559
|
+
[**ImageToTextResponse**](ImageToTextResponse.md)
|
560
|
+
|
561
|
+
### Authorization
|
562
|
+
|
563
|
+
[Apikey](../README.md#Apikey)
|
564
|
+
|
565
|
+
### HTTP request headers
|
566
|
+
|
567
|
+
- **Content-Type**: multipart/form-data
|
568
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
569
|
+
|
570
|
+
|
571
|
+
|